[Gta04-owner] Detecting cable/discharing on USB

Andreas Kemnade andreas at kemnade.info
Tue Apr 3 19:24:15 CEST 2012


Hi,

On Tue, 2012-04-03 at 17:17 +0200, Radek Polak wrote:
> Hi,
> 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 [1].
> 
> 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 
> each 20s.
> 
> 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.
> 
I would propose this file here:
/sys/bus/platform/devices/twl4030_usb/vbus

> 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
> Not charging
> root at neo:~# cat /sys/class/power_supply/twl4030_usb/online 
> 0
> root at neo:~# cat /sys/class/power_supply/twl4030_usb/current_now 
> cat: /sys/class/power_supply/twl4030_usb/current_now: No data available
> 
Ususally the current_now stuff works. It displays current drawn from
usb. I have seen the same error also once. But I do not know how
to reproduce that.

Greetings
Andreas Kemnade



More information about the Gta04-owner mailing list