From 95fdad5e2827685160a5a669c3e8b4dc783995ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Udo=20Schl=C3=A4pfer?= Date: Wed, 21 Jan 2015 20:51:36 +0100 Subject: [PATCH] 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 --- apps/lang/deutsch.lang | 80 +++++++++++++++++++ apps/lang/english.lang | 80 +++++++++++++++++++ apps/menus/settings_menu.c | 3 + apps/settings.c | 2 + apps/settings.h | 1 + apps/settings_list.c | 12 +++ firmware/target/hosted/ibasso/system-ibasso.c | 2 - 7 files changed, 178 insertions(+), 2 deletions(-) diff --git a/apps/lang/deutsch.lang b/apps/lang/deutsch.lang index 6d9c025bd2..d0e0c92c2c 100644 --- a/apps/lang/deutsch.lang +++ b/apps/lang/deutsch.lang @@ -13075,3 +13075,83 @@ ibassodx90: "Freq Scaling Governor" + + id: LANG_IBASSO_USB_MODE + desc: in Settings -> General -> System -> USB Mode + user: core + + *: none + ibassodx50: "USB Mode" + ibassodx90: "USB Mode" + + + *: none + ibassodx50: "USB Modus" + ibassodx90: "USB Modus" + + + *: none + ibassodx50: "USB Modus" + ibassodx90: "USB Modus" + + + + id: LANG_IBASSO_USB_MODE_MASS_STORAGE + desc: in Settings -> General -> System -> USB Mode: Mass Storage + user: core + + *: none + ibassodx50: "Mass Storage" + ibassodx90: "Mass Storage" + + + *: none + ibassodx50: "Massenspeicher" + ibassodx90: "Massenspeicher" + + + *: none + ibassodx50: "Massenspeicher" + ibassodx90: "Massenspeicher" + + + + id: LANG_IBASSO_USB_MODE_CHARGE + desc: in Settings -> General -> System -> USB Mode: Charge Only + user: core + + *: none + ibassodx50: "Charge Only" + ibassodx90: "Charge Only" + + + *: none + ibassodx50: "Nur laden" + ibassodx90: "Nur laden" + + + *: none + ibassodx50: "Nur laden" + ibassodx90: "Nur laden" + + + + id: LANG_IBASSO_USB_MODE_ADB + desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge + user: core + + *: none + ibassodx50: "Android Debug Bridge" + ibassodx90: "Android Debug Bridge" + + + *: none + ibassodx50: "Android Debug Bridge" + ibassodx90: "Android Debug Bridge" + + + *: none + ibassodx50: "Android Debug Bridge" + ibassodx90: "Android Debug Bridge" + + diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 081e33d32c..67b8d01efc 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -13393,3 +13393,83 @@ ibassodx90: "Freq Scaling Governor" + + id: LANG_IBASSO_USB_MODE + desc: in Settings -> General -> System -> USB Mode + user: core + + *: none + ibassodx50: "USB Mode" + ibassodx90: "USB Mode" + + + *: none + ibassodx50: "USB Mode" + ibassodx90: "USB Mode" + + + *: none + ibassodx50: "USB Mode" + ibassodx90: "USB Mode" + + + + id: LANG_IBASSO_USB_MODE_MASS_STORAGE + desc: in Settings -> General -> System -> USB Mode: Mass Storage + user: core + + *: none + ibassodx50: "Mass Storage" + ibassodx90: "Mass Storage" + + + *: none + ibassodx50: "Mass Storage" + ibassodx90: "Mass Storage" + + + *: none + ibassodx50: "Mass Storage" + ibassodx90: "Mass Storage" + + + + id: LANG_IBASSO_USB_MODE_CHARGE + desc: in Settings -> General -> System -> USB Mode: Charge Only + user: core + + *: none + ibassodx50: "Charge Only" + ibassodx90: "Charge Only" + + + *: none + ibassodx50: "Charge Only" + ibassodx90: "Charge Only" + + + *: none + ibassodx50: "Charge Only" + ibassodx90: "Charge Only" + + + + id: LANG_IBASSO_USB_MODE_ADB + desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge + user: core + + *: none + ibassodx50: "Android Debug Bridge" + ibassodx90: "Android Debug Bridge" + + + *: none + ibassodx50: "Android Debug Bridge" + ibassodx90: "Android Debug Bridge" + + + *: none + ibassodx50: "Android Debug Bridge" + ibassodx90: "Android Debug Bridge" + + diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c index 6fcc3e91a9..f42550cc6a 100644 --- a/apps/menus/settings_menu.c +++ b/apps/menus/settings_menu.c @@ -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 ); diff --git a/apps/settings.c b/apps/settings.c index be7b7c30e6..a0e20839ed 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -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 */ diff --git a/apps/settings.h b/apps/settings.h index 5d25dc7ab0..ec2d1007eb 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -853,6 +853,7 @@ struct user_settings #if defined(DX50) || defined(DX90) int governor; + int usb_mode; #endif }; diff --git a/apps/settings_list.c b/apps/settings_list.c index 2c3f360cea..62f232610c 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -64,6 +64,7 @@ #if defined(DX50) || defined(DX90) #include "governor-ibasso.h" +#include "usb-ibasso.h" #endif #define NVRAM(bytes) (bytes<