summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam Malinowski <a.malinowsk2@partner.samsung.com>2017-02-15 20:11:56 +0100
committerPawel Wieczorek <p.wieczorek2@samsung.com>2017-07-18 12:42:42 +0200
commit38dc3ed6fbfe9571a9feff9b52060edcdccf8442 (patch)
tree1982d31f7ca293d087252c919a7c77c902ee9cae /src
parenta4b43a87bbe405064d4218dfb923ea260f5622ad (diff)
downloadsd-mux-38dc3ed6fbfe9571a9feff9b52060edcdccf8442.tar.gz
sd-mux-38dc3ed6fbfe9571a9feff9b52060edcdccf8442.tar.bz2
sd-mux-38dc3ed6fbfe9571a9feff9b52060edcdccf8442.zip
Add device type setting in --set-serial function
This setting is needed to distinguish one type of FTDI chip from another. Change-Id: I21cbc9bedd15c160fb6942f3593694181d8e91b9
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 4ddc377..f87cf67 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -68,6 +68,7 @@ enum CCOption {
CCO_Vendor,
CCO_Product,
CCO_DyPer,
+ CCO_DeviceType,
CCO_MAX
};
@@ -207,7 +208,9 @@ int setSerial(char *serialNumber, CCOptionValue options[]) {
return EXIT_FAILURE;
}
- f = ftdi_eeprom_initdefaults(ftdi, (char*)"SRPOL", (char *)"sd-mux", serialNumber);
+ 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));
goto finish_him;
@@ -486,6 +489,8 @@ int parseArguments(int argc, const char **argv, CCCommand *cmd, int *arg, char *
{ "device-id", 'v', POPT_ARG_INT, &options[CCO_DeviceId].argn, 'v', "use device with given id", NULL },
{ "device-serial", 'e', POPT_ARG_STRING, &options[CCO_DeviceSerial].args, 'e',
"use device with given serial number", NULL },
+ { "device-type", 'k', POPT_ARG_STRING, &options[CCO_DeviceType].args, 'k',
+ "make the device of this type", NULL },
{ "vendor", 'x', POPT_ARG_INT, &options[CCO_Vendor].argn, 'x', "use device with given vendor id", NULL },
{ "product", 'a', POPT_ARG_INT, &options[CCO_Product].argn, 'a', "use device with given product id", NULL },
{ "invert", 'n', POPT_ARG_NONE, NULL, 'n', "invert bits for --pins command", NULL },