#include "ui/events/ozone/evdev/event_device_test_util.h"
#include <stdint.h>
#include "base/format_macros.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "ui/events/ozone/evdev/event_device_info.h"
#include "ui/events/ozone/evdev/event_device_util.h"
namespace ui {
namespace {
const int kTestDataWordSize = 64;
#define EVDEV_BITS_TO_GROUPS(x) \
(((x) + kTestDataWordSize - 1) / kTestDataWordSize)
std::string SerializeBitfield(unsigned long* bitmap, int max) {
std::string ret;
for (int i = EVDEV_BITS_TO_GROUPS(max) - 1; i >= 0; i--) {
if (bitmap[i] || ret.size()) {
base::StringAppendF(&ret, "%lx", bitmap[i]);
if (i > 0)
ret += " ";
}
}
if (ret.length() == 0)
ret = "0";
return ret;
}
bool ParseBitfield(const std::string& bitfield,
size_t max_bits,
std::vector<unsigned long>* out) {
std::vector<std::string> groups = base::SplitString(
bitfield, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
out->resize(EVDEV_BITS_TO_LONGS(max_bits));
for (size_t i = 0; i < groups.size(); ++i) {
int off = groups.size() - 1 - i;
uint64_t val;
if (!base::HexStringToUInt64(groups[off], &val))
return false;
for (int j = 0; j < kTestDataWordSize; ++j) {
unsigned int code = i * kTestDataWordSize + j;
if (code >= max_bits)
break;
if (val & (1UL << j))
EvdevSetBit(&(*out)[0], code);
}
}
if (bitfield != SerializeBitfield(out->data(), max_bits))
return false;
return true;
}
}
const DeviceAbsoluteAxis kHJCGamepadAbsAxes[] = {
{ABS_X, {0, 0, 255, 0, 15, 0}}, {ABS_Y, {0, 0, 255, 0, 15, 0}},
{ABS_Z, {0, 0, 255, 0, 15, 0}}, {ABS_RZ, {0, 0, 255, 0, 15, 0}},
{ABS_HAT0X, {0, -1, 1, 0, 0, 0}}, {ABS_HAT0Y, {0, -1, 1, 0, 0, 0}},
};
const DeviceCapabilities kHJCGamepad = {
"/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/"
"0003:11C5:5506.0005/input/input11/event8",
"HJC Game ZD - V",
"usb-0000:00:14.0-1/input0",
"",
"0003",
"11c5",
"5506",
"0111",
"0",
"1b",
"fff000000000000 0 0 0 0",
"0",
"30027",
"10",
"0",
"0",
"0",
kHJCGamepadAbsAxes,
std::size(kHJCGamepadAbsAxes),
};
const DeviceAbsoluteAxis kXboxGamepadAbsAxes[] = {
{ABS_X, {0, -32768, 32767, 16, 128, 0}},
{ABS_Y, {0, -32768, 32767, 16, 128, 0}},
{ABS_Z, {0, 0, 255, 0, 0, 0}},
{ABS_RX, {0, -32768, 32767, 16, 128, 0}},
{ABS_RY, {0, -32768, 32767, 16, 128, 0}},
{ABS_RZ, {0, 0, 255, 0, 0, 0}},
{ABS_HAT0X, {0, -1, 1, 0, 0, 0}},
{ABS_HAT0Y, {0, -1, 1, 0, 0, 0}},
};
const DeviceCapabilities kXboxGamepad = {
"/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/input/input9/event8",
"Microsoft X-Box 360 pad",
"usb-0000:00:14.0-1/input0",
"",
"0003",
"045e",
"028e",
"0114",
"0",
"20000b",
"7cdb000000000000 0 0 0 0",
"0",
"3003f",
"0",
"0",
"0",
"107030000 0",
kXboxGamepadAbsAxes,
std::size(kXboxGamepadAbsAxes),
};
const DeviceAbsoluteAxis kiBuffaloGamepadAbsAxes[] = {
{ABS_X, {0, 0, 255, 0, 15, 0}},
{ABS_Y, {0, 0, 255, 0, 15, 0}},
};
const DeviceCapabilities kiBuffaloGamepad = {
"/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1/"
"1-1:1.0/0003:0583:2060.0004/input/input10/event8",
"USB,2-axis 8-button gamepad ",
"usb-0000:00:14.0-1/input0",
"",
"0003",
"0583",
"2060",
"0110",
"0",
"1b",
"ff00000000 0 0 0 0",
"0",
"3",
"10",
"0",
"0",
"0",
kiBuffaloGamepadAbsAxes,
std::size(kiBuffaloGamepadAbsAxes),
};
const DeviceAbsoluteAxis kBaskingTouchScreenAbsAxes[] = {
{ABS_X, {0, 0, 3520, 0, 0, 14}},
{ABS_Y, {0, 0, 1984, 0, 0, 14}},
{ABS_PRESSURE, {0, 0, 255, 0, 0, 0}},
{ABS_MT_SLOT, {0, 0, 9, 0, 0, 0}},
{ABS_MT_TOUCH_MAJOR, {0, 0, 255, 0, 0, 0}},
{ABS_MT_POSITION_X, {0, 0, 3520, 0, 0, 14}},
{ABS_MT_POSITION_Y, {0, 0, 1984, 0, 0, 14}},
{ABS_MT_TRACKING_ID, {0, 0, 65535, 0, 0, 0}},
{ABS_MT_PRESSURE, {0, 0, 255, 0, 0, 0}},
};
const DeviceCapabilities kBaskingTouchScreen = {
"/sys/devices/pci0000:00/0000:00:16.3/i2c_designware.3/i2c-9/"
"i2c-ELAN0001:00/input/input8/event8",
"Elan Touchscreen",
"",
"",
"0018",
"0000",
"0000",
"0000",
"2",
"b",
"400 0 0 0 0 0",
"0",
"661800001000003",
"0",
"0",
"0",
"0",
kBaskingTouchScreenAbsAxes,
std::size(kBaskingTouchScreenAbsAxes),
};
const DeviceAbsoluteAxis kEveTouchScreenAbsAxes[] = {
{ABS_X, {0, 0, 10368, 0, 0, 40}},
{ABS_Y, {0, 0, 6912, 0, 0, 40}},
{ABS_PRESSURE, {0, 0, 255, 0, 0, 0}},
{ABS_MT_SLOT, {0, 0, 9, 0, 0, 0}},
{ABS_MT_TOUCH_MAJOR, {0, 0, 255, 0, 0, 1}},
{ABS_MT_TOUCH_MINOR, {0, 0, 255, 0, 0, 1}},
{ABS_MT_ORIENTATION, {0, 0, 1, 0, 0, 0}},
{ABS_MT_POSITION_X, {0, 0, 10368, 0, 0, 40}},
{ABS_MT_POSITION_Y, {0, 0, 6912, 0, 0, 40}},
{ABS_MT_TOOL_TYPE, {0, 0, 2, 0, 0, 0}},
{ABS_MT_TRACKING_ID, {0, 0, 65535, 0, 0, 0}},
{ABS_MT_PRESSURE, {0, 0, 255, 0, 0, 0}},
};
const DeviceCapabilities kEveTouchScreen = {
"/sys/devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-6/"
"i2c-WCOM50C1:00/0018:2D1F:5143.0001/input/input4/event4",
"WCOM50C1:00 2D1F:5143",
"i2c-WCOM50C1:00",
"",
"0018",
"2d1f",
"5143",
"0100",
"2",
"1b",
"400 0 0 0 0 0",
"0",
"6f3800001000003",
"20",
"0",
"0",
"0",
kEveTouchScreenAbsAxes,
std::size(kEveTouchScreenAbsAxes),
};
const DeviceAbsoluteAxis kNocturneTouchScreenAbsAxes[] = {
{ABS_X, {0, 0, 10404, 0, 0, 40}},
{ABS_Y, {0, 0, 6936, 0, 0, 40}},
{ABS_PRESSURE, {0, 0, 255, 0, 0, 0}},
{ABS_MT_SLOT, {0, 0, 9, 0, 0, 0}},
{ABS_MT_TOUCH_MAJOR, {0, 0, 255, 0, 0, 1}},
{ABS_MT_TOUCH_MINOR, {0, 0, 255, 0, 0, 1}},
{ABS_MT_ORIENTATION, {0, 0, 1, 0, 0, 0}},
{ABS_MT_POSITION_X, {0, 0, 10404, 0, 0, 40}},
{ABS_MT_POSITION_Y, {0, 0, 6936, 0, 0, 40}},
{ABS_MT_TOOL_TYPE, {0, 0, 2, 0, 0, 0}},
{ABS_MT_TRACKING_ID, {0, 0, 65535, 0, 0, 0}},
{ABS_MT_PRESSURE, {0, 0, 255, 0, 0, 0}},
};
const DeviceCapabilities kNocturneTouchScreen = {
"/sys/devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-6/"
"i2c-WCOM50C1:00/0018:2D1F:486C.0001/input/input2/event2",
"WCOM50C1:00 2D1F:486C",
"i2c-WCOM50C1:00",
"",
"0018",
"2d1f",
"486c",
"0100",
"2",
"1b",
"400 0 0 0 0 0",
"0",
"6f3800001000003",
"20",
"0",
"0",
"0",
kNocturneTouchScreenAbsAxes,
std::size(kNocturneTouchScreenAbsAxes),
};
const DeviceCapabilities kLinkKeyboard = {
"/sys/devices/platform/i8042/serio0/input/input6/event6",
"AT Translated Set 2 keyboard",
"isa0060/serio0/input0",
"",
"0011",
"0001",
"0001",
"ab83",
"0",
"120013",
"400402000000 3803078f800d001 feffffdfffefffff fffffffffffffffe",
"0",
"0",
"10",
"0",
"7",
"0",
};
const DeviceAbsoluteAxis kLinkTouchscreenAbsAxes[] = {
{ABS_X, {0, 0, 2559, 0, 0, 20}},
{ABS_Y, {0, 0, 1699, 0, 0, 20}},
{ABS_PRESSURE, {0, 0, 255, 0, 0, 0}},
{ABS_MT_SLOT, {0, 0, 15, 0, 0, 0}},
{ABS_MT_TOUCH_MAJOR, {0, 0, 938, 0, 0, 0}},
{ABS_MT_ORIENTATION, {0, -3, 4, 0, 0, 0}},
{ABS_MT_POSITION_X, {0, 0, 2559, 0, 0, 20}},
{ABS_MT_POSITION_Y, {0, 0, 1699, 0, 0, 20}},
{ABS_MT_TRACKING_ID, {0, 0, 65535, 0, 0, 0}},
{ABS_MT_PRESSURE, {0, 0, 255, 0, 0, 0}},
};
const DeviceCapabilities kLinkTouchscreen = {
"/sys/devices/pci0000:00/0000:00:02.0/i2c-2/2-004a/"
"input/input7/event7",
"Atmel maXTouch Touchscreen",
"i2c-2-004a/input0",
"",
"0018",
"0000",
"0000",
"0000",
"0",
"b",
"400 0 0 0 0 0",
"0",
"671800001000003",
"0",
"0",
"0",
"0",
kLinkTouchscreenAbsAxes,
std::size(kLinkTouchscreenAbsAxes),
};
const DeviceAbsoluteAxis kLinkWithToolTypeTouchscreenAbsAxes[] = {
{ABS_X, {0, 0, 2559, 0, 0, 20}},
{ABS_Y, {0, 0, 1699, 0, 0, 20}},
{ABS_PRESSURE, {0, 0, 255, 0, 0, 0}},
{ABS_MT_SLOT, {0, 0, 15, 0, 0, 0}},
{ABS_MT_TOUCH_MAJOR, {0, 0, 938, 0, 0, 0}},
{ABS_MT_ORIENTATION, {0, -3, 4, 0, 0, 0}},
{ABS_MT_POSITION_X, {0, 0, 2559, 0, 0, 20}},
{ABS_MT_POSITION_Y, {0, 0, 1699, 0, 0, 20}},
{ABS_MT_TOOL_TYPE, {0, 0, 0, 0, 0, 0}},
{ABS_MT_TRACKING_ID, {0, 0, 65535, 0, 0, 0}},
{ABS_MT_PRESSURE, {0, 0, 255, 0, 0, 0}},
};
const DeviceCapabilities kLinkWithToolTypeTouchscreen = {
"/sys/devices/pci0000:00/0000:00:02.0/i2c-2/2-004a/"
"input/input7/event7",
"Atmel maXTouch Touchscreen",
"i2c-2-004a/input0",
"",
"0018",
"0000",
"0000",
"0000",
"0",
"b",
"400 0 0 0 0 0",
"0",
"673800001000003",
"0",
"0",
"0",
"0",
kLinkWithToolTypeTouchscreenAbsAxes,
std::size(kLinkWithToolTypeTouchscreenAbsAxes),
};
const DeviceAbsoluteAxis kLinkTouchpadAbsAxes[] = {
{ABS_X, {0, 0, 2040, 0, 0, 20}},
{ABS_Y, {0, 0, 1360, 0, 0, 20}},
{ABS_PRESSURE, {0, 0, 255, 0, 0, 0}},
{ABS_MT_SLOT, {0, 0, 9, 0, 0, 0}},
{ABS_MT_TOUCH_MAJOR, {0, 0, 1878, 0, 0, 0}},
{ABS_MT_ORIENTATION, {0, -3, 4, 0, 0, 0}},
{ABS_MT_POSITION_X, {0, 0, 2040, 0, 0, 20}},
{ABS_MT_POSITION_Y, {0, 0, 1360, 0, 0, 20}},
{ABS_MT_TRACKING_ID, {0, 0, 65535, 0, 0, 0}},
{ABS_MT_PRESSURE, {0, 0, 255, 0, 0, 0}},
};
const DeviceCapabilities kLinkTouchpad = {
"/sys/devices/pci0000:00/0000:00:02.0/i2c-1/1-004b/"
"input/input8/event8",
"Atmel maXTouch Touchpad",
"i2c-1-004b/input0",
"",
"0018",
"0000",
"0000",
"0000",
"5",
"b",
"e520 10000 0 0 0 0",
"0",
"671800001000003",
"0",
"0",
"0",
"0",
kLinkTouchpadAbsAxes,
std::size(kLinkTouchpadAbsAxes),
};
const DeviceCapabilities kMorphiusPointingStick = {
"/sys/devices/platform/i8042/serio1/input/input12/event11",
"TPPS/2 JYT_Synaptics TrackPoint",
"isa0060/serio1/input0",
"",
"0011",
"0002",
"000a",
"0000",
"21",
"7",
"70000 0 0 0 0",
"3",
"0",
"0",
"0",
"0",
"0",
};
const DeviceCapabilities kMorphiusTabletModeSwitch = {
"/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/"
"GOOG0006:00/input/input5/event4",
"Tablet Mode Switch",
"GOOG0006",
"",
"0019",
"0000",
"0000",
"0001",
"0",
"21",
"0",
"0",
"0",
"0",
"2",
"0",
"0",
nullptr,
0,
"",
"",
};
const DeviceCapabilities kHpUsbKeyboard = {
"/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.3/2-1.3:1.0/"
"input/input17/event10",
"Chicony HP Elite USB Keyboard",
"usb-0000:00:1d.0-1.3/input0",
"",
"0003",
"03f0",
"034a",
"0110",
"0",
"120013",
"1000000000007 ff9f207ac14057ff febeffdfffefffff "
"fffffffffffffffe",
"0",
"0",
"10",
"0",
"7",
"0",
};
const DeviceAbsoluteAxis kHpUsbKeyboard_ExtraAbsAxes[] = {
{ABS_VOLUME, {0, 0, 767, 0, 0, 0}},
};
const DeviceCapabilities kHpUsbKeyboard_Extra = {
"/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.3/2-1.3:1.1/"
"input/input18/event16",
"Chicony HP Elite USB Keyboard",
"usb-0000:00:1d.0-1.3/input1",
"",
"0003",
"03f0",
"034a",
"0110",
"0",
"1f",
"3007f 0 0 483ffff17aff32d bf54444600000000 1 120f938b17c000 "
"677bfad941dfed 9ed68000004400 10000002",
"40",
"100000000",
"10",
"0",
"0",
"0",
kHpUsbKeyboard_ExtraAbsAxes,
std::size(kHpUsbKeyboard_ExtraAbsAxes),
};
const DeviceCapabilities kLogitechUsbMouse = {
"/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2.4/"
"2-1.2.4:1.0/input/input16/event9",
"Logitech USB Optical Mouse",
"usb-0000:00:1d.0-1.2.4/input0",
"",
"0003",
"046d",
"c05a",
"0111",
"0",
"17",
"ff0000 0 0 0 0",
"143",
"0",
"10",
"0",
"0",
"0",
};
const DeviceAbsoluteAxis kMimoTouch2TouchscreenAbsAxes[] = {
{ABS_X, {0, 0, 2047, 0, 0, 0}},
{ABS_Y, {0, 0, 2047, 0, 0, 0}},
};
const DeviceCapabilities kMimoTouch2Touchscreen = {
"/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.3/2-1.3.2/"
"2-1.3.2:1.0/input/input15/event14",
"eGalax Inc. USB TouchController",
"usb-0000:00:1d.0-1.3.2/input0",
"",
"0003",
"0eef",
"0001",
"0100",
"0",
"b",
"400 0 0 0 0 0",
"0",
"3",
"0",
"0",
"0",
"0",
kMimoTouch2TouchscreenAbsAxes,
std::size(kMimoTouch2TouchscreenAbsAxes),
};
const DeviceAbsoluteAxis kWacomIntuosPtS_PenAbsAxes[] = {
{ABS_X, {0, 0, 15200, 4, 0, 100}},
{ABS_Y, {0, 0, 9500, 4, 0, 100}},
{ABS_PRESSURE, {0, 0, 1023, 0, 0, 0}},
{ABS_DISTANCE, {0, 0, 31, 0, 0, 0}},
};
const DeviceCapabilities kWacomIntuosPtS_Pen = {
"/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2.3/"
"2-1.2.3:1.0/input/input9/event9",
"Wacom Intuos PT S Pen",
"",
"",
"0003",
"056a",
"0302",
"0100",
"1",
"b",
"1c03 0 0 0 0 0",
"0",
"3000003",
"0",
"0",
"0",
"0",
kWacomIntuosPtS_PenAbsAxes,
std::size(kWacomIntuosPtS_PenAbsAxes),
};
const DeviceAbsoluteAxis kWacomIntuosPtS_FingerAbsAxes[] = {
{ABS_X, {0, 0, 4096, 4, 0, 26}},
{ABS_Y, {0, 0, 4096, 4, 0, 43}},
{ABS_MT_SLOT, {0, 0, 15, 0, 0, 0}},
{ABS_MT_TOUCH_MAJOR, {0, 0, 4096, 0, 0, 0}},
{ABS_MT_TOUCH_MINOR, {0, 0, 4096, 0, 0, 0}},
{ABS_MT_POSITION_X, {0, 0, 4096, 4, 0, 26}},
{ABS_MT_POSITION_Y, {0, 0, 4096, 4, 0, 43}},
{ABS_MT_TRACKING_ID, {0, 0, 65535, 0, 0, 0}},
};
const DeviceCapabilities kWacomIntuosPtS_Finger = {
"/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2.3/"
"2-1.2.3:1.1/input/input10/event10",
"Wacom Intuos PT S Finger",
"",
"",
"0003",
"056a",
"0302",
"0100",
"1",
"2b",
"e520 630000 0 0 0 0",
"0",
"263800000000003",
"0",
"4000",
"0",
"0",
kWacomIntuosPtS_FingerAbsAxes,
std::size(kWacomIntuosPtS_FingerAbsAxes),
};
const DeviceAbsoluteAxis kLogitechTouchKeyboardK400AbsAxes[] = {
{ABS_VOLUME, {0, 1, 652, 0, 0, 0}},
};
const DeviceCapabilities kLogitechTouchKeyboardK400 = {
"/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2.3/"
"2-1.2.3:1.2/0003:046D:C52B.0006/input/input19/event17",
"Logitech Unifying Device. Wireless PID:4024",
"usb-0000:00:1d.0-1.2.3:1",
"",
"001d",
"046d",
"4024",
"0111",
"0",
"12001f",
"3007f 0 0 483ffff17aff32d bf54444600000000 ffff0001 "
"130f938b17c007 ffff7bfad9415fff febeffdfffefffff "
"fffffffffffffffe",
"1c3",
"100000000",
"10",
"0",
"1f",
"0",
kLogitechTouchKeyboardK400AbsAxes,
std::size(kLogitechTouchKeyboardK400AbsAxes),
};
const DeviceAbsoluteAxis kElo_TouchSystems_2700AbsAxes[] = {
{ABS_X, {0, 0, 4095, 0, 0, 0}},
{ABS_Y, {0, 0, 4095, 0, 0, 0}},
{ABS_MISC, {0, 0, 256, 0, 0, 0}},
};
const DeviceCapabilities kElo_TouchSystems_2700 = {
"/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.3/2-1.3:1.0/"
"input/input9/event9",
"Elo TouchSystems, Inc. Elo TouchSystems 2700 IntelliTouch(r) "
"USB Touchmonitor Interface",
"usb-0000:00:1d.0-1.3/input0",
"20A01347",
"0003",
"04e7",
"0020",
"0100",
"0",
"1b",
"10000 0 0 0 0",
"0",
"10000000003",
"10",
"0",
"0",
"0",
kElo_TouchSystems_2700AbsAxes,
std::size(kElo_TouchSystems_2700AbsAxes),
};
const DeviceAbsoluteAxis kWilsonBeachActiveStylusAbsAxes[] = {
{ABS_X, {0, 0, 9600, 0, 0, 33}},
{ABS_Y, {0, 0, 7200, 0, 0, 44}},
{ABS_PRESSURE, {0, 0, 1024, 0, 0, 0}},
};
const DeviceCapabilities kWilsonBeachActiveStylus = {
"/sys/devices/pci0000:00/INT3433:00/i2c-1/"
"i2c-NTRG0001:00/0018:1B96:0D03.0004/input/"
"input11/event10",
"NTRG0001:00 1B96:0D03 Pen",
"",
"",
"0018",
"1b96",
"0d03",
"0100",
"0",
"1b",
"c03 1 0 0 0 0",
"0",
"1000003",
"10",
"0",
"0",
"0",
kWilsonBeachActiveStylusAbsAxes,
std::size(kWilsonBeachActiveStylusAbsAxes),
};
const DeviceAbsoluteAxis kEveStylusAbsAxes[] = {
{ABS_X, {0, 0, 25920, 0, 0, 100}}, {ABS_Y, {0, 0, 17280, 0, 0, 100}},
{ABS_PRESSURE, {0, 0, 2047, 0, 0, 0}}, {ABS_TILT_X, {0, -90, 90, 0, 0, 57}},
{ABS_TILT_Y, {0, -90, 90, 0, 0, 57}}, {ABS_MISC, {0, 0, 65535, 0, 0, 0}},
};
const DeviceCapabilities kEveStylus = {
"/sys/devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-6/"
"i2c-WCOM50C1:00/0018:2D1F:5143.0001/input/input5/event5",
"WCOM50C1:00 2D1F:5143 Pen",
"i2c-WCOM50C1:00",
"",
"0018",
"2d1f",
"5143",
"0100",
"0",
"1b",
"1c03 1 0 0 0 0",
"0",
"1000d000003",
"11",
"0",
"0",
"0",
kEveStylusAbsAxes,
std::size(kEveStylusAbsAxes),
};
const DeviceAbsoluteAxis kNocturneStylusAbsAxes[] = {
{ABS_X, {0, 0, 26010, 0, 0, 100}}, {ABS_Y, {0, 0, 17340, 0, 0, 100}},
{ABS_PRESSURE, {0, 0, 2047, 0, 0, 0}}, {ABS_TILT_X, {0, -90, 90, 0, 0, 57}},
{ABS_TILT_Y, {0, -90, 90, 0, 0, 57}}, {ABS_MISC, {0, 0, 65535, 0, 0, 0}},
};
const DeviceCapabilities kNocturneStylus = {
"/sys/devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-6/"
"i2c-WCOM50C1:00/0018:2D1F:486C.0001/input/input3/event3",
"WCOM50C1:00 2D1F:486C Pen",
"",
"",
"0018",
"2d1f",
"486c",
"0100",
"0",
"1b",
"1c03 1 0 0 0 0",
"0",
"1000d000003",
"11",
"0",
"0",
"0",
kNocturneStylusAbsAxes,
std::size(kNocturneStylusAbsAxes),
};
const DeviceCapabilities kHammerKeyboard = {
"/sys/devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/0003:18D1:5030.0002/"
"input/input10/event9",
"Google Inc. Hammer",
"usb-0000:00:14.0-7/input0",
"410020000d57345436313920",
"0003",
"18d1",
"5030",
"0100",
"0",
"100013",
"88 0 0 0 0 0 1000000000007 ff000000000007ff febeffdfffefffff "
"fffffffffffffffe",
"0",
"0",
"10",
"0",
"0",
"0",
};
const DeviceAbsoluteAxis kHammerTouchpadAbsAxes[] = {
{ABS_X, {0, 0, 2160, 0, 0, 21}},
{ABS_Y, {0, 0, 1080, 0, 0, 14}},
{ABS_PRESSURE, {0, 0, 255, 0, 0, 0}},
{ABS_MT_SLOT, {0, 0, 9, 0, 0, 0}},
{ABS_MT_TOUCH_MAJOR, {0, 0, 255, 0, 0, 3}},
{ABS_MT_TOUCH_MINOR, {0, 0, 255, 0, 0, 3}},
{ABS_MT_ORIENTATION, {0, 0, 1, 0, 0, 0}},
{ABS_MT_POSITION_X, {0, 0, 2160, 0, 0, 21}},
{ABS_MT_POSITION_Y, {0, 0, 1080, 0, 0, 14}},
{ABS_MT_TRACKING_ID, {0, 0, 65535, 0, 0, 0}},
{ABS_MT_PRESSURE, {0, 0, 255, 0, 0, 0}},
};
const DeviceCapabilities kHammerTouchpad = {
"/sys/devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.2/0003:18D1:5030.0003/"
"input/input11/event10",
"Google Inc. Hammer Touchpad",
"usb-0000:00:14.0-7/input2",
"410020000d57345436313920",
"0003",
"18d1",
"5030",
"0100",
"5",
"1b",
"e520 10000 0 0 0 0",
"0",
"673800001000003",
"20",
"0",
"0",
"0",
kHammerTouchpadAbsAxes,
std::size(kHammerTouchpadAbsAxes),
};
const DeviceAbsoluteAxis kIlitekTP_Mouse_AbsAxes[] = {
{ABS_X, {0, 0, 16384, 0, 0, 76}},
{ABS_Y, {0, 0, 9600, 0, 0, 71}},
};
const DeviceCapabilities kIlitekTP_Mouse = {
"/sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.1/1-2.1.1/1-2.1.1.4/"
"1-2.1.1.4.2/1-2.1.1.4.2:1.1/0003:222A:0001.0015/input/input19/event9",
"ILITEK ILITEK-TP",
"usb-0000:00:14.0-2.1.1.4.2/input1",
"",
"0003",
"222a",
"0001",
"0110",
"0",
"1b",
"1f0000 0 0 0 0",
"0",
"3",
"10",
"0",
"0",
"0",
kIlitekTP_Mouse_AbsAxes,
std::size(kIlitekTP_Mouse_AbsAxes),
};
const DeviceAbsoluteAxis kIlitekTPAbsAxes[] = {
{ABS_X, {0, 0, 16384, 0, 0, 76}},
{ABS_Y, {0, 0, 9600, 0, 0, 71}},
{ABS_MT_SLOT, {0, 0, 9, 0, 0, 0}},
{ABS_MT_POSITION_X, {0, 0, 16384, 0, 0, 76}},
{ABS_MT_POSITION_Y, {0, 0, 9600, 0, 0, 71}},
{ABS_MT_TRACKING_ID, {0, 0, 65535, 0, 0, 0}},
};
const DeviceCapabilities kIlitekTP = {
"/sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.1/1-2.1.1/1-2.1.1.4/"
"1-2.1.1.4.2/1-2.1.1.4.2:1.0/0003:222A:0001.0014/input/input18/event8",
"ILITEK ILITEK-TP",
"usb-0000:00:14.0-2.1.1.4.2/input0",
"",
"0003",
"222a",
"0001",
"0110",
"2",
"1b",
"400 0 0 0 0 0",
"0",
"260800000000003",
"20",
"0",
"0",
"0",
kIlitekTPAbsAxes,
std::size(kIlitekTPAbsAxes),
};
const DeviceCapabilities kSideVolumeButton = {
"/sys/devices/pci0000:00/0000:00:1f.0/PNP0C09:00/GOOG0004:00/GOOG0007:00/"
"input/input5/event4",
"cros_ec_buttons",
"GOOG0004:00/input1",
"",
"0006",
"0000",
"0000",
"0001",
"0",
"100023",
"1c000000000000 0",
"0",
"0",
"0",
"1",
"0",
"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}},
};
const DeviceCapabilities kKohakuTouchscreen = {
"/sys/devices/pci0000:00/0000:00:15.1/i2c_designware.1/i2c-8/"
"i2c-PRP0001:00/input/input3/event3",
"Atmel maXTouch Touchscreen",
"i2c-8-004b/input0",
"",
"0018",
"0000",
"0000",
"0000",
"2",
"b",
"400 0 0 0 0 0",
"0",
"ee1800001000003",
"0",
"0",
"0",
"0",
kKohakuTouchscreenAxes,
std::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}},
};
const DeviceCapabilities kKohakuStylus = {
"/sys/devices/pci0000:00/0000:00:15.2/i2c_designware.2/i2c-9/"
"i2c-WCOM50C1:00/0018:2D1F:009D.0002/input/input6/event5",
"WCOM50C1:00 2D1F:009D",
"i2c-WCOM50C1:00",
"",
"0018",
"2d1f",
"009d",
"0100",
"0",
"1b",
"1c03 0 0 0 0 0",
"0",
"d000003",
"10",
"0",
"0",
"0",
kKohakuStylusAxes,
std::size(kKohakuStylusAxes),
};
const DeviceAbsoluteAxis kXboxEliteAxes[] = {
{ABS_X, {0, 0, 65535, 255, 4095, 0}},
{ABS_Y, {0, 0, 65535, 255, 4095, 0}},
{ABS_Z, {0, 0, 65535, 255, 4095, 0}},
{ABS_RZ, {0, 0, 65535, 255, 4095, 0}},
{ABS_GAS, {0, 0, 1023, 3, 63, 0}},
{ABS_BRAKE, {0, 0, 1023, 3, 63, 0}},
{ABS_HAT0X, {0, -1, 1, 0, 0, 0}},
{ABS_HAT0Y, {0, -1, 1, 0, 0, 0}},
};
const DeviceCapabilities kXboxElite = {
"/sys/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0/bluetooth/hci0/"
"hci0:256:11/0005:045E:0B05.000C/input/input21/event11",
"Xbox Elite Wireless Controller",
"a0:af:bd:9f:2f:76",
"98:7a:14:3b:42:b3",
"0005",
"045e",
"0b05",
"0903",
"0",
"10001b",
"4000000 0 7fff000000000000 1000000000000 100040000000 e080ffdf01cfffff "
"fffffffffffffffe",
"0",
"30627",
"10",
"0",
"0",
"0",
kXboxEliteAxes,
std::size(kXboxEliteAxes),
};
const DeviceCapabilities kDellActivePenButton = {
"/sys/devices/virtual/misc/uhid/0005:413C:81D5.0004/input/input13/event11",
"Dell Active Pen PN579X",
"f8:94:c2:b9:dd:b2",
"90:7f:61:28:8d:09",
"0005",
"413c",
"81d5",
"0f08",
"0",
"100013",
"7f80000000000000 e0b0ffdf01cfffff fffffffffffffffe",
"0",
"0",
"10",
"0",
"0",
"0",
};
const DeviceAbsoluteAxis kDrallionStylusAxes[] = {
{ABS_X, {0, 0, 30931, 0, 0, 100}},
{ABS_Y, {0, 0, 17399, 0, 0, 100}},
{ABS_PRESSURE, {0, 0, 4095, 0, 0, 0}},
{ABS_TILT_X, {0, -90, 90, 0, 0, 57}},
{ABS_TILT_Y, {0, -90, 90, 0, 0, 57}},
{ABS_MISC, {0, 0, 65535, 0, 0, 0}},
};
const DeviceCapabilities kDrallionStylus = {
"/sys/devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-7/"
"i2c-WCOM48E2:00/0018:2D1F:4971.0001/input/input6/event5",
"WCOM48E2:00 2D1F:4971 Pen",
"i2c-WCOM48E2:00",
"",
"0018",
"2d1f",
"4971",
"0100",
"0",
"1b",
"1c03 0 0 0 0 0",
"0",
"1000d000003",
"11",
"0",
"0",
"0",
kDrallionStylusAxes,
std::size(kDrallionStylusAxes),
};
const DeviceCapabilities kDrallionKeyboard = {
"/sys/devices/platform/i8042/serio0/input/input3/event3",
"AT Translated Set 2 keyboard",
"isa0060/serio0/input0",
"",
"0011",
"0001",
"0001",
"ab41",
"0",
"120013",
"200000000000100 0 0 0 10000000000000 0 f02000000 3803078f800d001 "
"ffffffdfffefffff fffffffffffffffe",
"0",
"0",
"10",
"0",
"7",
"0",
nullptr,
0,
"",
"4",
};
const DeviceCapabilities kPuffMicrophoneMuteSwitch = {
"/sys/devices/pci0000:00/0000:00:19.0/PRP0001:00/input/input3/event3",
"mic_mute_switch",
"gpio-keys/input0",
"",
"0019",
"0001",
"0001",
"0100",
"0",
"21",
"0",
"0",
"0",
"0",
"4000",
"0",
"0",
};
const DeviceCapabilities kDrawciaStylusGarage = {
"/sys/devices/pci0000:00/0000:00:15.2/PRP0001:00/input/input4/event4",
"PRP0001:00",
"gpio-keys/input0",
"",
"0019",
"0001",
"0001",
"0100",
"0",
"21",
"0",
"0",
"0",
"0",
"8000",
"0",
"0",
};
const DeviceCapabilities kEveKeyboard = {
"/sys/devices/platform/i8042/serio0/input/input3/event3",
"AT Translated Set 2 keyboard",
"isa0060/serio0/input0",
"",
"0011",
"0001",
"0001",
"ab83",
"0",
"120013",
"88 0 0 0 0 0 402000000 3003078f800d001 feffffdfffefffff fffffffffffffffe",
"0",
"0",
"10",
"0",
"7",
"0",
nullptr,
0,
"",
"2",
};
const DeviceCapabilities kSarienKeyboard = {
"/sys/devices/platform/i8042/serio0/input/input2/event2",
"AT Translated Set 2 keyboard",
"isa0060/serio0/input0",
"",
"0011",
"0001",
"0001",
"ab41",
"0",
"120013",
"100 0 0 0 10000000000000 0 f02000000 3803078f800d001 ffffffdfffefffff "
"fffffffffffffffe",
"0",
"0",
"10",
"0",
"7",
"0",
nullptr,
0,
"",
"3",
};
const DeviceCapabilities kWoomaxKeyboard = {
"/sys/devices/platform/i8042/serio0/input/input3/event3",
"AT Translated Set 2 keyboard",
"isa0060/serio0/input0",
"",
"0011",
"0001",
"0001",
"ab83",
"0",
"120013",
"10000000000000 0 300000000 200040004000 3d1ebfdf524fff80 3fffffffffffffe",
"0",
"0",
"10",
"0",
"7",
"0",
};
const DeviceCapabilities kDrobitKeyboard = {
"/sys/devices/platform/i8042/serio0/input/input2/event2",
"AT Translated Set 2 keyboard",
"isa0060/serio0/input0",
"",
"0011",
"0001",
"0001",
"ab83",
"0",
"120013",
"10000000000000 0 300000000 200040004000 3d1e169a52400000 37ffffffffffffe",
"0",
"0",
"10",
"0",
"7",
"0",
};
const DeviceCapabilities kDrobitNumberpad = {
"/sys/devices/pci0000:00/0000:00:19.1/i2c_designware.5/i2c-20/"
"i2c-ELAN2701:00/0018:04F3:31C6.0001/input/input5/event5",
"ELAN2701:00 04F3:31C6 Keyboard",
"i2c-ELAN2701:00",
"",
"0018",
"04f3",
"31c6",
"0100",
"0",
"120013",
"5000fffa0 80040000006040",
"0",
"0",
"10",
"0",
"1",
"0",
};
const DeviceCapabilities kLogitechKeyboardK120 = {
"/sys/devices/pci0000:00/0000:00:08.1/0000:04:00.3/usb1/1-2/1-2:1.0/"
"0003:046D:C31C.0002/input/input18/event16",
"Logitech USB Keyboard",
"usb-0000:04:00.3-2/input0",
"",
"0003",
"046d",
"c31c",
"0110",
"0",
"120013",
"1000000000007 ff9f207ac14057ff febeffdfffefffff fffffffffffffffe",
"0",
"0",
"10",
"0",
"1f",
"0",
};
const DeviceAbsoluteAxis kMicrosoftBluetoothNumberPadAbsAxes[] = {
{ABS_VOLUME, {0, 0, 1023, 0, 0, 0}},
};
const DeviceCapabilities kMicrosoftBluetoothNumberPad = {
"/sys/devices/virtual/misc/uhid/0005:045E:0836.0007/input/input26/event16",
"Microsoft Number Pad Keyboard",
"c8:b2:9b:af:3a:47",
"ce:aa:3f:f5:d9:12",
"0005",
"045e",
"0836",
"0125",
"0",
"12001f",
"3f000303ff 0 0 483ffff17aff32d bfd4444600000000 1 130ff38b17c007 "
"ffe77bfad9415fff ffbeffdff3cfffff fffffffffffffffe",
"1040",
"100000000",
"10",
"0",
"7",
"0",
kMicrosoftBluetoothNumberPadAbsAxes,
std::size(kMicrosoftBluetoothNumberPadAbsAxes),
};
const ui::DeviceAbsoluteAxis kDellLatitudeE6510TouchpadAbsAxes[] = {
{ABS_X, {0, 0, 2000, 0, 0, 0}},
{ABS_Y, {0, 0, 1400, 0, 0, 0}},
{ABS_PRESSURE, {0, 0, 127, 0, 0, 0}},
{ABS_MT_SLOT, {0, 0, 3, 0, 0, 0}},
{ABS_MT_POSITION_X, {0, 0, 2000, 0, 0, 0}},
{ABS_MT_POSITION_Y, {0, 0, 1400, 0, 0, 0}},
{ABS_MT_TRACKING_ID, {0, 0, 65535, 0, 0, 0}},
};
const ui::DeviceCapabilities kDellLatitudeE6510Touchpad = {
"/sys/devices/platform/i8042/serio1/input/input7/event7",
"AlpsPS/2 ALPS DualPoint TouchPad",
"isa0060/serio1/input0",
"",
"0011",
"0002",
"0008",
"0300",
"9",
"b",
"e420 70000 0 0 0 0",
"0",
"260800001000003",
"0",
"0",
"0",
"0",
kDellLatitudeE6510TouchpadAbsAxes,
std::size(kDellLatitudeE6510TouchpadAbsAxes),
};
const ui::DeviceAbsoluteAxis kHPProBook6560bTouchpadAbsAxes[] = {
{ABS_X, {0, 1472, 5690, 8, 0, 40}},
{ABS_Y, {0, 1408, 4854, 8, 0, 74}},
{ABS_PRESSURE, {0, 0, 255, 0, 0, 0}},
{ABS_TOOL_WIDTH, {0, 0, 15, 0, 0, 0}},
{ABS_MT_SLOT, {0, 0, 1, 0, 0, 0}},
{ABS_MT_POSITION_X, {0, 1472, 5690, 8, 0, 40}},
{ABS_MT_POSITION_Y, {0, 1408, 4854, 8, 0, 74}},
{ABS_MT_TRACKING_ID, {0, 0, 65535, 0, 0, 0}},
};
const ui::DeviceCapabilities kHPProBook6560bTouchpad = {
"/sys/devices/platform/i8042/serio4/input/input12/event5",
"SynPS/2 Synaptics TouchPad",
"isa0060/serio4/input0",
"",
"0011",
"0002",
"0007",
"01b1",
"9",
"b",
"6420 30000 0 0 0 0",
"0",
"260800011000003",
"0",
"0",
"0",
"0",
kHPProBook6560bTouchpadAbsAxes,
std::size(kHPProBook6560bTouchpadAbsAxes),
};
const DeviceCapabilities kJinlonKeyboard = {
"/sys/devices/platform/i8042/serio0/input/input3/event3",
"AT Translated Set 2 keyboard",
"isa0060/serio0/input0",
"",
"0011",
"0001",
"0001",
"ab83",
"0",
"120013",
"200000000000000 0 0 0 10000000000000 0 6300000000 200040004000 "
"3d1e169a52400000 37ffffffffffffe",
"0",
"0",
"10",
"0",
"7",
"0",
nullptr,
0,
"EA E7 91 92 93 94 95 96 97 98 A0 AE B0",
"",
};
const DeviceAbsoluteAxis kRedrixTouchpadAxes[] = {
{ABS_X, {0, 0, 3630, 0, 0, 32}},
{ABS_Y, {0, 0, 2346, 0, 0, 31}},
{ABS_PRESSURE, {0, 0, 4095, 0, 0, 4}},
{ABS_MISC, {0, 1, 15, 0, 0, 0}},
{ABS_MT_SLOT, {0, 0, 4, 0, 0, 0}},
{ABS_MT_TOUCH_MAJOR, {0, 0, 4095, 0, 0, 0}},
{ABS_MT_TOUCH_MINOR, {0, 0, 4095, 0, 0, 0}},
{ABS_MT_ORIENTATION, {0, 0, 1, 0, 0, 0}},
{ABS_MT_POSITION_X, {0, 0, 3630, 0, 0, 32}},
{ABS_MT_POSITION_Y, {0, 0, 2346, 0, 0, 31}},
{ABS_MT_TOOL_TYPE, {0, 0, 2, 0, 0, 0}},
{ABS_MT_TRACKING_ID, {0, 0, 65535, 0, 0, 0}},
{ABS_MT_PRESSURE, {0, 0, 4095, 0, 0, 4}},
};
const DeviceCapabilities kRedrixTouchpad = {
"/sys/devices/pci0000:00/0000:00:19.1/i2c_designware.5/i2c-18/"
"i2c-ELAN2703:00/0018:04F3:323B.0001/input/input7/event6",
"ELAN2703:00 04F3:323B Touchpad",
"i2c-ELAN2703:00",
"",
"0018",
"04f3",
"323b",
"0100",
"85",
"20001b",
"e520 10000 0 0 0 0",
"0",
"6f3810001000003",
"20",
"0",
"0",
"8000 0",
kRedrixTouchpadAxes,
std::size(kRedrixTouchpadAxes),
};
const DeviceCapabilities kSymbolTechBarcodeScanner = {
"/sys/devices/pci0000:00/0000:00:14.0/usb1/1-6/1-6:1.0/0003:05E0:1200.0009/"
"input/input27/event19",
"Symbol Technologies, Inc, 2008 Symbol Bar Code Scanner",
"usb-0000:00:14.0-6/input0",
"S/N:D698905D483448AD806AAC8CD63B8B4A Rev:PAACES00-002-R033",
"0003",
"05e0",
"1200",
"0110",
"0",
"120013",
"1000000000007 ff9f207ac14057ff febeffdfffefffff fffffffffffffffe",
"0",
"0",
"10",
"0",
"1f",
"0",
nullptr,
0,
"",
"",
};
bool CapabilitiesToDeviceInfo(const DeviceCapabilities& capabilities,
EventDeviceInfo* devinfo) {
std::vector<unsigned long> ev_bits;
if (!ParseBitfield(capabilities.ev, EV_CNT, &ev_bits))
return false;
devinfo->SetEventTypes(&ev_bits[0], ev_bits.size());
std::vector<unsigned long> key_bits;
if (!ParseBitfield(capabilities.key, KEY_CNT, &key_bits))
return false;
devinfo->SetKeyEvents(&key_bits[0], key_bits.size());
std::vector<unsigned long> rel_bits;
if (!ParseBitfield(capabilities.rel, REL_CNT, &rel_bits))
return false;
devinfo->SetRelEvents(&rel_bits[0], rel_bits.size());
std::vector<unsigned long> abs_bits;
if (!ParseBitfield(capabilities.abs, ABS_CNT, &abs_bits))
return false;
devinfo->SetAbsEvents(&abs_bits[0], abs_bits.size());
std::vector<unsigned long> sw_bits;
if (!ParseBitfield(capabilities.sw, SW_CNT, &sw_bits))
return false;
devinfo->SetSwEvents(&sw_bits[0], sw_bits.size());
std::vector<unsigned long> msc_bits;
if (!ParseBitfield(capabilities.msc, MSC_CNT, &msc_bits))
return false;
devinfo->SetMscEvents(&msc_bits[0], msc_bits.size());
std::vector<unsigned long> led_bits;
if (!ParseBitfield(capabilities.led, LED_CNT, &led_bits))
return false;
devinfo->SetLedEvents(&led_bits[0], led_bits.size());
std::vector<unsigned long> ff_bits;
if (!ParseBitfield(capabilities.ff, FF_CNT, &ff_bits))
return false;
devinfo->SetFfEvents(&ff_bits[0], ff_bits.size());
std::vector<unsigned long> prop_bits;
if (!ParseBitfield(capabilities.prop, INPUT_PROP_CNT, &prop_bits))
return false;
devinfo->SetProps(&prop_bits[0], prop_bits.size());
for (size_t i = 0; i < capabilities.abs_axis_count; ++i) {
const DeviceAbsoluteAxis& axis = capabilities.abs_axis[i];
devinfo->SetAbsInfo(axis.code, axis.absinfo);
}
size_t slots = devinfo->GetAbsMtSlotCount();
std::vector<int32_t> zero_slots(slots, 0);
std::vector<int32_t> minus_one_slots(slots, -1);
for (int code = EVDEV_ABS_MT_FIRST; code <= EVDEV_ABS_MT_LAST; ++code) {
if (!devinfo->HasAbsEvent(code))
continue;
if (code == ABS_MT_TRACKING_ID)
devinfo->SetAbsMtSlots(code, minus_one_slots);
else
devinfo->SetAbsMtSlots(code, zero_slots);
}
input_id id = {};
sscanf(capabilities.vendor, "%" SCNx16, &id.vendor);
sscanf(capabilities.product, "%" SCNx16, &id.product);
sscanf(capabilities.bustype, "%" SCNx16, &id.bustype);
sscanf(capabilities.version, "%" SCNx16, &id.version);
devinfo->SetId(id);
devinfo->SetDeviceType(EventDeviceInfo::GetInputDeviceTypeFromId(id));
devinfo->SetName(capabilities.name);
return true;
}
}