hi, Anand I also met the same problem when reporting android battery status to user space, I can get the correct status from /sys/class/power_supply/battery by 'cat' command, meanwhile, update heartbeat also work fine for 1 minutes built in our battery device data; I use TI bq27541 battery fuel gauge and bq24703 charger, the bq24703 driver is not used in system, only checking AC in or out by gpio pin; In addition, I use android JB 4.2.2. value -2 is error 'No such file or directory', I have ever attempt to create a soft link to my battery device directory, but I still get the same error. Could you tell me how you resolve the problem?
On Friday, May 30, 2014 2:25:44 PM UTC+8, Anand Bhavikatti wrote: > Hi > > we are using TI BQ27210 <http://www.ti.com/product/BQ27210> in our > project for Battery voltage monitoring purpose.we are using the default > driver bq27x00_battery .c provided with Android JB4.3.we are able to read > the entries from the battery driver through sysfs properly.But these > details are not getting posted to the Android User space properly > > we are seeing that power_supply_changed is not triggering the > UEventThread' run function which is waiting on this event. in file > frameworks/base/core/java/android/os/UEventObserver.java i.e > > /******************************************************************* > > private static final class UEventThread extends Thread { > ................... > > while (true) { > Log.d(TAG, "***************nativeWaitForNextEvent()"); > String message = nativeWaitForNextEvent(); > Log.d(TAG, "***************got event from ---- > nativeWaitForNextEvent()"); > if (message != null) { > if (DEBUG) { > Log.d(TAG, message); > } > Log.d(TAG, "***************send event!"); > sendEvent(message); > } > } > } > > > **************************************************************************************** > > And below is our driver code which triggers power_supply changed > function.This is being called every 120 seconds properly > > static void bq27x00_update(struct bq27x00_device_info *di) > { > .....................some code here......................... > > /* Ignore current_now which is a snapshot of the current battery > state > * and is likely to be different even between two consecutive > reads */ > if (memcmp(&di->cache, &cache, sizeof(cache) - sizeof(int)) != 0) { > di->cache = cache; > printk(KERN_ERR "BQ27x00 power_supply_changed\n"); > power_supply_changed(&di->bat); > } > > di->last_update = jiffies; > } > > We are stuck.Please guide us in right direction.I found a clue in this > direction that is I see a error value returned for the function call > kobject_uevent as -2 (temp1 = -2) in below code.I dont know how to go ahead. > > static void power_supply_changed_work(struct work_struct *work) > { > unsigned long flags; > int temp1; > struct power_supply *psy = container_of(work, struct power_supply, > changed_work); > > dev_dbg(psy->dev, "%s changed flag = %d\n ", > __func__,psy->changed); > > spin_lock_irqsave(&psy->changed_lock, flags); > if (psy->changed) { > psy->changed = false; > spin_unlock_irqrestore(&psy->changed_lock, flags); > > class_for_each_device(power_supply_class, NULL, psy, > __power_supply_changed_work); > > power_supply_update_leds(psy); > > temp1 = kobject_uevent(&psy->dev->kobj, KOBJ_CHANGE); > dev_dbg(psy->dev,"temp 1 = %d",temp1); > spin_lock_irqsave(&psy->changed_lock, flags); > } > if (!psy->changed) > wake_unlock(&psy->work_wake_lock); > spin_unlock_irqrestore(&psy->changed_lock, flags); > } > > Regards > > Anand > -- -- unsubscribe: [email protected] website: http://groups.google.com/group/android-porting --- You received this message because you are subscribed to the Google Groups "android-porting" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
