2010-03-07 09:51:16     gpio-sysfs read error

Document created by Aaronwu Employee on Aug 20, 2013
Version 1Show Document
  • View in full screen mode

2010-03-07 09:51:16     gpio-sysfs read error

dee lock (SINGAPORE)

Message: 86919   

 

hi

 

Any ideas on what prevents a program reading from gpio-sysfs? My app reports:

 

 

 

"read (3 4096) -> 2

 

/sys/devices/virtual/gpio/gpio17/value: No such file or directory

 

error: /sys/devices/virtual/gpio/gpio17/value: read failed"

 

However the  GPIO sysfs interface was requested and is active:

 

"root:/> cat /sys/devices/virtual/gpio/gpio17/value

 

0"

 

Any ideas what might be causing this problem? I tried symlinking to the gpio-sysfs but I received the same No Such File error .

 

I wrote a small test program which can successfully read from gpio-sysfs using c routines (i.e. fopen).

 

Cheers,

 

-Dee.

QuoteReplyEditDelete

 

 

2010-03-07 10:00:36     Re: gpio-sysfs read error

Mike Frysinger (UNITED STATES)

Message: 86920   

 

run your app through strace to see where the error is coming from

 

sysfs is a virtual file system ... you cant create files in there

QuoteReplyEditDelete

 

 

2010-03-13 21:59:46     Re: gpio-sysfs read error

dee lock (SINGAPORE)

Message: 87179   

 

hi.

 

I still cannot one particular app to read from /sys/devices/virtual/gpio/

 

Anyone know why? My strace shows the following:

 

open("/sys/devices/virtual/gpio/gpio17/value", O_RDONLY) = 3

 

fstat(3, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0

 

close(3)                                = 0

 

open("/sys/devices/virtual/gpio/gpio17/value", O_RDONLY) = 3

 

lseek(3, 0, SEEK_END)                   = 4096

 

lseek(3, 0, SEEK_SET)                   = 0

 

read(3, "0\n"..., 4096)                 = 2

 

write(2, "read ("..., 6read ()                = 6

 

write(2, "3"..., 13)                     = 1

 

write(2, " "..., 1 )                     = 1

 

write(2, "4096"..., 44096)                  = 4

 

write(2, ") -> "..., 5) -> )                 = 5

 

write(2, "2"..., 12)                     = 1

 

write(2, "\n"..., 1

 

)                    = 1

 

write(2, "/sys/devices/virtual/gpio/gpio17/"..., 38/sys/devices/virtual/gpio/gpio17/value) = 38

 

write(2, ": "..., 2: )                    = 2

 

write(2, "No such file or directory"..., 25No such file or directory) = 25

 

write(2, "\n"..., 1

 

)                    = 1

 

close(3)                                = 0

 

write(2, "error: "..., 7error: )               = 7

 

write(2, "/sys/devices/virtual/gpio/gpio17/"..., 38/sys/devices/virtual/gpio/gpio17/value) = 38

 

write(2, ": read failed"..., 13: read failed)        = 13

 

write(2, "\n"..., 1

 

)

QuoteReplyEditDelete

 

 

2010-03-14 10:55:40     Re: gpio-sysfs read error

Mike Frysinger (UNITED STATES)

Message: 87182   

 

looks like your code is wrong then.  the syscalls arent returning errors.

Attachments

    Outcomes