Libsensors has no access to sysfs sensor driver atttributes


#1

have written a new HAL libsensors. My new HAL libsensors can not access sysfs attributes exposed from the driver. Sensor driver already has permission set at 0664 as shown below. static DEVICE_ATTR(enable_ps, 0664, prx_show_enable_ps, prx_set_enable_ps);

libsensors has no permission to access this attribute “enable_ps”. Following is the error sensors : SensorBase: write_attr failed to open /sys/devices/soc/75b6000.i2c/i2c-8/8-001e/enable_ps (Permission denied)

Please let me know if anyone faced this kind of issue.


#2

Hi @sksingh4476,

I’m not too familiar with libsensors, but in which context libsensors tries to access this ‘file’?
Are you linking it into a sandboxed Legato application? Or?


#3

Hi @CoRfr,

Libsensors is HAL implementation for the sensors. This library need to talk to sensor kernel driver and it does through sysfs, but in my case libsensors have no permission to access sysfs.
I am not sure if I have to modify sepolicy for this.

Thanks


#4

That could be related to SMACK labels, although I’m still not sure in which context you’re using libsensors.


#5

Hi@CoRfr,

Libsensors is used by the Android apps talking to sensors like Android Sensor Box.apk. Libsensors provide the virtual sensor for the user applications. These virtual sensors talk to kernel mode sensor driver to get the sensor data.

Thanks.


#6

Hi @sksingh4476,

not sure what is the relation to Legato then?