FS#10198 - USB charge only setting

Attached to Project: Rockbox
Opened by Jonathan Gordon (jdgordon) - Monday, 11 May 2009, 00:01 GMT
Task Type Patches
Category Battery/Charging
Status New
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Version 3.2
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


this patch adds a setting to choose what to do on a usb connection. default is to connect. options are charge only or connect..

holding *any* button will swap the outcome...

it works, but not perfectly... and the manual patch needs to be checked
This task depends upon

Comment by Thomas Martitz (kugel.) - Monday, 11 May 2009, 01:17 GMT
I proposed this a long time ago, and it was almost immediately reject as "configurable buttons are NODO".
Comment by Tomer Shalev (tomers) - Monday, 11 May 2009, 04:07 GMT
> holding *any* button will swap the outcome...

I am currently working on HID class driver, which will use other buttons while connected, e.g. Volume control (of the host machine), aka multimedia keyboard.
I prefer keeping the 'single button to go out' for now.
Comment by Jonathan Gordon (jdgordon) - Monday, 11 May 2009, 05:54 GMT
we can only have one class driver runnnig at a time right? I think the best option is having one option for each driver and charge, and an "ask" option... possibly with a timeout
Comment by Frank Gevaerts (fg) - Monday, 11 May 2009, 09:55 GMT
You can have multiple class drivers at the same time
Comment by Jonathan Gordon (jdgordon) - Tuesday, 12 May 2009, 01:17 GMT
synced and working.... needs some testing though
Comment by Paul Louden (Llorean) - Tuesday, 12 May 2009, 01:20 GMT
@Tomer - This isn't about a button going out of USB mode. This is about a button being held *before* the connection preventing it. Since your buttons only occur during USB mode, and this button stops being relevant the instant USB mode starts, it shouldn't be a conflict.

@Kugel - This isn't a configurable button thing. You don't pick which button does anything.
Comment by Thomas Martitz (kugel.) - Tuesday, 12 May 2009, 07:07 GMT
That's how I argued too!

I don't mind, as time passes, opinions change.
Comment by Steve Bavin (pondlife) - Tuesday, 12 May 2009, 09:40 GMT
Hi JD,

Thanks for this. - I've been hoping to do a similar patch for about a year now.

The sim build fails though:
LD rockboxui.exe
/home/Steve/rockbox/buildsim/apps/settings_list.o: In function `get_settings_list':
/home/Steve/rockbox/apps/settings_list.c:1486: undefined reference to `_usb_set_charge_setting'

I guess that settings_list.c (etc.) should only worry about usb_charging and usb_charge_only if HAVE_USB_POWER is defined.
Comment by Jonathan Gordon (jdgordon) - Tuesday, 12 May 2009, 15:26 GMT
woops, yeah forgot that #ifdef, ill fix that tonight
Comment by Jonathan Gordon (jdgordon) - Sunday, 31 May 2009, 17:43 GMT
Comment by Frank Gevaerts (fg) - Sunday, 31 May 2009, 19:17 GMT
One reason for having only a single button to switch mode is that it's possible to select a harmless button. Telling people that any button works may have the effect that people do weird things like starting a recording while trying to avoid USB storage.
Personally I like the idea of having any button work, but I'm a bit nervous about doing this in general
Comment by Jonathan Gordon (jdgordon) - Sunday, 31 May 2009, 20:19 GMT
yes, but people will learn not to press buttons which cause wierd stuff to happen...
Comment by sideral (sideral) - Monday, 15 November 2010, 15:16 GMT
I love this feature.

A couple of things that could be added:
* An option to ask the user which USB mode is intended (connect vs charge-only)
* Translations

Your latest patch doesn't apply cleanly any more, I'm afraid. I've attached my adapted version of the patch.
Comment by Martin (puntarenas) - Tuesday, 25 January 2011, 09:59 GMT
Would it be possible to add a third option "connect only"?

I don't want to trigger recharging whenever I quickly add some files to my device. Allthough modern Li-ion batteries won't suffer from memory effects, it is still beneficial to completely unload them from time to time (~50 cycles) before recharging.
Comment by dash (dash) - Saturday, 07 September 2013, 17:17 GMT
Yep, the "connect only" option sounds good.