[Gta04-owner] Detecting cable/discharing on USB
psonek2 at seznam.cz
Tue Apr 3 17:17:21 CEST 2012
in the latest QtMoko i have added code that detects if GTA04 is plugged to USB
and according to it, you can set suspend interval.
It's done by reading /sys/class/power_supply/twl4030_usb/status and checking
for "Not charging" string. You can find the source here .
It works nice until the battery is fully charged. Then you start to get "Not
charging" and QtMoko switches to "On Battery" mode and starts with suspending
So the question. How to correctly detect On cable/On Battery? And btw after
checking the battery charge, it was only like 70% full. I guess it would have
completely discharged if i didnt replug the USB.
This is log from ssh:
radek at rp-core:~$ ssh root at 192.168.0.202
Linux neo 3.2.13-gta04+ #3 PREEMPT Sun Apr 1 13:55:21 UTC 2012 armv7l
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sat Jan 1 01:11:23 2000 from 192.168.0.200
root at neo:~# cat /sys/class/power_supply/twl4030_usb/status
root at neo:~# cat /sys/class/power_supply/twl4030_usb/online
root at neo:~# cat /sys/class/power_supply/twl4030_usb/current_now
cat: /sys/class/power_supply/twl4030_usb/current_now: No data available
More information about the Gta04-owner