AnsweredAssumed Answered

Accessing GPIO in the HAL

Question asked by Mike Domondon on Apr 5, 2018
Latest reply on Apr 11, 2018 by igorpadykov

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?

Outcomes