Rockbox

This is the bug/patch tracker for Rockbox. Click here for more information.

Quick links: Bugs · Patches · Rockbox frontpage

Tasklist

FS#10198 - USB charge only setting

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

Details

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
   usb_charge_setting.diff (7.1 KiB)
 apps/screens.c                              |    2 -
 apps/lang/english.lang                      |   17 ++++++++++++++
 apps/settings.h                             |    4 ++-
 apps/menus/settings_menu.c                  |    7 ++++++
 apps/settings_list.c                        |    3 ++
 firmware/export/usb.h                       |   32 +---------------------------
 firmware/usb.c                              |   20 +++++++++--------
 manual/configure_rockbox/system_options.tex |   11 +++++++++
 8 files changed, 55 insertions(+), 41 deletions(-)

This task depends upon

Comment by Thomas Martitz (kugel.) - Monday, 11 May 2009, 03:17 GMT+2
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, 06:07 GMT+2
> 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, 07:54 GMT+2
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, 11:55 GMT+2
You can have multiple class drivers at the same time
Comment by Jonathan Gordon (jdgordon) - Tuesday, 12 May 2009, 03:17 GMT+2
synced and working.... needs some testing though
   usb_charge_setting.diff (6.6 KiB)
 apps/lang/english.lang                      |   17 ++++++++++++++
 apps/settings.h                             |    4 ++-
 apps/menus/settings_menu.c                  |    7 ++++++
 apps/settings_list.c                        |    3 ++
 firmware/export/usb.h                       |   32 +---------------------------
 firmware/usb.c                              |   20 +++++++++--------
 manual/configure_rockbox/system_options.tex |   11 +++++++++
 7 files changed, 54 insertions(+), 40 deletions(-)

Comment by Paul Louden (Llorean) - Tuesday, 12 May 2009, 03:20 GMT+2
@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, 09:07 GMT+2
That's how I argued too!

I don't mind, as time passes, opinions change.
Comment by Steve Bavin (pondlife) - Tuesday, 12 May 2009, 11:40 GMT+2
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, 17:26 GMT+2
woops, yeah forgot that #ifdef, ill fix that tonight
Comment by Jonathan Gordon (jdgordon) - Sunday, 31 May 2009, 19:43 GMT+2
updated
   usb_charge_setting.diff (7.4 KiB)
 apps/lang/english.lang                      |   17 ++++++++++++
 apps/settings.h                             |    4 ++-
 apps/menus/settings_menu.c                  |    7 +++++
 apps/settings_list.c                        |    5 +++
 apps/features.txt                           |    2 -
 firmware/export/usb.h                       |   37 +---------------------------
 firmware/usb.c                              |   20 ++++++++-------
 manual/configure_rockbox/system_options.tex |   11 ++++++++
 8 files changed, 57 insertions(+), 46 deletions(-)

Comment by Frank Gevaerts (fg) - Sunday, 31 May 2009, 21:17 GMT+2
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, 22:19 GMT+2
yes, but people will learn not to press buttons which cause wierd stuff to happen...
Comment by sideral (sideral) - Monday, 15 November 2010, 16:16 GMT+2
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.
   0001-Allow-charge-only-mode-when-connecting-to-a-... (8.4 KiB)
 b/apps/lang/english.lang                      |   17 ++++++++
 b/apps/menus/settings_menu.c                  |    7 +++
 b/apps/settings.h                             |    4 +-
 b/apps/settings_list.c                        |    7 +++
 b/firmware/export/usb.h                       |   52 +-------------------------
 b/firmware/usb.c                              |   20 +++++-----
 b/manual/configure_rockbox/system_options.tex |   11 +++++
 7 files changed, 58 insertions(+), 60 deletions(-)

Comment by Martin (puntarenas) - Tuesday, 25 January 2011, 10:59 GMT+2
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.

Loading...