diff --git a/apps/lang/bulgarian.lang b/apps/lang/bulgarian.lang index 7116e06927..ad65efd7e7 100644 --- a/apps/lang/bulgarian.lang +++ b/apps/lang/bulgarian.lang @@ -13134,7 +13134,7 @@ - id: LANG_IBASSO_USB_MODE_ADB + id: LANG_USB_MODE_ADB desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge user: core @@ -13205,7 +13205,7 @@ - id: LANG_IBASSO_USB_MODE_CHARGE + id: LANG_USB_MODE_CHARGE desc: in Settings -> General -> System -> USB Mode: Charge Only user: core @@ -13259,7 +13259,7 @@ - id: LANG_IBASSO_USB_MODE + id: LANG_USB_MODE desc: in Settings -> General -> System -> USB Mode user: core @@ -13299,7 +13299,7 @@ - id: LANG_IBASSO_USB_MODE_MASS_STORAGE + id: LANG_USB_MODE_MASS_STORAGE desc: in Settings -> General -> System -> USB Mode: Mass Storage user: core diff --git a/apps/lang/chinese-simp.lang b/apps/lang/chinese-simp.lang index 73884e567a..e3de41e636 100644 --- a/apps/lang/chinese-simp.lang +++ b/apps/lang/chinese-simp.lang @@ -13109,7 +13109,7 @@ - id: LANG_IBASSO_USB_MODE + id: LANG_USB_MODE desc: in Settings -> General -> System -> USB Mode user: core @@ -13129,7 +13129,7 @@ - id: LANG_IBASSO_USB_MODE_MASS_STORAGE + id: LANG_USB_MODE_MASS_STORAGE desc: in Settings -> General -> System -> USB Mode: Mass Storage user: core @@ -13149,7 +13149,7 @@ - id: LANG_IBASSO_USB_MODE_CHARGE + id: LANG_USB_MODE_CHARGE desc: in Settings -> General -> System -> USB Mode: Charge Only user: core @@ -13169,7 +13169,7 @@ - id: LANG_IBASSO_USB_MODE_ADB + id: LANG_USB_MODE_ADB desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge user: core diff --git a/apps/lang/chinese-trad.lang b/apps/lang/chinese-trad.lang index fa3434a85e..6b8faee6a5 100644 --- a/apps/lang/chinese-trad.lang +++ b/apps/lang/chinese-trad.lang @@ -11608,7 +11608,7 @@ - id: LANG_IBASSO_USB_MODE + id: LANG_USB_MODE desc: in Settings -> General -> System -> USB Mode user: core @@ -11628,7 +11628,7 @@ - id: LANG_IBASSO_USB_MODE_MASS_STORAGE + id: LANG_USB_MODE_MASS_STORAGE desc: in Settings -> General -> System -> USB Mode: Mass Storage user: core @@ -11648,7 +11648,7 @@ - id: LANG_IBASSO_USB_MODE_CHARGE + id: LANG_USB_MODE_CHARGE desc: in Settings -> General -> System -> USB Mode: Charge Only user: core @@ -11668,7 +11668,7 @@ - id: LANG_IBASSO_USB_MODE_ADB + id: LANG_USB_MODE_ADB desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge user: core diff --git a/apps/lang/deutsch.lang b/apps/lang/deutsch.lang index 9efcedb6d7..a21b2811d4 100644 --- a/apps/lang/deutsch.lang +++ b/apps/lang/deutsch.lang @@ -13032,7 +13032,7 @@ - id: LANG_IBASSO_USB_MODE + id: LANG_USB_MODE desc: in Settings -> General -> System -> USB Mode user: core @@ -13052,7 +13052,7 @@ - id: LANG_IBASSO_USB_MODE_MASS_STORAGE + id: LANG_USB_MODE_MASS_STORAGE desc: in Settings -> General -> System -> USB Mode: Mass Storage user: core @@ -13072,7 +13072,7 @@ - id: LANG_IBASSO_USB_MODE_CHARGE + id: LANG_USB_MODE_CHARGE desc: in Settings -> General -> System -> USB Mode: Charge Only user: core @@ -13092,7 +13092,7 @@ - id: LANG_IBASSO_USB_MODE_ADB + id: LANG_USB_MODE_ADB desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge user: core diff --git a/apps/lang/english-us.lang b/apps/lang/english-us.lang index b9a697b779..141c148db2 100644 --- a/apps/lang/english-us.lang +++ b/apps/lang/english-us.lang @@ -12873,7 +12873,7 @@ - id: LANG_IBASSO_USB_MODE + id: LANG_USB_MODE desc: in Settings -> General -> System -> USB Mode user: core @@ -12972,7 +12972,7 @@ - id: LANG_IBASSO_USB_MODE_ADB + id: LANG_USB_MODE_ADB desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge user: core @@ -13702,7 +13702,7 @@ - id: LANG_IBASSO_USB_MODE_MASS_STORAGE + id: LANG_USB_MODE_MASS_STORAGE desc: in Settings -> General -> System -> USB Mode: Mass Storage user: core @@ -13784,7 +13784,7 @@ - id: LANG_IBASSO_USB_MODE_CHARGE + id: LANG_USB_MODE_CHARGE desc: in Settings -> General -> System -> USB Mode: Charge Only user: core diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 48ffd2af25..d0b088cf76 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -12769,71 +12769,59 @@ - id: LANG_IBASSO_USB_MODE + id: LANG_USB_MODE desc: in Settings -> General -> System -> USB Mode user: core - *: none - ibassodx50,ibassodx90: "USB Mode" + *: "USB Mode" - *: none - ibassodx50,ibassodx90: "USB Mode" + *: "USB Mode" - *: none - ibassodx50,ibassodx90: "USB Mode" + *: "USB Mode" - id: LANG_IBASSO_USB_MODE_MASS_STORAGE + id: LANG_USB_MODE_MASS_STORAGE desc: in Settings -> General -> System -> USB Mode: Mass Storage user: core - *: none - ibassodx50,ibassodx90: "Mass Storage" + *: "Mass Storage" - *: none - ibassodx50,ibassodx90: "Mass Storage" + *: "Mass Storage" - *: none - ibassodx50,ibassodx90: "Mass Storage" + *: "Mass Storage" - id: LANG_IBASSO_USB_MODE_CHARGE + id: LANG_USB_MODE_CHARGE desc: in Settings -> General -> System -> USB Mode: Charge Only user: core - *: none - ibassodx50,ibassodx90: "Charge Only" + *: "Charge Only" - *: none - ibassodx50,ibassodx90: "Charge Only" + *: "Charge Only" - *: none - ibassodx50,ibassodx90: "Charge Only" + *: "Charge Only" - id: LANG_IBASSO_USB_MODE_ADB + id: LANG_USB_MODE_ADB desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge user: core - *: none - ibassodx50,ibassodx90: "Android Debug Bridge" + *: "Android Debug Bridge" - *: none - ibassodx50,ibassodx90: "Android Debug Bridge" + *: "Android Debug Bridge" - *: none - ibassodx50,ibassodx90: "Android Debug Bridge" + *: "Android Debug Bridge" @@ -16344,3 +16332,17 @@ *: "Browse" + + id: LANG_ENTER_USB_STORAGE_MODE_QUERY + desc: upon plugging in USB + user: core + + *: "Enter USB mass storage mode?" + + + *: "Enter USB mass storage mode?" + + + *: "Enter USB mass storage mode?" + + diff --git a/apps/lang/francais.lang b/apps/lang/francais.lang index 8763c26d54..9baf25bee6 100644 --- a/apps/lang/francais.lang +++ b/apps/lang/francais.lang @@ -12461,7 +12461,7 @@ - id: LANG_IBASSO_USB_MODE_MASS_STORAGE + id: LANG_USB_MODE_MASS_STORAGE desc: in Settings -> General -> System -> USB Mode: Mass Storage user: core @@ -12662,7 +12662,7 @@ - id: LANG_IBASSO_USB_MODE_CHARGE + id: LANG_USB_MODE_CHARGE desc: in Settings -> General -> System -> USB Mode: Charge Only user: core @@ -12682,7 +12682,7 @@ - id: LANG_IBASSO_USB_MODE_ADB + id: LANG_USB_MODE_ADB desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge user: core @@ -12750,7 +12750,7 @@ - id: LANG_IBASSO_USB_MODE + id: LANG_USB_MODE desc: in Settings -> General -> System -> USB Mode user: core diff --git a/apps/lang/greek.lang b/apps/lang/greek.lang index 54381273d2..1a83188592 100644 --- a/apps/lang/greek.lang +++ b/apps/lang/greek.lang @@ -11641,7 +11641,7 @@ - id: LANG_IBASSO_USB_MODE_CHARGE + id: LANG_USB_MODE_CHARGE desc: in Settings -> General -> System -> USB Mode: Charge Only user: core @@ -12225,7 +12225,7 @@ - id: LANG_IBASSO_USB_MODE + id: LANG_USB_MODE desc: in Settings -> General -> System -> USB Mode user: core @@ -12798,7 +12798,7 @@ - id: LANG_IBASSO_USB_MODE_MASS_STORAGE + id: LANG_USB_MODE_MASS_STORAGE desc: in Settings -> General -> System -> USB Mode: Mass Storage user: core @@ -13436,7 +13436,7 @@ - id: LANG_IBASSO_USB_MODE_ADB + id: LANG_USB_MODE_ADB desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge user: core diff --git a/apps/lang/italiano.lang b/apps/lang/italiano.lang index 22fad246a4..1d28810562 100644 --- a/apps/lang/italiano.lang +++ b/apps/lang/italiano.lang @@ -12414,7 +12414,7 @@ desc: deprecated - id: LANG_IBASSO_USB_MODE_MASS_STORAGE + id: LANG_USB_MODE_MASS_STORAGE desc: in Settings -> General -> System -> USB Mode: Mass Storage user: core @@ -12566,7 +12566,7 @@ desc: deprecated - id: LANG_IBASSO_USB_MODE_CHARGE + id: LANG_USB_MODE_CHARGE desc: in Settings -> General -> System -> USB Mode: Charge Only user: core @@ -12631,7 +12631,7 @@ desc: deprecated - id: LANG_IBASSO_USB_MODE + id: LANG_USB_MODE desc: in Settings -> General -> System -> USB Mode user: core @@ -12676,7 +12676,7 @@ desc: deprecated - id: LANG_IBASSO_USB_MODE_ADB + id: LANG_USB_MODE_ADB desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge user: core diff --git a/apps/lang/japanese.lang b/apps/lang/japanese.lang index 93db2fa3bb..723d4db175 100644 --- a/apps/lang/japanese.lang +++ b/apps/lang/japanese.lang @@ -12936,7 +12936,7 @@ - id: LANG_IBASSO_USB_MODE_CHARGE + id: LANG_USB_MODE_CHARGE desc: in Settings -> General -> System -> USB Mode: Charge Only user: core @@ -12956,7 +12956,7 @@ - id: LANG_IBASSO_USB_MODE + id: LANG_USB_MODE desc: in Settings -> General -> System -> USB Mode user: core @@ -13083,7 +13083,7 @@ - id: LANG_IBASSO_USB_MODE_MASS_STORAGE + id: LANG_USB_MODE_MASS_STORAGE desc: in Settings -> General -> System -> USB Mode: Mass Storage user: core @@ -13247,7 +13247,7 @@ - id: LANG_IBASSO_USB_MODE_ADB + id: LANG_USB_MODE_ADB desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge user: core diff --git a/apps/lang/magyar.lang b/apps/lang/magyar.lang index 7493b9dfe5..f00b9b857f 100644 --- a/apps/lang/magyar.lang +++ b/apps/lang/magyar.lang @@ -11844,7 +11844,7 @@ - id: LANG_IBASSO_USB_MODE + id: LANG_USB_MODE desc: in Settings -> General -> System -> USB Mode user: core @@ -12522,7 +12522,7 @@ - id: LANG_IBASSO_USB_MODE_CHARGE + id: LANG_USB_MODE_CHARGE desc: in Settings -> General -> System -> USB Mode: Charge Only user: core @@ -13163,7 +13163,7 @@ - id: LANG_IBASSO_USB_MODE_MASS_STORAGE + id: LANG_USB_MODE_MASS_STORAGE desc: in Settings -> General -> System -> USB Mode: Mass Storage user: core @@ -13197,7 +13197,7 @@ - id: LANG_IBASSO_USB_MODE_ADB + id: LANG_USB_MODE_ADB desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge user: core diff --git a/apps/lang/nederlands.lang b/apps/lang/nederlands.lang index 3eefb29bbb..3aa7a64c2f 100644 --- a/apps/lang/nederlands.lang +++ b/apps/lang/nederlands.lang @@ -13316,7 +13316,7 @@ - id: LANG_IBASSO_USB_MODE_MASS_STORAGE + id: LANG_USB_MODE_MASS_STORAGE desc: in Settings -> General -> System -> USB Mode: Mass Storage user: core @@ -13336,7 +13336,7 @@ - id: LANG_IBASSO_USB_MODE + id: LANG_USB_MODE desc: in Settings -> General -> System -> USB Mode user: core @@ -13446,7 +13446,7 @@ - id: LANG_IBASSO_USB_MODE_CHARGE + id: LANG_USB_MODE_CHARGE desc: in Settings -> General -> System -> USB Mode: Charge Only user: core @@ -13466,7 +13466,7 @@ - id: LANG_IBASSO_USB_MODE_ADB + id: LANG_USB_MODE_ADB desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge user: core diff --git a/apps/lang/norsk.lang b/apps/lang/norsk.lang index f6945d41c1..dbe5422e59 100644 --- a/apps/lang/norsk.lang +++ b/apps/lang/norsk.lang @@ -11152,7 +11152,7 @@ - id: LANG_IBASSO_USB_MODE_CHARGE + id: LANG_USB_MODE_CHARGE desc: in Settings -> General -> System -> USB Mode: Charge Only user: core @@ -11471,7 +11471,7 @@ - id: LANG_IBASSO_USB_MODE + id: LANG_USB_MODE desc: in Settings -> General -> System -> USB Mode user: core @@ -11646,7 +11646,7 @@ - id: LANG_IBASSO_USB_MODE_ADB + id: LANG_USB_MODE_ADB desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge user: core @@ -12333,7 +12333,7 @@ - id: LANG_IBASSO_USB_MODE_MASS_STORAGE + id: LANG_USB_MODE_MASS_STORAGE desc: in Settings -> General -> System -> USB Mode: Mass Storage user: core diff --git a/apps/lang/polski.lang b/apps/lang/polski.lang index 7529d200d4..10399b14c8 100644 --- a/apps/lang/polski.lang +++ b/apps/lang/polski.lang @@ -12517,7 +12517,7 @@ - id: LANG_IBASSO_USB_MODE_CHARGE + id: LANG_USB_MODE_CHARGE desc: in Settings -> General -> System -> USB Mode: Charge Only user: core @@ -12551,7 +12551,7 @@ - id: LANG_IBASSO_USB_MODE + id: LANG_USB_MODE desc: in Settings -> General -> System -> USB Mode user: core @@ -12619,7 +12619,7 @@ - id: LANG_IBASSO_USB_MODE_MASS_STORAGE + id: LANG_USB_MODE_MASS_STORAGE desc: in Settings -> General -> System -> USB Mode: Mass Storage user: core @@ -12636,7 +12636,7 @@ - id: LANG_IBASSO_USB_MODE_ADB + id: LANG_USB_MODE_ADB desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge user: core diff --git a/apps/lang/portugues.lang b/apps/lang/portugues.lang index ff72cf0cb8..e511f3bfdd 100644 --- a/apps/lang/portugues.lang +++ b/apps/lang/portugues.lang @@ -13146,7 +13146,7 @@ - id: LANG_IBASSO_USB_MODE_MASS_STORAGE + id: LANG_USB_MODE_MASS_STORAGE desc: in Settings -> General -> System -> USB Mode: Mass Storage user: core @@ -13237,7 +13237,7 @@ - id: LANG_IBASSO_USB_MODE + id: LANG_USB_MODE desc: in Settings -> General -> System -> USB Mode user: core @@ -13257,7 +13257,7 @@ - id: LANG_IBASSO_USB_MODE_CHARGE + id: LANG_USB_MODE_CHARGE desc: in Settings -> General -> System -> USB Mode: Charge Only user: core @@ -13328,7 +13328,7 @@ - id: LANG_IBASSO_USB_MODE_ADB + id: LANG_USB_MODE_ADB desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge user: core diff --git a/apps/lang/russian.lang b/apps/lang/russian.lang index 769c1fb8c6..842ae14764 100644 --- a/apps/lang/russian.lang +++ b/apps/lang/russian.lang @@ -13083,7 +13083,7 @@ - id: LANG_IBASSO_USB_MODE + id: LANG_USB_MODE desc: in Settings -> General -> System -> USB Mode user: core @@ -13103,7 +13103,7 @@ - id: LANG_IBASSO_USB_MODE_CHARGE + id: LANG_USB_MODE_CHARGE desc: in Settings -> General -> System -> USB Mode: Charge Only user: core @@ -13137,7 +13137,7 @@ - id: LANG_IBASSO_USB_MODE_ADB + id: LANG_USB_MODE_ADB desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge user: core @@ -13236,7 +13236,7 @@ - id: LANG_IBASSO_USB_MODE_MASS_STORAGE + id: LANG_USB_MODE_MASS_STORAGE desc: in Settings -> General -> System -> USB Mode: Mass Storage user: core diff --git a/apps/lang/slovak.lang b/apps/lang/slovak.lang index 058e2ce563..4468ac392d 100644 --- a/apps/lang/slovak.lang +++ b/apps/lang/slovak.lang @@ -12578,7 +12578,7 @@ - id: LANG_IBASSO_USB_MODE + id: LANG_USB_MODE desc: in Settings -> General -> System -> USB Mode user: core @@ -12612,7 +12612,7 @@ - id: LANG_IBASSO_USB_MODE_ADB + id: LANG_USB_MODE_ADB desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge user: core @@ -12629,7 +12629,7 @@ - id: LANG_IBASSO_USB_MODE_MASS_STORAGE + id: LANG_USB_MODE_MASS_STORAGE desc: in Settings -> General -> System -> USB Mode: Mass Storage user: core @@ -12663,7 +12663,7 @@ - id: LANG_IBASSO_USB_MODE_CHARGE + id: LANG_USB_MODE_CHARGE desc: in Settings -> General -> System -> USB Mode: Charge Only user: core diff --git a/apps/lang/srpski.lang b/apps/lang/srpski.lang index 32ce847167..e7de54aadc 100644 --- a/apps/lang/srpski.lang +++ b/apps/lang/srpski.lang @@ -12597,7 +12597,7 @@ - id: LANG_IBASSO_USB_MODE + id: LANG_USB_MODE desc: in Settings -> General -> System -> USB Mode user: core @@ -12628,7 +12628,7 @@ - id: LANG_IBASSO_USB_MODE_ADB + id: LANG_USB_MODE_ADB desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge user: core @@ -12752,7 +12752,7 @@ - id: LANG_IBASSO_USB_MODE_MASS_STORAGE + id: LANG_USB_MODE_MASS_STORAGE desc: in Settings -> General -> System -> USB Mode: Mass Storage user: core @@ -12845,7 +12845,7 @@ - id: LANG_IBASSO_USB_MODE_CHARGE + id: LANG_USB_MODE_CHARGE desc: in Settings -> General -> System -> USB Mode: Charge Only user: core diff --git a/apps/lang/svenska.lang b/apps/lang/svenska.lang index c0cc384554..bbf0636d37 100644 --- a/apps/lang/svenska.lang +++ b/apps/lang/svenska.lang @@ -12990,7 +12990,7 @@ - id: LANG_IBASSO_USB_MODE_CHARGE + id: LANG_USB_MODE_CHARGE desc: in Settings -> General -> System -> USB Mode: Charge Only user: core @@ -13089,7 +13089,7 @@ - id: LANG_IBASSO_USB_MODE + id: LANG_USB_MODE desc: in Settings -> General -> System -> USB Mode user: core @@ -13199,7 +13199,7 @@ - id: LANG_IBASSO_USB_MODE_ADB + id: LANG_USB_MODE_ADB desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge user: core @@ -13453,7 +13453,7 @@ - id: LANG_IBASSO_USB_MODE_MASS_STORAGE + id: LANG_USB_MODE_MASS_STORAGE desc: in Settings -> General -> System -> USB Mode: Mass Storage user: core diff --git a/apps/lang/turkce.lang b/apps/lang/turkce.lang index 24a816798f..d9de1e1495 100644 --- a/apps/lang/turkce.lang +++ b/apps/lang/turkce.lang @@ -4663,7 +4663,7 @@ - id: LANG_IBASSO_USB_MODE_ADB + id: LANG_USB_MODE_ADB desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge user: core @@ -10884,7 +10884,7 @@ - id: LANG_IBASSO_USB_MODE + id: LANG_USB_MODE desc: in Settings -> General -> System -> USB Mode user: core @@ -11262,7 +11262,7 @@ - id: LANG_IBASSO_USB_MODE_MASS_STORAGE + id: LANG_USB_MODE_MASS_STORAGE desc: in Settings -> General -> System -> USB Mode: Mass Storage user: core @@ -13413,7 +13413,7 @@ - id: LANG_IBASSO_USB_MODE_CHARGE + id: LANG_USB_MODE_CHARGE desc: in Settings -> General -> System -> USB Mode: Charge Only user: core diff --git a/apps/lang/vlaams.lang b/apps/lang/vlaams.lang index c738af1638..2e1989f0b1 100644 --- a/apps/lang/vlaams.lang +++ b/apps/lang/vlaams.lang @@ -13278,7 +13278,7 @@ - id: LANG_IBASSO_USB_MODE_MASS_STORAGE + id: LANG_USB_MODE_MASS_STORAGE desc: in Settings -> General -> System -> USB Mode: Mass Storage user: core @@ -13298,7 +13298,7 @@ - id: LANG_IBASSO_USB_MODE + id: LANG_USB_MODE desc: in Settings -> General -> System -> USB Mode user: core @@ -13408,7 +13408,7 @@ - id: LANG_IBASSO_USB_MODE_CHARGE + id: LANG_USB_MODE_CHARGE desc: in Settings -> General -> System -> USB Mode: Charge Only user: core @@ -13428,7 +13428,7 @@ - id: LANG_IBASSO_USB_MODE_ADB + id: LANG_USB_MODE_ADB desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge user: core diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c index 9275ff10d6..159ad08a44 100644 --- a/apps/menus/settings_menu.c +++ b/apps/menus/settings_menu.c @@ -266,6 +266,9 @@ MAKE_MENU(battery_menu, ID2P(LANG_BATTERY_MENU), 0, Icon_NOICON, &usb_charging, #endif ); +#ifdef HAVE_USB_POWER +MENUITEM_SETTING(usb_mode, &global_settings.usb_mode, NULL); +#endif /* Disk */ #ifdef HAVE_DISK_STORAGE MENUITEM_SETTING(disk_spindown, &global_settings.disk_spindown, NULL); @@ -446,6 +449,8 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM), #if defined(DX50) || defined(DX90) &governor, +#endif +#ifdef HAVE_USB_POWER &usb_mode, #endif ); diff --git a/apps/settings.h b/apps/settings.h index ec66553660..f9deae1ebe 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -822,6 +822,8 @@ struct user_settings #if defined(DX50) || defined(DX90) int governor; +#endif +#ifdef HAVE_USB_POWER int usb_mode; #endif }; diff --git a/apps/settings_list.c b/apps/settings_list.c index 47384bdbed..17720b5145 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -2156,17 +2156,31 @@ const struct settings_list settings[] = { "Interactive", "Powersave", "Performance"), +#endif +#if defined(HAVE_USB_POWER) && !defined(USB_NONE) && !defined(SIMULATOR) CHOICE_SETTING(0, usb_mode, - LANG_IBASSO_USB_MODE, + LANG_USB_MODE, USB_MODE_MASS_STORAGE, "usb mode", - "mass storage,charge,adb", - ibasso_set_usb_mode, + "ask,mass storage,charge" +#if defined(DX50) || defined(DX90) + ",adb" +#endif + , + usb_set_mode, +#if defined(DX50) || defined(DX90) + 4, +#else 3, - ID2P(LANG_IBASSO_USB_MODE_MASS_STORAGE), - ID2P(LANG_IBASSO_USB_MODE_CHARGE), - ID2P(LANG_IBASSO_USB_MODE_ADB)), +#endif + ID2P(LANG_ASK), + ID2P(LANG_USB_MODE_MASS_STORAGE), + ID2P(LANG_USB_MODE_CHARGE) +#if defined(DX50) || defined(DX90) + ,ID2P(LANG_USB_MODE_ADB) +#endif + ), #endif }; diff --git a/firmware/export/usb.h b/firmware/export/usb.h index b7b846d5b3..edc37bd5b6 100644 --- a/firmware/export/usb.h +++ b/firmware/export/usb.h @@ -131,6 +131,15 @@ enum #endif }; +/* Supported usb modes. */ +enum +{ + USB_MODE_ASK = 0, + USB_MODE_MASS_STORAGE, + USB_MODE_CHARGE, + USB_MODE_ADB +}; + #ifdef HAVE_USB_POWER /*allow people to define this in config-target.h if they need it*/ #if !defined(USBPOWER_BTN_IGNORE) @@ -215,6 +224,7 @@ void usb_charging_maxcurrent_change(int maxcurrent); /* returns the maximum allowed USB current, based on USB charging mode and state */ int usb_charging_maxcurrent(void); #endif /* HAVE_USB_CHARGING_ENABLE */ +void usb_set_mode(int mode); #endif /* HAVE_USB_POWER */ #ifdef HAVE_USBSTACK /* USB driver call this function to notify that a transfer has completed */ diff --git a/firmware/target/hosted/ibasso/usb-ibasso.c b/firmware/target/hosted/ibasso/usb-ibasso.c index e1b134e545..9af932f94f 100644 --- a/firmware/target/hosted/ibasso/usb-ibasso.c +++ b/firmware/target/hosted/ibasso/usb-ibasso.c @@ -60,11 +60,9 @@ static void usb_enable_mass_storage(void) DEBUGF("ERROR %s: No command processor available.", __func__); } - /* Default at boot not known. */ static int _last_usb_mode = -1; - void ibasso_set_usb_mode(int mode) { DEBUGF("DEBUG %s: _last_usb_mode: %d, mode: %d.", __func__, _last_usb_mode, mode); diff --git a/firmware/target/hosted/ibasso/usb-ibasso.h b/firmware/target/hosted/ibasso/usb-ibasso.h index f509d43038..6cd31134b6 100644 --- a/firmware/target/hosted/ibasso/usb-ibasso.h +++ b/firmware/target/hosted/ibasso/usb-ibasso.h @@ -25,30 +25,10 @@ #ifndef _USB_DX50_H_ #define _USB_DX50_H_ - -/* Supported usb modes. */ -enum ibasso_usb_mode -{ - /* - USB mass storage mode. On USB connection, Rockbox will terminate and the internel and - external storage gets exported to the connected client. - */ - USB_MODE_MASS_STORAGE = 0, - - /* - Actually the same, since we to not have proper USB detection. - Starts the adb server and enables adb connection over USB. Rockbox will continue to run. - */ - USB_MODE_CHARGE, - USB_MODE_ADB -}; - - /* Set the usb mode. mode: ibasso_usb_mode */ void ibasso_set_usb_mode(int mode); - #endif diff --git a/firmware/usb.c b/firmware/usb.c index e0c0c45865..8443ffed3a 100644 --- a/firmware/usb.c +++ b/firmware/usb.c @@ -42,6 +42,14 @@ #include "logf.h" #include "screendump.h" +#ifndef BOOTLOADER +#include "misc.h" +#include "gui/yesno.h" +#include "settings.h" +#include "lang_enum.h" +#include "gui/skin_engine/skin_engine.h" +#endif + /* Conditions under which we want the entire driver */ #if !defined(BOOTLOADER) || \ (defined(HAVE_USBSTACK) && defined(HAVE_BOOTLOADER_USB_MODE)) || \ @@ -71,7 +79,7 @@ static int usb_mmc_countdown = 0; #ifndef USB_EXTRA_STACK # define USB_EXTRA_STACK 0x0 /*Define in firmware/export/config/[target].h*/ #endif -static long usb_stack[(DEFAULT_STACK_SIZE + DUMP_BMP_LINESIZE + USB_EXTRA_STACK)/sizeof(long)]; +static long usb_stack[(DEFAULT_STACK_SIZE*2 + DUMP_BMP_LINESIZE + USB_EXTRA_STACK)/sizeof(long)]; static const char usb_thread_name[] = "usb"; static unsigned int usb_thread_entry = 0; static bool usb_monitor_enabled = false; @@ -87,7 +95,8 @@ static bool usb_host_present = false; static int usb_num_acks_to_expect = 0; static long usb_last_broadcast_tick = 0; #ifdef HAVE_USB_POWER -static bool usb_charging_only = false; +static int usb_mode = USB_MODE_ASK; +static int new_usbmode = USB_MODE_ASK; #endif static int usb_release_exclusive_storage(void); @@ -130,17 +139,15 @@ static inline bool usb_do_screendump(void) return false; } -/* Power (charging-only) button */ -static inline void usb_detect_charging_only(bool detect) -{ #ifdef HAVE_USB_POWER - if (detect) - detect = button_status() & ~USBPOWER_BTN_IGNORE; - - usb_charging_only = detect; +void usb_set_mode(int mode) +{ + usb_mode = mode; +#if defined(DX50) || defined(DX90) + ibasso_set_usb_mode(mode); #endif - (void)detect; } +#endif #ifdef USB_FIREWIRE_HANDLING static inline bool usb_reboot_button(void) @@ -201,7 +208,7 @@ static inline bool usb_configure_drivers(int for_state) usb_attach(); /* Powered only: attach now. */ break; /* USB_POWERED: */ - + case USB_INSERTED: #ifdef USB_ENABLE_STORAGE usb_core_enable_driver(USB_DRIVER_MASS_STORAGE, true); @@ -372,7 +379,7 @@ static void usb_set_host_present(bool present) } #ifdef HAVE_USB_POWER - if (usb_charging_only) + if (new_usbmode == USB_MODE_CHARGE || new_usbmode == USB_MODE_ADB) { /* Only charging is desired */ usb_configure_drivers(USB_POWERED); @@ -464,9 +471,49 @@ static void NORETURN_ATTR usb_thread(void) } usb_state = USB_POWERED; + usb_stack_enable(true); - usb_detect_charging_only(true); + /* Power (charging-only) button */ +#ifdef HAVE_USB_POWER + switch (usb_mode) { + case USB_MODE_CHARGE: + case USB_MODE_ADB: + if (button_status() & ~USBPOWER_BTN_IGNORE) + new_usbmode = USB_MODE_MASS_STORAGE; + break; +#ifndef BOOTLOADER + case USB_MODE_ASK: + new_usbmode = USB_MODE_ASK; + break; +#endif + default: + case USB_MODE_MASS_STORAGE: + if (button_status() & ~USBPOWER_BTN_IGNORE) + new_usbmode = USB_MODE_CHARGE; + break; + } + +#ifndef BOOTLOADER + if (new_usbmode == USB_MODE_ASK) + { + push_current_activity(ACTIVITY_USBSCREEN); + if (yesno_pop(ID2P(LANG_ENTER_USB_STORAGE_MODE_QUERY))) + new_usbmode = USB_MODE_MASS_STORAGE; + else + new_usbmode = USB_MODE_CHARGE; + pop_current_activity(); + /* Force full redraw */ +// queue_post(&button_queue, BUTTON_REDRAW, 0); +// Alternative approach, as above is supposedly inadequate by design. + FOR_NB_SCREENS(i) + { + struct screen *screen = &screens[i]; + screen->set_viewport(NULL); + } + } +#endif +#endif #ifndef USB_DETECT_BY_REQUEST usb_set_host_present(true); @@ -493,8 +540,10 @@ static void NORETURN_ATTR usb_thread(void) usb_slave_mode(false); usb_state = USB_EXTRACTED; +#ifdef HAVE_USB_POWER + new_usbmode = usb_mode; +#endif - usb_detect_charging_only(false); usb_set_host_present(false); break; /* USB_EXTRACTED: */ @@ -597,7 +646,7 @@ static void usb_tick(void) #ifdef USB_FIREWIRE_HANDLING static int firewire_countdown = -1; static int last_firewire_status = false; -#endif +#endif if(usb_monitor_enabled) { @@ -814,4 +863,3 @@ void usb_wait_for_disconnect(struct event_queue *q) (void)q; } #endif /* USB_NONE */ - diff --git a/manual/configure_rockbox/system_options.tex b/manual/configure_rockbox/system_options.tex index 4faeafb895..f9e09a91b1 100755 --- a/manual/configure_rockbox/system_options.tex +++ b/manual/configure_rockbox/system_options.tex @@ -851,6 +851,12 @@ therefore result in better runtime. }} \end{description} } +\opt{usb_power}{ + \subsection{USB Mode} + This controls what happens with the \dap{}'s USB port is connected. + \setting{Charge Only} and \setting{Mass Storage} will automatically enter + that mode, and \setting{Ask} will prompt the user each time. +} \opt{multidrive_usb}{ \subsection{USB Hide Internal Drive} If this option is turned \setting{On}, the internal storage drive will not diff --git a/manual/rockbox_interface/main.tex b/manual/rockbox_interface/main.tex index ec76ce4ed5..33dae2f62f 100644 --- a/manual/rockbox_interface/main.tex +++ b/manual/rockbox_interface/main.tex @@ -827,10 +827,13 @@ properly.} \opt{usb_power}{ \section{USB Charging} - 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. + Whenever your \dap{} is connected to USB, it will automatically charge. + However, depending on the \config{usb\_mode} setting, the \dap{} may also + enter mass storage mode or prompt the user for what action to take. + When the \dap{} is configured to enter mass storage mode or automatically + charge, you may trigger the opposite behaivor by holding down any button + while plugging it in. Your \dap{} must already be in Rockbox for this to + function. \nopt{fuzeplus}{ \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