Enter USB charging mode on devices that support it if any key is held down during USB insert (except on Archos where certain keys need to be avoided and players like the iRiver H1x0 which do not charge over USB and the iAudios/AMSv2 which do not yet support USB fully). Update the manual to explain the new behavior.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29889 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Giacomelli 2011-05-16 20:27:14 +00:00
parent 14cac39d19
commit 84b4c46d74
3 changed files with 9 additions and 48 deletions

View file

@ -57,7 +57,6 @@ enum {
USB_HANDLED, /* Bootloader status code */
#endif
};
#ifdef HAVE_USB_POWER
#if CONFIG_KEYPAD == RECORDER_PAD
#define USBPOWER_BUTTON BUTTON_F1
@ -65,48 +64,10 @@ enum {
#elif CONFIG_KEYPAD == ONDIO_PAD
#define USBPOWER_BUTTON BUTTON_MENU
#define USBPOWER_BTN_IGNORE BUTTON_OFF
#elif (CONFIG_KEYPAD == IPOD_4G_PAD)
#define USBPOWER_BUTTON BUTTON_MENU
#define USBPOWER_BTN_IGNORE BUTTON_PLAY
#elif CONFIG_KEYPAD == IRIVER_H300_PAD
#define USBPOWER_BUTTON BUTTON_MODE
#define USBPOWER_BTN_IGNORE BUTTON_ON
#elif CONFIG_KEYPAD == GIGABEAT_PAD
#define USBPOWER_BUTTON BUTTON_MENU
#define USBPOWER_BTN_IGNORE BUTTON_POWER
#elif (CONFIG_KEYPAD == IRIVER_H10_PAD) || \
(CONFIG_KEYPAD == MROBE100_PAD)
#define USBPOWER_BUTTON BUTTON_RIGHT
#define USBPOWER_BTN_IGNORE BUTTON_POWER
#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
(CONFIG_KEYPAD == SANSA_C200_PAD) || \
(CONFIG_KEYPAD == SANSA_CLIP_PAD) || \
(CONFIG_KEYPAD == SANSA_FUZE_PAD)
#define USBPOWER_BUTTON BUTTON_SELECT
#define USBPOWER_BTN_IGNORE BUTTON_POWER
#elif (CONFIG_KEYPAD == PHILIPS_SA9200_PAD)
#define USBPOWER_BUTTON BUTTON_PLAY
#define USBPOWER_BTN_IGNORE BUTTON_POWER
#elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD
#define USBPOWER_BUTTON BUTTON_PLAYLIST
#define USBPOWER_BTN_IGNORE BUTTON_POWER
#elif CONFIG_KEYPAD == PHILIPS_HDD6330_PAD
#define USBPOWER_BUTTON BUTTON_LEFT
#define USBPOWER_BTN_IGNORE BUTTON_POWER
#elif CONFIG_KEYPAD == SAMSUNG_YH_PAD
#define USBPOWER_BUTTON BUTTON_RIGHT
#define USBPOWER_BTN_IGNORE BUTTON_LEFT
#elif CONFIG_KEYPAD == COWON_D2_PAD
#define USBPOWER_BUTTON BUTTON_MENU
#define USBPOWER_BTN_IGNORE BUTTON_MINUS
#elif CONFIG_KEYPAD == ONDAVX747_PAD
#define USBPOWER_BUTTON BUTTON_VOL_UP
#define USBPOWER_BTN_IGNORE BUTTON_VOL_DOWN
#elif CONFIG_KEYPAD == PBELL_VIBE500_PAD
#define USBPOWER_BUTTON BUTTON_REC
#define USBPOWER_BTN_IGNORE BUTTON_POWER
#else
#define USBPOWER_BTN_IGNORE 0
#endif
#endif
#endif /* HAVE_USB_POWER */
#ifdef HAVE_USBSTACK
/* USB class drivers */

View file

@ -341,11 +341,7 @@ static inline void usb_slave_mode(bool on)
#ifdef HAVE_USB_POWER
static inline bool usb_power_button(void)
{
#if (defined(IRIVER_H10) || defined (IRIVER_H10_5GB)) && !defined(USE_ROCKBOX_USB)
return (button_status() & ~USBPOWER_BTN_IGNORE) != USBPOWER_BUTTON;
#else
return (button_status() & ~USBPOWER_BTN_IGNORE) == USBPOWER_BUTTON;
#endif
return (button_status() & ~USBPOWER_BTN_IGNORE);
}
#ifdef USB_FIREWIRE_HANDLING

View file

@ -807,10 +807,14 @@ properly.}
\opt{usb_power}{
\section{USB Charging}
\nopt{clipv2,fuzev2,clipplus}{
To charge your \dap{} over USB, hold \ActionStdUsbCharge{} while plugging it
To charge your \dap{} over USB, hold any button while plugging it
in. This will prevent it from connecting to your computer and let you
continue to use it normally. Your \dap{} must already be in Rockbox for this
to function.
\note{Be aware that this button may still perform its normal function, so
it is recommended to use a button without harmful side effects, such as
ActionStdUsbCharge{}.}
}
\opt{clipv2,fuzev2,clipplus}{
Your \dap{} will automatically charge over USB if the cable is plugged in