summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Clément Decoodt2023-03-01 10:09:51 +0100
committerGravatar Clément Decoodt2023-03-01 10:09:51 +0100
commitd0cda199059ac9fba386a29827c91a5fed7c9cfc (patch)
tree3af5167c6d320d421d81271b8af641b35ed67808
parentdca3373850f5db6ecef77c99cd7c391037bc114e (diff)
downloadusbmuxd-d0cda199059ac9fba386a29827c91a5fed7c9cfc.tar.gz
usbmuxd-d0cda199059ac9fba386a29827c91a5fed7c9cfc.tar.bz2
Set default value for ENV_DEV_MODE
Fixes regression introduced in 84801d8 that removed the default value.
-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.