From d0cda199059ac9fba386a29827c91a5fed7c9cfc Mon Sep 17 00:00:00 2001 From: Clément Decoodt Date: Wed, 1 Mar 2023 10:09:51 +0100 Subject: Set default value for ENV_DEV_MODE Fixes regression introduced in 84801d8 that removed the default value. --- src/usb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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. -- cgit v1.1-32-gdbae