[Gta04-owner] Detecting cable/discharing on USB

NeilBrown neilb at suse.de
Tue Apr 3 23:33:19 CEST 2012


On Tue, 3 Apr 2012 17:17:21 +0200 Radek Polak <psonek2 at seznam.cz> 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.

As Andreas said, /sys/bus/platform/devices/twl4030_usb/vbus
should work.

> 
> 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.

No, it gets down to 3.95V - which for me is about 75% - and then charges up
again.  We can program that '3.95V' to some other value if we know what value
to choose.

See:
http://lists.goldelico.com/pipermail/gta04-owner/2012-February/001687.html

NeilBrown


> 
> 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
> 
> Regards
> 
> Radek
> 
> [1] 
> https://github.com/radekp/qtmoko/blob/master/devices/gta04/server/neohardware.cpp
> _______________________________________________
> Gta04-owner mailing list
> Gta04-owner at goldelico.com
> http://lists.goldelico.com/mailman/listinfo/gta04-owner

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: not available
URL: <http://lists.goldelico.com/pipermail/gta04-owner/attachments/20120404/9d9cbce9/attachment.bin>


More information about the Gta04-owner mailing list