I am working on the TI OMAP platform with Android as the operating system. For one UseCase, we must switch one of the LEDs in the device. The LED has the number "Device Attributes" and from the application level [.java], we want to read "Device Attribute".
When we run the cat command at the adb prompt:
# cat /sys/devices/device_name/device_attribute
We get an "invalid length" error. Therefore, I wanted to know if there is a way to read βDevice Propertyβ so that it is available at the application level.
I found a similar question on another forum http://android.modaco.com/topic/312770-possible-solution-for-lack-of-notification-light-developers-needed , but it also went unanswered.
Thanks for answers!!!
Solution The device had only "set_device_attribute", but since there was no "get_device_attribute", we received an "invalid length" error when the "read" command was issued on this device property.
I added a new API named:
static ssize_t get_device_attribute(struct device *dev, struct device_attribute *attr, char *buf) { ......................... ......................... ......................... }
and updated device attribute
static DEVICE_ATTR(device_property, 0777,get_device_attribute, set_device_attribute);
source share