diff options
authorHeinrich Schuchardt <>2019-03-02 09:50:06 +0100
committerAdam Malinowski <>2019-05-20 11:46:11 +0200
commit9915f54dbd003ed687394bb07e3e2a9ab426dd9d (patch)
parent7bc5f45a6718401865e0be0dc71cac9c72996375 (diff)
setSerial: do not use default device type
When setting the serial number with the wrong device type the SD-Wire device becomes unusable until the serial number is set again specifying the correct device type. So using 'sd-mux' as default device type is unwise. Let's require that a device type is specified when executing the set serial command. Signed-off-by: Heinrich Schuchardt <>
2 files changed, 6 insertions, 3 deletions
diff --git a/doc/man/sd-mux-ctrl.1 b/doc/man/sd-mux-ctrl.1
index 60343c5..99ead28 100644
--- a/doc/man/sd-mux-ctrl.1
+++ b/doc/man/sd-mux-ctrl.1
@@ -85,7 +85,6 @@ Set PRODUCT ID of devices which are to be used by sd-mux-ctrl. Default value is
Set device type of sd-mux. It can be either "sd-mux" or "sd-wire". This setting is used to distinguish one type
of SD-MUX from another. "sd-mux" is a type of standard, full-sized SD-MUX board, while "sd-wire" is a type of
miniaturized version of SD-MUX with functionality reduced to SD card multiplexing only.
-The default value of this setting is "sd-mux".
diff --git a/src/main.cpp b/src/main.cpp
index b873cdf..4c6e917 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -278,14 +278,18 @@ int doInit(CCOptionValue options[]) {
int setSerial(char *serialNumber, CCOptionValue options[]) {
struct ftdi_context *ftdi;
int f, ret = EXIT_FAILURE;
+ char *type = options[CCO_DeviceType].args;
+ if (!type) {
+ fprintf(stderr, "Device type not specified\n");
+ return EXIT_FAILURE;
+ }
ftdi = openDevice(options, NULL);
if (ftdi == NULL) {
- char *type = options[CCO_DeviceType].args != NULL ? options[CCO_DeviceType].args : (char *)"sd-mux";
f = ftdi_eeprom_initdefaults(ftdi, (char *)"SRPOL", type, serialNumber);
if (f < 0) {
fprintf(stderr, "Unable to set eeprom strings: %d (%s)\n", f, ftdi_get_error_string(ftdi));