summaryrefslogtreecommitdiff
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
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
-rw-r--r--doc/man/sd-mux-ctrl.111
-rw-r--r--etc/bash_completion.d/sd-mux-ctrl2
-rw-r--r--src/main.cpp7
3 files changed, 17 insertions, 3 deletions
diff --git a/doc/man/sd-mux-ctrl.1 b/doc/man/sd-mux-ctrl.1
index 0fce0b1..e1a6e0d 100644
--- a/doc/man/sd-mux-ctrl.1
+++ b/doc/man/sd-mux-ctrl.1
@@ -10,7 +10,7 @@ sd-mux-ctrl - control software for sd-mux devices
.PP
.B sd-mux-ctrl [-liuortdspcmvexn?] [-l|--list] [-i|--info] [-u|--status] [-o|--show-serial] [-r|--set-serial=STRING] [-t|--init] [-d|--dut]
.B [-s|--ts] [-p|--pins=INT] [-c|--tick] [-y|--dyper1=STRING] [-z|--dyper2=STRING] [-m|--tick-time=INT] [-v|--device-id=INT]
-.B [-e|--device-serial=STRING] [-x|--vendor=INT] [-a|--product=INT] [-n|--invert] [-?|--help] [--usage]
+.B [-e|--device-serial=STRING] [-x|--vendor=INT] [-a|--product=INT] [-k|--device-type=STRING] [-n|--invert] [-?|--help] [--usage]
.SH DESCRIPTION
@@ -80,6 +80,15 @@ Set PRODUCT ID of devices which are to be used by sd-mux-ctrl. Default value is
.RE
.PP
+\-k, \-\-device-type
+.RS 2
+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".
+.RE
+
+.PP
\-n, \-\-invert
.RS 2
Invert bits given in argument of \fB--pins\fR command. Useful for debugging purposes.
diff --git a/etc/bash_completion.d/sd-mux-ctrl b/etc/bash_completion.d/sd-mux-ctrl
index e554622..15d30dd 100644
--- a/etc/bash_completion.d/sd-mux-ctrl
+++ b/etc/bash_completion.d/sd-mux-ctrl
@@ -22,7 +22,7 @@ _sdmux()
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
- opts="--help --usage --list --device-serial --device-id --show-serial --set-serial --info --status --init --tick --dyper1 --dyper2 --tick-time --dut --ts --vendor --product --pins --invert"
+ opts="--help --usage --list --device-serial --device-id --show-serial --set-serial --info --status --init --tick --dyper1 --dyper2 --tick-time --dut --ts --vendor --product --device-type --pins --invert"
case "${prev}" in
--device-serial)
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 },