Commit e7227b3e authored by Rob Schonberger's avatar Rob Schonberger Committed by Commit Bot

Add a fix for a bug where devices don't report X/Y resolution, and test.

Add a fix to the recent neural utils where devices don't report X or Y
resolution appropriately, by setting to the correct number (1).

Add a unittest with a genuine touchscreen DeviceCapabilities to show
this off.

Bug: 1009290
Change-Id: I18af8c02e4a68d024be8f73581cda4c2329ca177
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1839271Reviewed-by: default avatarMichael Spang <spang@chromium.org>
Commit-Queue: Rob Schonberger <robsc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#702901}
parent 5c4d99d5
......@@ -851,6 +851,77 @@ const DeviceCapabilities kSideVolumeButton = {
/* ff */ "0",
};
const DeviceAbsoluteAxis kKohakuTouchscreenAxes[] = {
{ABS_X, {0, 0, 1079, 0, 0, 0}},
{ABS_Y, {0, 0, 1919, 0, 0, 0}},
{ABS_PRESSURE, {0, 0, 255, 0, 0, 0}},
{ABS_MT_SLOT, {0, 0, 15, 0, 0, 0}},
{ABS_MT_TOUCH_MAJOR, {0, 0, 255, 0, 0, 0}},
{ABS_MT_POSITION_X, {0, 0, 1079, 0, 0, 0}},
{ABS_MT_POSITION_Y, {0, 0, 1919, 0, 0, 0}},
{ABS_MT_TOOL_TYPE, {0, 0, 15, 0, 0, 0}},
{ABS_MT_TRACKING_ID, {0, 0, 65535, 0, 0, 0}},
{ABS_MT_PRESSURE, {0, 0, 255, 0, 0, 0}},
{ABS_MT_DISTANCE, {0, 0, 1, 0, 0, 0}},
};
// Captured from Kohaku EVT
const DeviceCapabilities kKohakuTouchscreen = {
/* path */
"/sys/devices/pci0000:00/0000:00:15.1/i2c_designware.1/i2c-8/"
"i2c-PRP0001:00/input/input3/event3",
/* name */ "Atmel maXTouch Touchscreen",
/* phys */ "i2c-8-004b/input0",
/* uniq */ "",
/* bustype */ "0018",
/* vendor */ "0000",
/* product */ "0000",
/* version */ "0000",
/* prop */ "2",
/* ev */ "b",
/* key */ "400 0 0 0 0 0",
/* rel */ "0",
/* abs */ "ee1800001000003",
/* msc */ "0",
/* sw */ "0",
/* led */ "0",
/* ff */ "0",
kKohakuTouchscreenAxes,
base::size(kKohakuTouchscreenAxes),
};
const DeviceAbsoluteAxis kKohakuStylusAxes[] = {
{ABS_X, {0, 0, 29376, 0, 0, 100}},
{ABS_Y, {0, 0, 16524, 0, 0, 100}},
{ABS_PRESSURE, {0, 0, 4095, 0, 0, 0}},
{ABS_TILT_X, {0, -9000, 9000, 0, 0, 5730}},
{ABS_TILT_Y, {0, -9000, 9000, 0, 0, 5730}},
};
// Captured from Kohaku EVT
const DeviceCapabilities kKohakuStylus = {
/* path */
"/sys/devices/pci0000:00/0000:00:15.2/i2c_designware.2/i2c-9/"
"i2c-WCOM50C1:00/0018:2D1F:009D.0002/input/input6/event5",
/* name */ "WCOM50C1:00 2D1F:009D",
/* phys */ "i2c-WCOM50C1:00",
/* uniq */ "",
/* bustype */ "0018",
/* vendor */ "2d1f",
/* product */ "009d",
/* version */ "0100",
/* prop */ "0",
/* ev */ "1b",
/* key */ "1c03 0 0 0 0 0",
/* rel */ "0",
/* abs */ "d000003",
/* msc */ "10",
/* sw */ "0",
/* led */ "0",
/* ff */ "0",
kKohakuStylusAxes,
base::size(kKohakuStylusAxes),
};
// NB: Please use the capture_device_capabilities.py script to add more
// test data here. This will help ensure the data matches what the kernel
// reports for a real device and is entered correctly.
......
......@@ -84,7 +84,8 @@ extern const DeviceCapabilities kIlitekTP;
extern const DeviceCapabilities kSideVolumeButton;
extern const DeviceCapabilities kNocturneTouchScreen;
extern const DeviceCapabilities kNocturneStylus;
extern const DeviceCapabilities kKohakuTouchscreen;
extern const DeviceCapabilities kKohakuStylus;
} // namspace ui
#endif // UI_EVENTS_OZONE_EVDEV_EVENT_DEVICE_TEST_UTIL_H_
......@@ -10,6 +10,13 @@ DistilledDevInfo::DistilledDevInfo(const EventDeviceInfo& devinfo) {
x_res = devinfo.GetAbsResolution(ABS_MT_POSITION_X);
max_y = devinfo.GetAbsMaximum(ABS_MT_POSITION_Y);
y_res = devinfo.GetAbsResolution(ABS_MT_POSITION_Y);
if (x_res == 0) {
x_res = 1;
}
if (y_res == 0) {
y_res = 1;
}
major_radius_res = devinfo.GetAbsResolution(ABS_MT_TOUCH_MAJOR);
if (major_radius_res == 0) {
// Device does not report major res: set to 1.
......
......@@ -50,6 +50,17 @@ TEST_F(NeuralStylusPalmDetectionFilterUtilTest, DistilledNocturneTest) {
nocturne_touchscreen_.GetAbsResolution(ABS_MT_TOUCH_MINOR));
}
TEST_F(NeuralStylusPalmDetectionFilterUtilTest, DistillerKohakuTest) {
EventDeviceInfo kohaku_touchscreen;
ASSERT_TRUE(
CapabilitiesToDeviceInfo(kKohakuTouchscreen, &kohaku_touchscreen));
const DistilledDevInfo kohaku_distilled =
DistilledDevInfo::Create(kohaku_touchscreen);
EXPECT_FALSE(kohaku_distilled.minor_radius_supported);
EXPECT_EQ(1, kohaku_distilled.x_res);
EXPECT_EQ(1, kohaku_distilled.y_res);
}
TEST_F(NeuralStylusPalmDetectionFilterUtilTest, DistilledLinkTest) {
EventDeviceInfo link_touchscreen;
ASSERT_TRUE(CapabilitiesToDeviceInfo(kLinkTouchscreen, &link_touchscreen));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment