troubles: permissions on sys/class/gpioXX/value file

Giuseppe Anzalone
Hello, 
I'm using emdebian on a mini2440. I'm using a LAMP Server and  a php
interface to change the value of 4 gpio. During boot, system runs the
following script to configure these 4 gpio like outputs. Because I need to
write on /sys/class/gpioXX/value  trough a non root user (that is www-data
user), the script also changes permissions from 644 to 666.

It works fine, but, I don't know why, about 6 minutes after system booting,
the permissions of the files are automatically resetted to 644. If I login
through ssh  and if I re-change the permssion  to 666 they will remain
stable and all works fine. 
It's incredible, I'm gonna be crazy!!!  

Please, if you have any suggestion... 

Thanks a lot.
 Giuseppe

The script is:

      echo 37 > /sys/class/gpio/export
      echo out > /sys/class/gpio/gpio37/direction 
      chmod 666 /sys/class/gpio/gpio37/value

      echo 38 > /sys/class/gpio/export
      echo out > /sys/class/gpio/gpio38/direction 
      chmod 666 /sys/class/gpio/gpio38/value

      echo 160 > /sys/class/gpio/export
      echo out > /sys/class/gpio/gpio160/direction 
      chmod 666 /sys/class/gpio/gpio160/value

      echo 161 > /sys/class/gpio/export
      echo out > /sys/class/gpio/gpio161/direction 
      chmod 666 /sys/class/gpio/gpio161/value

davef
Would strace provide some clues?

Giuseppe Anzalone
Thanks davef.
May be, I'll try. 
But, at the moment, I don't know which process I have to monitor.

Riccardo
Hi,

Use EmDebian and have the same problem:

~# echo 89 > /sys/clas/gpio/export
-bash: echo: write error: Device or resource is busy

where is the problem ?

Juergen Beisert
Mount the debugfs and take a look into the file /sys/kernel/debug/gpio to
get an idea who is already using this pin.