usb: Add ability to prompt user about what to do upon usb insertion

v3: Add in config option
 v4: Bugfixes
 v5: Force a redraw upon exiting
 v6: keypress-in-chargeonly mode enables mass storage (and vice versa)
 v7: Fix bootloader builds
 v8: Update manual, and have bootloader respect keypresses
 v9: Change default to mass storage (ie no change in behavior)

 todo:
  * test-build dx50/dx90
  * Switch from yes/no to proper menu?
  * prevent WPS progress bar from drawing over us

Change-Id: I82e0ccb08497b7a5aa756ce77f1332ee963703a7

...

Change-Id: I7946cf240b18a4fa8ace5e25e1eb6e97b8b12d7c
This commit is contained in:
Solomon Peachy 2020-11-02 08:10:15 -05:00
parent fc4fff0b81
commit 60f581e8f5
30 changed files with 224 additions and 156 deletions

View file

@ -13134,7 +13134,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_ADB
id: LANG_USB_MODE_ADB
desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge
user: core
<source>
@ -13205,7 +13205,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_CHARGE
id: LANG_USB_MODE_CHARGE
desc: in Settings -> General -> System -> USB Mode: Charge Only
user: core
<source>
@ -13259,7 +13259,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE
id: LANG_USB_MODE
desc: in Settings -> General -> System -> USB Mode
user: core
<source>
@ -13299,7 +13299,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_MASS_STORAGE
id: LANG_USB_MODE_MASS_STORAGE
desc: in Settings -> General -> System -> USB Mode: Mass Storage
user: core
<source>

View file

@ -13109,7 +13109,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE
id: LANG_USB_MODE
desc: in Settings -> General -> System -> USB Mode
user: core
<source>
@ -13129,7 +13129,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_MASS_STORAGE
id: LANG_USB_MODE_MASS_STORAGE
desc: in Settings -> General -> System -> USB Mode: Mass Storage
user: core
<source>
@ -13149,7 +13149,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_CHARGE
id: LANG_USB_MODE_CHARGE
desc: in Settings -> General -> System -> USB Mode: Charge Only
user: core
<source>
@ -13169,7 +13169,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_ADB
id: LANG_USB_MODE_ADB
desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge
user: core
<source>

View file

@ -11608,7 +11608,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE
id: LANG_USB_MODE
desc: in Settings -> General -> System -> USB Mode
user: core
<source>
@ -11628,7 +11628,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_MASS_STORAGE
id: LANG_USB_MODE_MASS_STORAGE
desc: in Settings -> General -> System -> USB Mode: Mass Storage
user: core
<source>
@ -11648,7 +11648,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_CHARGE
id: LANG_USB_MODE_CHARGE
desc: in Settings -> General -> System -> USB Mode: Charge Only
user: core
<source>
@ -11668,7 +11668,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_ADB
id: LANG_USB_MODE_ADB
desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge
user: core
<source>

View file

@ -13032,7 +13032,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE
id: LANG_USB_MODE
desc: in Settings -> General -> System -> USB Mode
user: core
<source>
@ -13052,7 +13052,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_MASS_STORAGE
id: LANG_USB_MODE_MASS_STORAGE
desc: in Settings -> General -> System -> USB Mode: Mass Storage
user: core
<source>
@ -13072,7 +13072,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_CHARGE
id: LANG_USB_MODE_CHARGE
desc: in Settings -> General -> System -> USB Mode: Charge Only
user: core
<source>
@ -13092,7 +13092,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_ADB
id: LANG_USB_MODE_ADB
desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge
user: core
<source>

View file

@ -12873,7 +12873,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE
id: LANG_USB_MODE
desc: in Settings -> General -> System -> USB Mode
user: core
<source>
@ -12972,7 +12972,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_ADB
id: LANG_USB_MODE_ADB
desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge
user: core
<source>
@ -13702,7 +13702,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_MASS_STORAGE
id: LANG_USB_MODE_MASS_STORAGE
desc: in Settings -> General -> System -> USB Mode: Mass Storage
user: core
<source>
@ -13784,7 +13784,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_CHARGE
id: LANG_USB_MODE_CHARGE
desc: in Settings -> General -> System -> USB Mode: Charge Only
user: core
<source>

View file

@ -12769,71 +12769,59 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE
id: LANG_USB_MODE
desc: in Settings -> General -> System -> USB Mode
user: core
<source>
*: none
ibassodx50,ibassodx90: "USB Mode"
*: "USB Mode"
</source>
<dest>
*: none
ibassodx50,ibassodx90: "USB Mode"
*: "USB Mode"
</dest>
<voice>
*: none
ibassodx50,ibassodx90: "USB Mode"
*: "USB Mode"
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_MASS_STORAGE
id: LANG_USB_MODE_MASS_STORAGE
desc: in Settings -> General -> System -> USB Mode: Mass Storage
user: core
<source>
*: none
ibassodx50,ibassodx90: "Mass Storage"
*: "Mass Storage"
</source>
<dest>
*: none
ibassodx50,ibassodx90: "Mass Storage"
*: "Mass Storage"
</dest>
<voice>
*: none
ibassodx50,ibassodx90: "Mass Storage"
*: "Mass Storage"
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_CHARGE
id: LANG_USB_MODE_CHARGE
desc: in Settings -> General -> System -> USB Mode: Charge Only
user: core
<source>
*: none
ibassodx50,ibassodx90: "Charge Only"
*: "Charge Only"
</source>
<dest>
*: none
ibassodx50,ibassodx90: "Charge Only"
*: "Charge Only"
</dest>
<voice>
*: none
ibassodx50,ibassodx90: "Charge Only"
*: "Charge Only"
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_ADB
id: LANG_USB_MODE_ADB
desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge
user: core
<source>
*: none
ibassodx50,ibassodx90: "Android Debug Bridge"
*: "Android Debug Bridge"
</source>
<dest>
*: none
ibassodx50,ibassodx90: "Android Debug Bridge"
*: "Android Debug Bridge"
</dest>
<voice>
*: none
ibassodx50,ibassodx90: "Android Debug Bridge"
*: "Android Debug Bridge"
</voice>
</phrase>
<phrase>
@ -16344,3 +16332,17 @@
*: "Browse"
</voice>
</phrase>
<phrase>
id: LANG_ENTER_USB_STORAGE_MODE_QUERY
desc: upon plugging in USB
user: core
<source>
*: "Enter USB mass storage mode?"
</source>
<dest>
*: "Enter USB mass storage mode?"
</dest>
<voice>
*: "Enter USB mass storage mode?"
</voice>
</phrase>

View file

@ -12461,7 +12461,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_MASS_STORAGE
id: LANG_USB_MODE_MASS_STORAGE
desc: in Settings -> General -> System -> USB Mode: Mass Storage
user: core
<source>
@ -12662,7 +12662,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_CHARGE
id: LANG_USB_MODE_CHARGE
desc: in Settings -> General -> System -> USB Mode: Charge Only
user: core
<source>
@ -12682,7 +12682,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_ADB
id: LANG_USB_MODE_ADB
desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge
user: core
<source>
@ -12750,7 +12750,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE
id: LANG_USB_MODE
desc: in Settings -> General -> System -> USB Mode
user: core
<source>

View file

@ -11641,7 +11641,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_CHARGE
id: LANG_USB_MODE_CHARGE
desc: in Settings -> General -> System -> USB Mode: Charge Only
user: core
<source>
@ -12225,7 +12225,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE
id: LANG_USB_MODE
desc: in Settings -> General -> System -> USB Mode
user: core
<source>
@ -12798,7 +12798,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_MASS_STORAGE
id: LANG_USB_MODE_MASS_STORAGE
desc: in Settings -> General -> System -> USB Mode: Mass Storage
user: core
<source>
@ -13436,7 +13436,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_ADB
id: LANG_USB_MODE_ADB
desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge
user: core
<source>

View file

@ -12414,7 +12414,7 @@ desc: deprecated
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_MASS_STORAGE
id: LANG_USB_MODE_MASS_STORAGE
desc: in Settings -> General -> System -> USB Mode: Mass Storage
user: core
<source>
@ -12566,7 +12566,7 @@ desc: deprecated
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_CHARGE
id: LANG_USB_MODE_CHARGE
desc: in Settings -> General -> System -> USB Mode: Charge Only
user: core
<source>
@ -12631,7 +12631,7 @@ desc: deprecated
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE
id: LANG_USB_MODE
desc: in Settings -> General -> System -> USB Mode
user: core
<source>
@ -12676,7 +12676,7 @@ desc: deprecated
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_ADB
id: LANG_USB_MODE_ADB
desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge
user: core
<source>

View file

@ -12936,7 +12936,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_CHARGE
id: LANG_USB_MODE_CHARGE
desc: in Settings -> General -> System -> USB Mode: Charge Only
user: core
<source>
@ -12956,7 +12956,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE
id: LANG_USB_MODE
desc: in Settings -> General -> System -> USB Mode
user: core
<source>
@ -13083,7 +13083,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_MASS_STORAGE
id: LANG_USB_MODE_MASS_STORAGE
desc: in Settings -> General -> System -> USB Mode: Mass Storage
user: core
<source>
@ -13247,7 +13247,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_ADB
id: LANG_USB_MODE_ADB
desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge
user: core
<source>

View file

@ -11844,7 +11844,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE
id: LANG_USB_MODE
desc: in Settings -> General -> System -> USB Mode
user: core
<source>
@ -12522,7 +12522,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_CHARGE
id: LANG_USB_MODE_CHARGE
desc: in Settings -> General -> System -> USB Mode: Charge Only
user: core
<source>
@ -13163,7 +13163,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_MASS_STORAGE
id: LANG_USB_MODE_MASS_STORAGE
desc: in Settings -> General -> System -> USB Mode: Mass Storage
user: core
<source>
@ -13197,7 +13197,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_ADB
id: LANG_USB_MODE_ADB
desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge
user: core
<source>

View file

@ -13316,7 +13316,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_MASS_STORAGE
id: LANG_USB_MODE_MASS_STORAGE
desc: in Settings -> General -> System -> USB Mode: Mass Storage
user: core
<source>
@ -13336,7 +13336,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE
id: LANG_USB_MODE
desc: in Settings -> General -> System -> USB Mode
user: core
<source>
@ -13446,7 +13446,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_CHARGE
id: LANG_USB_MODE_CHARGE
desc: in Settings -> General -> System -> USB Mode: Charge Only
user: core
<source>
@ -13466,7 +13466,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_ADB
id: LANG_USB_MODE_ADB
desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge
user: core
<source>

View file

@ -11152,7 +11152,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_CHARGE
id: LANG_USB_MODE_CHARGE
desc: in Settings -> General -> System -> USB Mode: Charge Only
user: core
<source>
@ -11471,7 +11471,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE
id: LANG_USB_MODE
desc: in Settings -> General -> System -> USB Mode
user: core
<source>
@ -11646,7 +11646,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_ADB
id: LANG_USB_MODE_ADB
desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge
user: core
<source>
@ -12333,7 +12333,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_MASS_STORAGE
id: LANG_USB_MODE_MASS_STORAGE
desc: in Settings -> General -> System -> USB Mode: Mass Storage
user: core
<source>

View file

@ -12517,7 +12517,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_CHARGE
id: LANG_USB_MODE_CHARGE
desc: in Settings -> General -> System -> USB Mode: Charge Only
user: core
<source>
@ -12551,7 +12551,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE
id: LANG_USB_MODE
desc: in Settings -> General -> System -> USB Mode
user: core
<source>
@ -12619,7 +12619,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_MASS_STORAGE
id: LANG_USB_MODE_MASS_STORAGE
desc: in Settings -> General -> System -> USB Mode: Mass Storage
user: core
<source>
@ -12636,7 +12636,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_ADB
id: LANG_USB_MODE_ADB
desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge
user: core
<source>

View file

@ -13146,7 +13146,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_MASS_STORAGE
id: LANG_USB_MODE_MASS_STORAGE
desc: in Settings -> General -> System -> USB Mode: Mass Storage
user: core
<source>
@ -13237,7 +13237,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE
id: LANG_USB_MODE
desc: in Settings -> General -> System -> USB Mode
user: core
<source>
@ -13257,7 +13257,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_CHARGE
id: LANG_USB_MODE_CHARGE
desc: in Settings -> General -> System -> USB Mode: Charge Only
user: core
<source>
@ -13328,7 +13328,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_ADB
id: LANG_USB_MODE_ADB
desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge
user: core
<source>

View file

@ -13083,7 +13083,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE
id: LANG_USB_MODE
desc: in Settings -> General -> System -> USB Mode
user: core
<source>
@ -13103,7 +13103,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_CHARGE
id: LANG_USB_MODE_CHARGE
desc: in Settings -> General -> System -> USB Mode: Charge Only
user: core
<source>
@ -13137,7 +13137,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_ADB
id: LANG_USB_MODE_ADB
desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge
user: core
<source>
@ -13236,7 +13236,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_MASS_STORAGE
id: LANG_USB_MODE_MASS_STORAGE
desc: in Settings -> General -> System -> USB Mode: Mass Storage
user: core
<source>

View file

@ -12578,7 +12578,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE
id: LANG_USB_MODE
desc: in Settings -> General -> System -> USB Mode
user: core
<source>
@ -12612,7 +12612,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_ADB
id: LANG_USB_MODE_ADB
desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge
user: core
<source>
@ -12629,7 +12629,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_MASS_STORAGE
id: LANG_USB_MODE_MASS_STORAGE
desc: in Settings -> General -> System -> USB Mode: Mass Storage
user: core
<source>
@ -12663,7 +12663,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_CHARGE
id: LANG_USB_MODE_CHARGE
desc: in Settings -> General -> System -> USB Mode: Charge Only
user: core
<source>

View file

@ -12597,7 +12597,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE
id: LANG_USB_MODE
desc: in Settings -> General -> System -> USB Mode
user: core
<source>
@ -12628,7 +12628,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_ADB
id: LANG_USB_MODE_ADB
desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge
user: core
<source>
@ -12752,7 +12752,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_MASS_STORAGE
id: LANG_USB_MODE_MASS_STORAGE
desc: in Settings -> General -> System -> USB Mode: Mass Storage
user: core
<source>
@ -12845,7 +12845,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_CHARGE
id: LANG_USB_MODE_CHARGE
desc: in Settings -> General -> System -> USB Mode: Charge Only
user: core
<source>

View file

@ -12990,7 +12990,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_CHARGE
id: LANG_USB_MODE_CHARGE
desc: in Settings -> General -> System -> USB Mode: Charge Only
user: core
<source>
@ -13089,7 +13089,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE
id: LANG_USB_MODE
desc: in Settings -> General -> System -> USB Mode
user: core
<source>
@ -13199,7 +13199,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_ADB
id: LANG_USB_MODE_ADB
desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge
user: core
<source>
@ -13453,7 +13453,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_MASS_STORAGE
id: LANG_USB_MODE_MASS_STORAGE
desc: in Settings -> General -> System -> USB Mode: Mass Storage
user: core
<source>

View file

@ -4663,7 +4663,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_ADB
id: LANG_USB_MODE_ADB
desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge
user: core
<source>
@ -10884,7 +10884,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE
id: LANG_USB_MODE
desc: in Settings -> General -> System -> USB Mode
user: core
<source>
@ -11262,7 +11262,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_MASS_STORAGE
id: LANG_USB_MODE_MASS_STORAGE
desc: in Settings -> General -> System -> USB Mode: Mass Storage
user: core
<source>
@ -13413,7 +13413,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_CHARGE
id: LANG_USB_MODE_CHARGE
desc: in Settings -> General -> System -> USB Mode: Charge Only
user: core
<source>

View file

@ -13278,7 +13278,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_MASS_STORAGE
id: LANG_USB_MODE_MASS_STORAGE
desc: in Settings -> General -> System -> USB Mode: Mass Storage
user: core
<source>
@ -13298,7 +13298,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE
id: LANG_USB_MODE
desc: in Settings -> General -> System -> USB Mode
user: core
<source>
@ -13408,7 +13408,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_CHARGE
id: LANG_USB_MODE_CHARGE
desc: in Settings -> General -> System -> USB Mode: Charge Only
user: core
<source>
@ -13428,7 +13428,7 @@
</voice>
</phrase>
<phrase>
id: LANG_IBASSO_USB_MODE_ADB
id: LANG_USB_MODE_ADB
desc: in Settings -> General -> System -> USB Mode: Android Debug Bridge
user: core
<source>

View file

@ -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
);

View file

@ -822,6 +822,8 @@ struct user_settings
#if defined(DX50) || defined(DX90)
int governor;
#endif
#ifdef HAVE_USB_POWER
int usb_mode;
#endif
};

View file

@ -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
};

View file

@ -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 */

View file

@ -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);

View file

@ -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

View file

@ -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 */

View file

@ -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

View file

@ -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