• Status Closed
  • Percent Complete
  • Task Type Patches
  • Category Battery/Charging
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Version 3.2
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by jdgordon - 2009-05-11
Last edited by speachy - 2020-11-13

FS#10198 - USB charge only setting

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

Closed by  speachy
2020-11-13 21:49
Reason for closing:  Out of Date
Additional comments about closing:   Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407

Code that implements this (among other things) landed as 60f581e

I proposed this a long time ago, and it was almost immediately reject as "configurable buttons are NODO".

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.

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

fg commented on 2009-05-11 09:55

You can have multiple class drivers at the same time

synced and working…. needs some testing though

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

That's how I argued too!

I don't mind, as time passes, opinions change.

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.

woops, yeah forgot that #ifdef, ill fix that tonight

fg commented on 2009-05-31 19:17

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

yes, but people will learn not to press buttons which cause wierd stuff to happen…

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.

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.

dash commented on 2013-09-07 17:17

Yep, the "connect only" option sounds good.


Available keyboard shortcuts


Task Details

Task Editing