summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/usb.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/usb.c b/src/usb.c
index 3c97b65..90934f6 100644
--- a/src/usb.c
+++ b/src/usb.c
@@ -690,7 +690,8 @@ static void get_mode_cb(struct libusb_transfer* transfer)
unsigned char *data = libusb_control_transfer_get_data(transfer);
- int desired_mode = atoi(getenv(ENV_DEVICE_MODE));
+ char* desired_mode_char = getenv(ENV_DEVICE_MODE);
+ int desired_mode = desired_mode_char ? atoi(desired_mode_char) : 1;
int guessed_mode = guess_mode(context->dev, dev);
// Response is 3:3:3:0 for initial mode, 5:3:3:0 otherwise.