Hi On Monday, July 18, 2011 1:02:18 PM UTC+2, Hvr wrote: > > Hi, > > I want to handle uevent in user-space mainly for battery status > changed in my application. > Can this be done using C program? >
vold and some other platform programs do read uevents so yes it is "possible" but you need boot root rights and some additional cabapilities to be allowed to bind to a multicast socket before you can follow this approach. > Can this be done by calling a select() on one of the sysfs which > indicates change in battery voltage? > I don't think this is generally possible but would like to be proven wrong. in general the the uevent will notify of a change and the user is expected to use sysfs to read actual values. In android itself the same approach it followed: the Java code frameworks/base/services/java/com/android/server/BatteryService.java listens to UEvents and on update calls a native method to read sysfs frameworks/base/services/jni/com_android_server_BatteryService.cpp Greetings -- unsubscribe: [email protected] website: http://groups.google.com/group/android-porting
