summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <lekensteyn@gmail.com>2013-08-30 22:48:19 +0200
committerPeter Wu <lekensteyn@gmail.com>2013-08-30 22:48:19 +0200
commitffaa47be5786ac269ba3754b84c9998f8e3f2658 (patch)
tree85f05e7b142e3494cec9138979f030556ef8d568
parent2e2b21d3cc6c33aaac077a2bfd1a09df0ea33c13 (diff)
downloadltunify-ffaa47be5786ac269ba3754b84c9998f8e3f2658.tar.gz
hidraw: do not interpret report ID for unknown report type
-rwxr-xr-xhidraw.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/hidraw.c b/hidraw.c
index 6c4187d..ec6f0eb 100755
--- a/hidraw.c
+++ b/hidraw.c
@@ -156,12 +156,15 @@ static const char * registers[0x100] = {
bool report_type_is_hidpp(u8 report_id) {
return report_id == SHORT_MSG || report_id == LONG_MSG;
}
+bool report_type_is_dj(u8 report_id) {
+ return report_id == DJ_SHORT || report_id == DJ_LONG;
+}
const char * report_type_str(u8 report_id, u8 type) {
- const char *str;
+ const char *str = NULL;
if (report_type_is_hidpp(report_id))
str = report_types[type];
- else
+ else if (report_type_is_dj(report_id))
str = dj_report_types[type];
return str ? str : "";
}