You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by TimH <ti...@jti.uk.com.INVALID> on 2022/09/14 17:23:35 UTC

g_inode_sem.holder = -1

Trying to get the touchscreen on my board registered and tested. It *seems*
to register, and at one random point the touchscreen example app did report
something that looked useful but I now cannot make any sense of it.

 

The ADC itself is registered and the ADC example app works fine, but when I
try and open the TS device (/dev/input0) it hangs in inode_semtake when the
call to nxsem_wait_uninterruptible is called.

 

The only clue I have is that g_inode_sem.holder is set to -1, which
intuitively seems wrong to me, but this is way beyond me at this time of my
NuttX journey!

 

Otherwise I'm suspecting a problem/mismatch with structs perhaps from the
need to cast (think that's what it's called?) the adc_dev_s struct

 

ret = sam_tsd_register( (struct sam_adc_s *) adc, 0)

 

Any suggestions very welcome, as always :)


RE: g_inode_sem.holder = -1

Posted by TimH <ti...@jti.uk.com.INVALID>.
Thanks Greg - knowing that -1 is not error means I'm not wasting time investigating that, at least!

The problem is unrelated to the touchscreen and more an RTOS/NuttX configuration error I think - the ADC example app will run once quite happily, with either 1 sample or 0 (i.e. run forever) - but if I try and run it a second time it gets stuck forever, just like the TS example app does.

Something somewhere is misbehaving and causing semwait to wait forever so I'm going through pulling out stuff I've put in to see if it's down to me!

>-----Original Message-----
>From: Gregory Nutt <sp...@gmail.com>
>Sent: 14 September 2022 21:07
>To: dev@nuttx.apache.org
>Subject: Re: g_inode_sem.holder = -1
>
>> The only clue I have is that g_inode_sem.holder is set to -1, which
>intuitively seems wrong to me, but this is way beyond me at this time of my
>NuttX journey!
>
>The value -1 is not an error.  It means that one thread is waiting to take a
>count from the semaphore.  The value of the semaphore was 0 when that
>thread called sem_wait() (meaning that no counts are available).  The count is
>decremented to -1 while the thread is suspended waiting for a count.
>
>So this sound like the thread is waiting for an event that never occurs.
>
>
>On Wed, Sep 14, 2022 at 11:23 AM TimH <ti...@jti.uk.com.invalid> wrote:
>
>> Trying to get the touchscreen on my board registered and tested. It
>> *seems* to register, and at one random point the touchscreen example
>> app did report something that looked useful but I now cannot make any
>sense of it.
>>
>>
>>
>> The ADC itself is registered and the ADC example app works fine, but
>> when I try and open the TS device (/dev/input0) it hangs in
>> inode_semtake when the call to nxsem_wait_uninterruptible is called.
>>
>>
>>
>> The only clue I have is that g_inode_sem.holder is set to -1, which
>> intuitively seems wrong to me, but this is way beyond me at this time
>> of my NuttX journey!
>>
>>
>>
>> Otherwise I'm suspecting a problem/mismatch with structs perhaps from
>> the need to cast (think that's what it's called?) the adc_dev_s struct
>>
>>
>>
>> ret = sam_tsd_register( (struct sam_adc_s *) adc, 0)
>>
>>
>>
>> Any suggestions very welcome, as always :)
>>
>>


Re: g_inode_sem.holder = -1

Posted by Gregory Nutt <sp...@gmail.com>.
> The only clue I have is that g_inode_sem.holder is set to -1, which
intuitively seems wrong to me, but this is way beyond me at this time of my
NuttX journey!

The value -1 is not an error.  It means that one thread is waiting to
take a count from the semaphore.  The value of the semaphore was 0
when that thread called sem_wait() (meaning that no counts are
available).  The count is decremented to -1 while the thread is
suspended waiting for a count.

So this sound like the thread is waiting for an event that never occurs.


On Wed, Sep 14, 2022 at 11:23 AM TimH <ti...@jti.uk.com.invalid> wrote:

> Trying to get the touchscreen on my board registered and tested. It *seems*
> to register, and at one random point the touchscreen example app did report
> something that looked useful but I now cannot make any sense of it.
>
>
>
> The ADC itself is registered and the ADC example app works fine, but when I
> try and open the TS device (/dev/input0) it hangs in inode_semtake when the
> call to nxsem_wait_uninterruptible is called.
>
>
>
> The only clue I have is that g_inode_sem.holder is set to -1, which
> intuitively seems wrong to me, but this is way beyond me at this time of my
> NuttX journey!
>
>
>
> Otherwise I'm suspecting a problem/mismatch with structs perhaps from the
> need to cast (think that's what it's called?) the adc_dev_s struct
>
>
>
> ret = sam_tsd_register( (struct sam_adc_s *) adc, 0)
>
>
>
> Any suggestions very welcome, as always :)
>
>