diff options
author | Andrew Duggan <aduggan@synaptics.com> | 2015-05-06 18:18:06 -0700 |
---|---|---|
committer | Andrew Duggan <aduggan@synaptics.com> | 2015-05-06 18:21:48 -0700 |
commit | 2c24adb818ca0dfc83e93e2f5c80442495a15b19 (patch) | |
tree | 44295841e7dc226b1cc4f7edc098c8ec93988202 | |
parent | 161c83c40b122099327e57f96b4cf52cadd13661 (diff) | |
download | platform_external_rmi4utils-2c24adb818ca0dfc83e93e2f5c80442495a15b19.tar.gz platform_external_rmi4utils-2c24adb818ca0dfc83e93e2f5c80442495a15b19.tar.bz2 platform_external_rmi4utils-2c24adb818ca0dfc83e93e2f5c80442495a15b19.zip |
Print protocol specific information about a device
-rw-r--r-- | rmidevice/hiddevice.cpp | 8 | ||||
-rw-r--r-- | rmidevice/hiddevice.h | 2 | ||||
-rw-r--r-- | rmidevice/rmidevice.h | 1 | ||||
-rw-r--r-- | rmihidtool/main.cpp | 11 |
4 files changed, 21 insertions, 1 deletions
diff --git a/rmidevice/hiddevice.cpp b/rmidevice/hiddevice.cpp index 54d5465..e4b956c 100644 --- a/rmidevice/hiddevice.cpp +++ b/rmidevice/hiddevice.cpp @@ -487,6 +487,14 @@ void HIDDevice::PrintReport(const unsigned char *report) fprintf(stdout, "\n\n"); } +// Print protocol specific device information +void HIDDevice::PrintDeviceInfo() +{ + fprintf(stdout, "HID device info:\nBus: %s Vendor: 0x%04x Product: 0x%04x\n", + m_info.bustype == BUS_I2C ? "I2C" : "USB", m_info.vendor, m_info.product); + fprintf(stdout, "Report sizes: input: %ld output: %ld\n", m_inputReportSize, m_outputReportSize); +} + bool WriteDeviceNameToFile(const char * file, const char * str) { int fd; diff --git a/rmidevice/hiddevice.h b/rmidevice/hiddevice.h index ac7439d..bdf2b0c 100644 --- a/rmidevice/hiddevice.h +++ b/rmidevice/hiddevice.h @@ -42,6 +42,8 @@ public: virtual void RebindDriver(); ~HIDDevice() { Close(); } + virtual void PrintDeviceInfo(); + private: int m_fd; diff --git a/rmidevice/rmidevice.h b/rmidevice/rmidevice.h index d213168..238d390 100644 --- a/rmidevice/rmidevice.h +++ b/rmidevice/rmidevice.h @@ -56,6 +56,7 @@ public: int ScanPDT(int endFunc = 0, int endPage = -1); void PrintProperties(); + virtual void PrintDeviceInfo() = 0; int Reset(); bool InBootloader(); diff --git a/rmihidtool/main.cpp b/rmihidtool/main.cpp index 3d614f3..cf25a4b 100644 --- a/rmihidtool/main.cpp +++ b/rmihidtool/main.cpp @@ -34,7 +34,7 @@ #include "hiddevice.h" -#define RMI4UPDATE_GETOPTS "hp:ir:w:foamb" +#define RMI4UPDATE_GETOPTS "hp:ir:w:foambd" enum rmihidtool_cmd { RMIHIDTOOL_CMD_INTERACTIVE, @@ -45,6 +45,7 @@ RMIHIDTOOL_CMD_ATTN, RMIHIDTOOL_CMD_PRINT_FUNCTIONS, RMIHIDTOOL_CMD_REBIND_DRIVER, + RMIHIDTOOL_CMD_PRINT_DEVICE_INFO, }; static int report_attn = 0; @@ -63,6 +64,7 @@ void print_help(const char *prog_name) fprintf(stdout, "\t-a, --attention\t\t\t\tPrint attention reports until control + c\n"); fprintf(stdout, "\t-m, --print-functions\t\t\tPrint RMI4 functions for the device.\n"); fprintf(stdout, "\t-b, --rebind-driver\t\t\tRebind the driver to force an update of device properties.\n"); + fprintf(stdout, "\t-d, --device-info\t\t\tPrint protocol specific information about the device.\n"); } void print_cmd_usage() @@ -210,6 +212,7 @@ int main(int argc, char ** argv) {"attention", 0, NULL, 'a'}, {"print-functions", 0, NULL, 'm'}, {"rebind-driver", 0, NULL, 'b'}, + {"device-info", 0, NULL, 'd'}, {0, 0, 0, 0}, }; enum rmihidtool_cmd cmd = RMIHIDTOOL_CMD_INTERACTIVE; @@ -261,6 +264,9 @@ int main(int argc, char ** argv) case 'b': cmd = RMIHIDTOOL_CMD_REBIND_DRIVER; break; + case 'd': + cmd = RMIHIDTOOL_CMD_PRINT_DEVICE_INFO; + break; default: print_help(argv[0]); return 0; @@ -344,6 +350,9 @@ int main(int argc, char ** argv) case RMIHIDTOOL_CMD_REBIND_DRIVER: device->RebindDriver(); break; + case RMIHIDTOOL_CMD_PRINT_DEVICE_INFO: + device->PrintDeviceInfo(); + break; case RMIHIDTOOL_CMD_INTERACTIVE: default: interactive(device, report); |