summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/settings.c4
-rw-r--r--apps/settings_list.c2
-rw-r--r--firmware/export/usb.h7
-rw-r--r--firmware/usb.c7
4 files changed, 16 insertions, 4 deletions
diff --git a/apps/settings.c b/apps/settings.c
index b72808b510..59cb480c95 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -1025,6 +1025,10 @@ void settings_apply(bool read_disk)
1025 usb_charging_enable(global_settings.usb_charging); 1025 usb_charging_enable(global_settings.usb_charging);
1026#endif 1026#endif
1027 1027
1028#ifdef HAVE_USB_POWER
1029 usb_set_mode(global_settings.usb_mode);
1030#endif
1031
1028#ifdef HAVE_TOUCHSCREEN 1032#ifdef HAVE_TOUCHSCREEN
1029 touchscreen_set_mode(global_settings.touch_mode); 1033 touchscreen_set_mode(global_settings.touch_mode);
1030 memcpy(&calibration_parameters, &global_settings.ts_calibration_data, sizeof(struct touchscreen_parameter)); 1034 memcpy(&calibration_parameters, &global_settings.ts_calibration_data, sizeof(struct touchscreen_parameter));
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 17720b5145..71085906ce 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -2161,7 +2161,7 @@ const struct settings_list settings[] = {
2161 CHOICE_SETTING(0, 2161 CHOICE_SETTING(0,
2162 usb_mode, 2162 usb_mode,
2163 LANG_USB_MODE, 2163 LANG_USB_MODE,
2164 USB_MODE_MASS_STORAGE, 2164 USBMODE_DEFAULT,
2165 "usb mode", 2165 "usb mode",
2166 "ask,mass storage,charge" 2166 "ask,mass storage,charge"
2167#if defined(DX50) || defined(DX90) 2167#if defined(DX50) || defined(DX90)
diff --git a/firmware/export/usb.h b/firmware/export/usb.h
index edc37bd5b6..2bcd95ef81 100644
--- a/firmware/export/usb.h
+++ b/firmware/export/usb.h
@@ -145,6 +145,13 @@ enum
145#if !defined(USBPOWER_BTN_IGNORE) 145#if !defined(USBPOWER_BTN_IGNORE)
146#define USBPOWER_BTN_IGNORE 0 146#define USBPOWER_BTN_IGNORE 0
147#endif 147#endif
148
149#if defined(BOOTLOADER)
150#define USBMODE_DEFAULT USB_MODE_MASS_STORAGE
151#else
152#define USBMODE_DEFAULT USB_MODE_MASS_STORAGE
153#endif
154
148#endif 155#endif
149 156
150#ifdef HAVE_USBSTACK 157#ifdef HAVE_USBSTACK
diff --git a/firmware/usb.c b/firmware/usb.c
index aca2683d58..8c6eae9b3f 100644
--- a/firmware/usb.c
+++ b/firmware/usb.c
@@ -95,8 +95,8 @@ static bool usb_host_present = false;
95static int usb_num_acks_to_expect = 0; 95static int usb_num_acks_to_expect = 0;
96static long usb_last_broadcast_tick = 0; 96static long usb_last_broadcast_tick = 0;
97#ifdef HAVE_USB_POWER 97#ifdef HAVE_USB_POWER
98static int usb_mode = USB_MODE_ASK; 98static int usb_mode = USBMODE_DEFAULT;
99static int new_usbmode = USB_MODE_ASK; 99static int new_usbmode = USBMODE_DEFAULT;
100#endif 100#endif
101 101
102static int usb_release_exclusive_storage(void); 102static int usb_release_exclusive_storage(void);
@@ -476,6 +476,7 @@ static void NORETURN_ATTR usb_thread(void)
476 476
477 /* Power (charging-only) button */ 477 /* Power (charging-only) button */
478#ifdef HAVE_USB_POWER 478#ifdef HAVE_USB_POWER
479 new_usbmode = usb_mode;
479 switch (usb_mode) { 480 switch (usb_mode) {
480 case USB_MODE_CHARGE: 481 case USB_MODE_CHARGE:
481 case USB_MODE_ADB: 482 case USB_MODE_ADB:
@@ -491,7 +492,7 @@ static void NORETURN_ATTR usb_thread(void)
491 case USB_MODE_MASS_STORAGE: 492 case USB_MODE_MASS_STORAGE:
492 if (button_status() & ~USBPOWER_BTN_IGNORE) 493 if (button_status() & ~USBPOWER_BTN_IGNORE)
493 new_usbmode = USB_MODE_CHARGE; 494 new_usbmode = USB_MODE_CHARGE;
494 break; 495 break;
495 } 496 }
496 497
497#ifndef BOOTLOADER 498#ifndef BOOTLOADER