iBasso DX50/DX90: User selectable USB mode.

Depends on http://gerrit.rockbox.org/r/#/c/1043/.

This patch adds a new setting in Settings -> General -> System: USB Mode.

Usable in Quickscreen and Shortcuts.

Possible settings are:
- Mass Storage: The default, on USB connect export the internal and external
drives as usual. Rockbox will exit gracefully in this case, since the internal
drive (/mnt/sdcard) is exported as mass storage device and Android prevents
Rockbox from continued execution.
- Charge Only: USB charge only, do not export the internal and external drives.
This will not close Rockbox.
- ADB: Enable the Android Debug Bridge. This will not close Rockbox.

Charge only and ADB are actually the same, since it is not yet established if
charge only is doable without adb and major hooks into Android.

German translation provided.

This may be genric for Android based devices but is only enabled
for iBasso Devices. Other maintainers may choose do adopt this.

Change-Id: I616247c29946c6595ebcf8f0c14b2410c9f0498b
This commit is contained in:
Udo Schläpfer 2015-01-21 20:51:36 +01:00
parent 040306a716
commit 95fdad5e28
7 changed files with 178 additions and 2 deletions

View file

@ -13075,3 +13075,83 @@
ibassodx90: "Freq Scaling Governor"
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE
desc: in Settings -> General -> System -> USB Mode
user: core
<source>
*: none
ibassodx50: "USB Mode"
ibassodx90: "USB Mode"
</source>
<dest>
*: none
ibassodx50: "USB Modus"
ibassodx90: "USB Modus"
</dest>
<voice>
*: none
ibassodx50: "USB Modus"
ibassodx90: "USB Modus"
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_MASS_STORAGE
desc: in Settings -> General -> System -> USB Mode: Mass Storage
user: core
<source>
*: none
ibassodx50: "Mass Storage"
ibassodx90: "Mass Storage"
</source>
<dest>
*: none
ibassodx50: "Massenspeicher"
ibassodx90: "Massenspeicher"
</dest>
<voice>
*: none
ibassodx50: "Massenspeicher"
ibassodx90: "Massenspeicher"
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_CHARGE
desc: in Settings -> General -> System -> USB Mode: Charge Only
user: core
<source>
*: none
ibassodx50: "Charge Only"
ibassodx90: "Charge Only"
</source>
<dest>
*: none
ibassodx50: "Nur laden"
ibassodx90: "Nur laden"
</dest>
<voice>
*: none
ibassodx50: "Nur laden"
ibassodx90: "Nur laden"
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_ADB
desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge
user: core
<source>
*: none
ibassodx50: "Android Debug Bridge"
ibassodx90: "Android Debug Bridge"
</source>
<dest>
*: none
ibassodx50: "Android Debug Bridge"
ibassodx90: "Android Debug Bridge"
</dest>
<voice>
*: none
ibassodx50: "Android Debug Bridge"
ibassodx90: "Android Debug Bridge"
</voice>
</phrase>

View file

@ -13393,3 +13393,83 @@
ibassodx90: "Freq Scaling Governor"
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE
desc: in Settings -> General -> System -> USB Mode
user: core
<source>
*: none
ibassodx50: "USB Mode"
ibassodx90: "USB Mode"
</source>
<dest>
*: none
ibassodx50: "USB Mode"
ibassodx90: "USB Mode"
</dest>
<voice>
*: none
ibassodx50: "USB Mode"
ibassodx90: "USB Mode"
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_MASS_STORAGE
desc: in Settings -> General -> System -> USB Mode: Mass Storage
user: core
<source>
*: none
ibassodx50: "Mass Storage"
ibassodx90: "Mass Storage"
</source>
<dest>
*: none
ibassodx50: "Mass Storage"
ibassodx90: "Mass Storage"
</dest>
<voice>
*: none
ibassodx50: "Mass Storage"
ibassodx90: "Mass Storage"
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_CHARGE
desc: in Settings -> General -> System -> USB Mode: Charge Only
user: core
<source>
*: none
ibassodx50: "Charge Only"
ibassodx90: "Charge Only"
</source>
<dest>
*: none
ibassodx50: "Charge Only"
ibassodx90: "Charge Only"
</dest>
<voice>
*: none
ibassodx50: "Charge Only"
ibassodx90: "Charge Only"
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_ADB
desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge
user: core
<source>
*: none
ibassodx50: "Android Debug Bridge"
ibassodx90: "Android Debug Bridge"
</source>
<dest>
*: none
ibassodx50: "Android Debug Bridge"
ibassodx90: "Android Debug Bridge"
</dest>
<voice>
*: none
ibassodx50: "Android Debug Bridge"
ibassodx90: "Android Debug Bridge"
</voice>
</phrase>

View file

@ -52,6 +52,7 @@
#if defined(DX50) || defined(DX90)
#include "governor-ibasso.h"
#include "usb-ibasso.h"
#endif
/***********************************/
@ -331,6 +332,7 @@ MENUITEM_SETTING(shortcuts_replaces_quickscreen, &global_settings.shortcuts_repl
#if defined(DX50) || defined(DX90)
MENUITEM_SETTING(governor, &global_settings.governor, NULL);
MENUITEM_SETTING(usb_mode, &global_settings.usb_mode, NULL);
#endif
MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
@ -388,6 +390,7 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
#if defined(DX50) || defined(DX90)
&governor,
&usb_mode,
#endif
);

View file

@ -107,6 +107,7 @@ struct system_status global_status;
#if defined(DX50) || defined(DX90)
#include "governor-ibasso.h"
#include "usb-ibasso.h"
#endif
@ -1088,6 +1089,7 @@ void settings_apply(bool read_disk)
#if defined(DX50) || defined(DX90)
ibasso_set_governor(global_settings.governor);
ibasso_set_usb_mode(global_settings.usb_mode);
#endif
/* This should stay last */

View file

@ -853,6 +853,7 @@ struct user_settings
#if defined(DX50) || defined(DX90)
int governor;
int usb_mode;
#endif
};

View file

@ -64,6 +64,7 @@
#if defined(DX50) || defined(DX90)
#include "governor-ibasso.h"
#include "usb-ibasso.h"
#endif
#define NVRAM(bytes) (bytes<<F_NVRAM_MASK_SHIFT)
@ -2212,6 +2213,17 @@ const struct settings_list settings[] = {
"Interactive",
"Powersave",
"Performance"),
CHOICE_SETTING(0,
usb_mode,
LANG_IBASSO_USB_MODE,
USB_MODE_MASS_STORAGE,
"usb mode",
"mass storage,charge,adb",
ibasso_set_usb_mode,
3,
ID2P(LANG_IBASSO_USB_MODE_MASS_STORAGE),
ID2P(LANG_IBASSO_USB_MODE_CHARGE),
ID2P(LANG_IBASSO_USB_MODE_ADB)),
#endif
};

View file

@ -32,7 +32,6 @@
#include "button-ibasso.h"
#include "debug-ibasso.h"
#include "sysfs-ibasso.h"
#include "usb-ibasso.h"
#include "vold-ibasso.h"
@ -50,7 +49,6 @@ void system_init(void)
stackbegin = stackend = (uintptr_t*) &stack;
vold_monitor_start();
ibasso_set_usb_mode(USB_MODE_MASS_STORAGE);
/*
Prevent device from deep sleeping, which will interrupt playback.