power_supply_changed not triggering user space event

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

power_supply_changed not triggering user space event

554 Views
anandbhavikatti
Contributor I

Hi

we are using TI BQ27210 in our project for Battery voltage monitoring purpose.we are using the default driver bq27x00_battery .c provided with Android JB4.3 on IMX6 processor.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) { struct bq27x00_reg_cache cache = {0, }; bool is_bq27500 = di->chip == BQ27500;

  cache.flags = bq27x00_read(di, BQ27x00_REG_FLAGS, is_bq27500); if (cache.flags >= 0) { cache.capacity = bq27x00_battery_read_rsoc(di); cache.temperature = bq27x00_read(di, BQ27x00_REG_TEMP, false); cache.time_to_empty = bq27x00_battery_read_time(di, BQ27x00_REG_TTE); cache.time_to_empty_avg = bq27x00_battery_read_time(di, BQ27x00_REG_TTECP); cache.time_to_full = bq27x00_battery_read_time(di, BQ27x00_REG_TTF); cache.charge_full = bq27x00_battery_read_lmd(di); cache.cycle_count = bq27x00_battery_read_cyct(di); if (!is_bq27500) cache.current_now = bq27x00_read(di, BQ27x00_REG_AI, false); /* We only have to read charge design full once */ if (di->charge_design_full <= 0) di->charge_design_full = bq27x00_battery_read_ilmd(di); } /* 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 not able post this event to userspace .We are stuck.Please guide us in right direction.

Regards Anand

Tags (1)
0 Kudos
0 Replies