aboutsummaryrefslogtreecommitdiff
path: root/rmi4update/main.cpp
diff options
context:
space:
mode:
authorAndrew Duggan <aduggan@synaptics.com>2016-04-06 12:16:48 -0700
committerAndrew Duggan <aduggan@synaptics.com>2016-04-07 18:08:27 -0700
commita8ea0fc73d7b8f667b505c0f243756c5aeb14037 (patch)
treed01872fac04818edc912ff987a7332a31ce385ee /rmi4update/main.cpp
parent59b6f4be809f317c204ecf632fd83cc6b53237d7 (diff)
downloadrmi4utils-a8ea0fc73d7b8f667b505c0f243756c5aeb14037.tar.gz
rmi4update: add option to print the config id
Diffstat (limited to 'rmi4update/main.cpp')
-rw-r--r--rmi4update/main.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/rmi4update/main.cpp b/rmi4update/main.cpp
index 88e374f..67de35d 100644
--- a/rmi4update/main.cpp
+++ b/rmi4update/main.cpp
@@ -35,7 +35,7 @@
#define VERSION_MINOR 2
#define VERSION_SUBMINOR 4
-#define RMI4UPDATE_GETOPTS "hfd:plv"
+#define RMI4UPDATE_GETOPTS "hfd:pclv"
void printHelp(const char *prog_name)
{
@@ -44,6 +44,7 @@ void printHelp(const char *prog_name)
fprintf(stdout, "\t-f, --force\tForce updating firmware even it the image provided is older\n\t\t\tthen the current firmware on the device.\n");
fprintf(stdout, "\t-d, --device\thidraw device file associated with the device being updated.\n");
fprintf(stdout, "\t-p, --fw-props\tPrint the firmware properties.\n");
+ fprintf(stdout, "\t-c, --config-id\tPrint the config id.\n");
fprintf(stdout, "\t-l, --lockdown\tPerform lockdown.\n");
fprintf(stdout, "\t-v, --version\tPrint version number.\n");
}
@@ -71,7 +72,7 @@ int UpdateDevice(FirmwareImage & image, bool force, bool performLockdown, const
return rc;
}
-int GetFirmwareProps(const char * deviceFile, std::string &props)
+int GetFirmwareProps(const char * deviceFile, std::string &props, bool configid)
{
HIDDevice rmidevice;
int rc = UPDATE_SUCCESS;
@@ -84,12 +85,16 @@ int GetFirmwareProps(const char * deviceFile, std::string &props)
rmidevice.ScanPDT(0x1);
rmidevice.QueryBasicProperties();
- ss << rmidevice.GetFirmwareVersionMajor() << "."
- << rmidevice.GetFirmwareVersionMinor() << "."
- << std::hex << rmidevice.GetFirmwareID();
+ if (configid) {
+ ss << std::hex << rmidevice.GetConfigID();
+ } else {
+ ss << rmidevice.GetFirmwareVersionMajor() << "."
+ << rmidevice.GetFirmwareVersionMinor() << "."
+ << std::hex << rmidevice.GetFirmwareID();
- if (rmidevice.InBootloader())
- ss << " bootloader";
+ if (rmidevice.InBootloader())
+ ss << " bootloader";
+ }
props = ss.str();
@@ -110,6 +115,7 @@ int main(int argc, char **argv)
{"force", 0, NULL, 'f'},
{"device", 1, NULL, 'd'},
{"fw-props", 0, NULL, 'p'},
+ {"config-id", 0, NULL, 'c'},
{"lockdown", 0, NULL, 'l'},
{"version", 0, NULL, 'v'},
{0, 0, 0, 0},
@@ -117,6 +123,7 @@ int main(int argc, char **argv)
struct dirent * devDirEntry;
DIR * devDir;
bool printFirmwareProps = false;
+ bool printConfigid = false;
bool performLockdown = false;
while ((opt = getopt_long(argc, argv, RMI4UPDATE_GETOPTS, long_options, &index)) != -1) {
@@ -133,6 +140,10 @@ int main(int argc, char **argv)
case 'p':
printFirmwareProps = true;
break;
+ case 'c':
+ printFirmwareProps = true;
+ printConfigid = true;
+ break;
case 'l':
performLockdown = true;
break;
@@ -152,7 +163,7 @@ int main(int argc, char **argv)
fprintf(stderr, "Specifiy which device to query\n");
return 1;
}
- rc = GetFirmwareProps(deviceName, props);
+ rc = GetFirmwareProps(deviceName, props, printConfigid);
if (rc) {
fprintf(stderr, "Failed to read properties from device: %s\n", update_err_to_string(rc));
return 1;