Accessing GPIO in the HAL

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Accessing GPIO in the HAL

1,362 Views
mdomondon
Contributor I

I am trying to install a RIL into the android system and I am getting errors in the logcat -b radio that looks like this:

08-08 18:23:28.383 696 696 E IccCardProxy: setExternalState: !override and newstate unchanged from NOT_READY
08-08 18:23:28.394 260 279 E RIL : EN_3V8 gpio error /sys/class/gpio/gpio66/value (Permission denied)
08-08 18:23:28.394 260 279 E RIL : EN_3V8 gpio write error 1sys/class/gpio/gpio66/value (Bad file descriptor)
08-08 18:23:28.395 260 279 E RIL : EN_3V3 lna gpio error /sys/class/gpio/gpio65/value (Permission denied)
08-08 18:23:28.896 260 279 E RIL : wwan igt gpio error /sys/class/gpio/gpio37/value (Permission denied)

We used the gpio_export function to generate the gpios in sys devices with the symbolic links shown in the log.

When I checked the permissions for "value" using ls -l, i saw that the permissions is set to -rw-r--r--. I added code in init.rc to change the permissions for the value of gpio66, gpio65 and gpio37 to -rwxrwxrwx (tried doing it as early as possible in init.rc), I flashed the changes, verified the new permissions took effect and retested. I still got the same error above. 

But this time, I got new errors in the serial trace:

type=1400 audit(1312802732.420:4): avc: denied { write } for pid=263 comm="rild" name="value" dev="sysfs" ino=17824 scontext=u:r:rild:s0 tcontext=u:object_r:sysfs:s0 tclass=file permissive=0
type=1400 audit(1312802732.420:5): avc: denied { write } for pid=263 comm="rild" name="value" dev="sysfs" ino=17839 scontext=u:r:rild:s0 tcontext=u:object_r:sysfs:s0 tclass=file permissive=0
type=1400 audit(1312802732.920:6): avc: denied { write } for pid=263 comm="rild" name="value" dev="sysfs" ino=17855 scontext=u:r:rild:s0 tcontext=u:object_r:sysfs:s0 tclass=file permissive=0

These look like Selinux related errors. However, my code was built with "eng" set and I have set androidboot.selinux=disabled in the kernel command line.

Not sure what the proble is. Maybe someone can help?

Labels (3)
0 Kudos
1 Reply

864 Views
igorpadykov
NXP Employee
NXP Employee

Hi Mike

one can look at hal usage on

SFO15-505: Introducing I2C & GPIO user space APIs for Android 

and post issue on dedicated android forums


Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos