Support EV_MSC event types for ChromeOS
A vendor reported the remote chromeos support crashing when EV_MSC
events were emitted by their touch device. This seems to be due to
evtest reporting those events as hexidecimal values instead of base-10.
According to evtest's source there are only 2 events that it does this
for, so this CL adds in a check for those events in an attempt to parse
them correctly.
BUG=chromium:627506
TEST=manually tested, then verified by the vendor
Change-Id: I268abe40e744c9dace0ded9082abbf1a52913f4c
Signed-off-by: Charlie Mooney <charliemooney@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/359945
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
diff --git a/remote/remote_in_system.py b/remote/remote_in_system.py
index 1113f59..276e0c5 100644
--- a/remote/remote_in_system.py
+++ b/remote/remote_in_system.py
@@ -498,7 +498,7 @@
if 'SYN_REPORT' in contents:
return mt.MtEvent(timestamp, linux_input.EV_SYN, linux_input.SYN_REPORT)
- pattern = '^.*type (\d+) .*, code (\d+) .*, value (-?\d+).*$'
+ pattern = '^.*type (\d+) .*, code (\d+) .*, value (-?[0-9a-fA-F]+).*$'
matches = re.match(pattern, contents)
if matches is None:
print 'ERROR: Unable to parse event!'
@@ -508,7 +508,14 @@
event_type = int(matches.group(1))
event_code = int(matches.group(2))
- value = int(matches.group(3))
+
+ # evtest reports all values in decimal except 2 events, which are in hex
+ # Depending on the event type and code, parse using a different base
+ value_base = 10
+ if (event_type == linux_input.EV_MSC and
+ event_code in [linux_input.MSC_RAW, linux_input.MSC_SCAN]):
+ value_base = 16
+ value = int(matches.group(3), value_base)
return mt.MtEvent(timestamp, event_type, event_code, value)