Merge branch 'wip/quirks-fixes'

This commit is contained in:
Peter Hutterer 2018-06-18 10:55:27 +10:00
commit 2dfe27af25
25 changed files with 170 additions and 11 deletions

View file

@ -1,3 +1,5 @@
# Do not edit this file, it will be overwritten on update
[Serial Keyboards]
MatchUdevType=keyboard
MatchBus=ps2

View file

@ -1,3 +1,5 @@
# Do not edit this file, it will be overwritten on update
[Lid Switch Ct9]
MatchName=*Lid Switch*
MatchDMIModalias=dmi:*:ct9:*

View file

@ -1,3 +1,5 @@
# Do not edit this file, it will be overwritten on update
[Trackball]
MatchName=*Trackball*
ModelTrackball=1

View file

@ -1,3 +1,5 @@
# Do not edit this file, it will be overwritten on update
[Aiptek No Tilt Tablet]
MatchUdevType=tablet
MatchBus=usb

View file

@ -1,9 +1,36 @@
[AlpsTouchpadDualPoint]
# Do not edit this file, it will be overwritten on update
# ALPS firmware versions:
# V1 = 0x100
# V2 = 0x200
# V3 = 0x300
# V3_RUSHMORE = 0x310
# V4 = 0x400
# V5 = 0x500
# V6 = 0x600
# V7 = 0x700 /* t3btl t4s */
# V8 = 0x800 /* SS4btl SS4s */
# V9 = 0x900 /* ss3btl */
[ALPS Serial Touchpads]
MatchUdevType=touchpad
MatchName=*AlpsPS/2 ALPS DualPoint TouchPad
MatchBus=ps2
MatchVendor=0x0002
MatchProduct=0x0008
ModelALPSTouchpad=1
[AlpsTouchpadGlidePoint]
[ALPS v8 Touchpads]
MatchUdevType=touchpad
MatchName=*AlpsPS/2 ALPS GlidePoint
ModelALPSTouchpad=1
MatchBus=ps2
MatchVendor=0x0002
MatchProduct=0x0008
MatchVersion=0x0800
AttrSizeHint=100x55
[ALPS v8 Trackpoint]
MatchUdevType=pointingstick
MatchBus=ps2
MatchVendor=0x0002
MatchProduct=0x0008
MatchVersion=0x0800
AttrTrackpointRange=160

View file

@ -1,3 +1,5 @@
# Do not edit this file, it will be overwritten on update
[Cyapa Touchpads]
MatchName=*Cypress APA Trackpad ?cyapa?
AttrPressureRange=10:8

View file

@ -1,3 +1,5 @@
# Do not edit this file, it will be overwritten on update
[Elantech Touchpads]
MatchName=*Elantech Touchpad*
AttrResolutionHint=31x31

View file

@ -1,3 +1,5 @@
# Do not edit this file, it will be overwritten on update
# HUION PenTablet device. Some of these devices send a BTN_TOOL_PEN event
# with value 1 on the first event received by the device but never send the
# matching BTN_TOOL_PEN value 0 event. The device appears as if it was

View file

@ -1,3 +1,5 @@
# Do not edit this file, it will be overwritten on update
# IBM/Lenovo Scrollpoint mouse. Instead of a scroll wheel these mice
# feature trackpoint-like sticks which generate a huge amount of scroll
# events that need to be handled differently than scroll wheel events

View file

@ -1,3 +1,5 @@
# Do not edit this file, it will be overwritten on update
[Logitech M570]
MatchName=*Logitech M570*
ModelTrackball=1

View file

@ -1,3 +1,5 @@
# Do not edit this file, it will be overwritten on update
[Microsoft Surface 3 Lid Switch]
MatchName=*Lid Switch*
MatchDMIModalias=dmi:*svnMicrosoftCorporation:pnSurface3:*

View file

@ -1,3 +1,5 @@
# Do not edit this file, it will be overwritten on update
[Razer Blade Keyboard]
MatchUdevType=keyboard
MatchBus=usb

View file

@ -1,3 +1,5 @@
# Do not edit this file, it will be overwritten on update
[Synaptics Serial Touchpads]
MatchUdevType=touchpad
MatchBus=ps2

View file

@ -1,3 +1,5 @@
# Do not edit this file, it will be overwritten on update
[Wacom Touchpads]
MatchUdevType=touchpad
MatchBus=usb

View file

@ -1,3 +1,5 @@
# Do not edit this file, it will be overwritten on update
[Apple Touchpads USB]
MatchVendor=0x05AC
MatchBus=usb

View file

@ -1,3 +1,5 @@
# Do not edit this file, it will be overwritten on update
[Asus X555LAB]
MatchName=*ETPS/2 Elantech Touchpad*
MatchDMIModalias=dmi:*svnASUSTeKCOMPUTERINC.:pnX555LAB:*

View file

@ -1,3 +1,5 @@
# Do not edit this file, it will be overwritten on update
# Acer Hawaii Keyboard, uses Chicony VID
[Acer Hawaii Keyboard]
MatchUdevType=touchpad

View file

@ -1,3 +1,5 @@
# Do not edit this file, it will be overwritten on update
[Saitek Cyborg RAT5]
MatchUdevType=mouse
MatchBus=usb

View file

@ -1,3 +1,5 @@
# Do not edit this file, it will be overwritten on update
[Dell Touchpads]
MatchName=* Touchpad
MatchDMIModalias=dmi:*svnDellInc.:*

View file

@ -1,3 +1,5 @@
# Do not edit this file, it will be overwritten on update
[Google Chromebook R13 CB5-312T]
MatchName=*Elan Touchpad*
MatchDeviceTree=*Chromebook R13 CB5-312T*

View file

@ -1,3 +1,5 @@
# Do not edit this file, it will be overwritten on update
[HP Compaq 6910p]
MatchName=*SynPS/2 Synaptics TouchPad
MatchDMIModalias=dmi:*svnHewlett-Packard:*pnHPCompaq6910p*

View file

@ -1,3 +1,5 @@
# Do not edit this file, it will be overwritten on update
[Lenovo Thinkpad Touchpad]
MatchName=*Synaptics*
MatchDMIModalias=dmi:*svnLENOVO:*:pvrThinkPad*:*
@ -64,11 +66,13 @@ MatchName=*ALPS TrackPoint*
MatchDMIModalias=dmi:*svnLENOVO:*:pvrThinkPadX280:*
AttrTrackpointRange=70
# Lenovo Thinkpad X1 Yoga disables the keyboard anyway but has the same device
# use a windows key on the screen and volume rocker on the side (#103749)
[Lenovo Thinkpad X1 Yoga]
# Lenovo Thinkpad Yoga (not the consumer versions) disables the keyboard
# mechanically. We must not disable the keyboard because some keys are
# still accessible on the screen and volume rocker.
# Initially #103749 and extended by #106799 comment 7
[Lenovo Thinkpad Yoga]
MatchName=AT Translated Set 2 keyboard
MatchDMIModalias=dmi:*svnLENOVO:*pvrThinkPadX1Yoga1st:*
MatchDMIModalias=dmi:*svnLENOVO:*pvrThinkPad*Yoga*:*
ModelTabletModeNoSuspend=1
# Lenovo Carbon X1 6th gen (RMI4 only, PS/2 is broken on this device)
@ -76,3 +80,8 @@ ModelTabletModeNoSuspend=1
MatchName=Synaptics TM3288-010
MatchDMIModalias=dmi:*svnLenovo:*pvrThinkPadX1Carbon6th:*
ModelLenovoCarbonX16th=1
[Lenovo X41 Tablet]
MatchName=AT Translated Set 2 keyboard
MatchDMIModalias=dmi:*svnIBM:*pvrThinkPadX41Tablet:*
ModelTabletModeNoSuspend=1

View file

@ -1,3 +1,5 @@
# Do not edit this file, it will be overwritten on update
[System76 Bonobo Professional]
MatchName=SynPS/2 Synaptics TouchPad
MatchDMIModalias=dmi:*svnSystem76*pvrbonp5*

View file

@ -85,8 +85,9 @@ enum match_flags {
M_DMI = (1 << 4),
M_UDEV_TYPE = (1 << 5),
M_DT = (1 << 6),
M_VERSION = (1 << 7),
M_LAST = M_DT,
M_LAST = M_VERSION,
};
enum bustype {
@ -121,6 +122,7 @@ struct match {
enum bustype bus;
uint32_t vendor;
uint32_t product;
uint32_t version;
char *dmi; /* dmi modalias with preceding "dmi:" */
@ -275,6 +277,7 @@ matchflagname(enum match_flags f)
case M_BUS: return "MatchBus"; break;
case M_VID: return "MatchVendor"; break;
case M_PID: return "MatchProduct"; break;
case M_VERSION: return "MatchVersion"; break;
case M_DMI: return "MatchDMIModalias"; break;
case M_UDEV_TYPE: return "MatchUdevType"; break;
case M_DT: return "MatchDeviceTree"; break;
@ -489,6 +492,16 @@ parse_match(struct quirks_context *ctx,
goto out;
s->match.product = product;
} else if (streq(key, "MatchVersion")) {
unsigned int version;
check_set_bit(s, M_VERSION);
if (!strneq(value, "0x", 2) ||
!safe_atou_base(value, &version, 16) ||
version > 0xFFFF)
goto out;
s->match.version = version;
} else if (streq(key, "MatchDMIModalias")) {
check_set_bit(s, M_DMI);
if (!strneq(value, "dmi:", 4)) {
@ -1147,7 +1160,8 @@ match_fill_bus_vid_pid(struct match *m,
m->product = product;
m->vendor = vendor;
m->bits |= M_PID|M_VID;
m->version = version;
m->bits |= M_PID|M_VID|M_VERSION;
switch (bus) {
case BUS_USB:
m->bus = BT_USB;
@ -1295,6 +1309,10 @@ quirk_match_section(struct quirks_context *ctx,
if (m->product == s->match.product)
matched_flags |= flag;
break;
case M_VERSION:
if (m->version == s->match.version)
matched_flags |= flag;
break;
case M_DMI:
if (fnmatch(s->match.dmi, m->dmi, 0) == 0)
matched_flags |= flag;

View file

@ -578,6 +578,67 @@ START_TEST(quirks_parse_product_invalid)
}
END_TEST
START_TEST(quirks_parse_version)
{
struct quirks_context *ctx;
const char quirks_file[] =
"[Section name]\n"
"MatchVersion=0x0000\n"
"ModelAppleTouchpad=1\n"
"\n"
"[Section name]\n"
"MatchVersion=0x0001\n"
"ModelAppleTouchpad=1\n"
"\n"
"[Section name]\n"
"MatchVersion=0x2343\n"
"ModelAppleTouchpad=1\n";
struct data_dir dd = make_data_dir(quirks_file);
ctx = quirks_init_subsystem(dd.dirname,
NULL,
log_handler,
NULL,
QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert_notnull(ctx);
quirks_context_unref(ctx);
cleanup_data_dir(dd);
}
END_TEST
START_TEST(quirks_parse_version_invalid)
{
struct quirks_context *ctx;
const char *quirks_file[] = {
"[Section name]\n"
"MatchVersion=-1\n"
"ModelAppleTouchpad=1\n",
"[Section name]\n"
"MatchVersion=abc\n"
"ModelAppleTouchpad=1\n",
"[Section name]\n"
"MatchVersion=0xFFFFF\n"
"ModelAppleTouchpad=1\n",
"[Section name]\n"
"MatchVersion=123\n"
"ModelAppleTouchpad=1\n",
};
const char **qf;
ARRAY_FOR_EACH(quirks_file, qf) {
struct data_dir dd = make_data_dir(*qf);
ctx = quirks_init_subsystem(dd.dirname,
NULL,
log_handler,
NULL,
QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert(ctx == NULL);
cleanup_data_dir(dd);
}
}
END_TEST
START_TEST(quirks_parse_name)
{
struct quirks_context *ctx;
@ -939,6 +1000,8 @@ TEST_COLLECTION(quirks)
litest_add_for_device("quirks:parsing", quirks_parse_vendor_invalid, LITEST_MOUSE);
litest_add_for_device("quirks:parsing", quirks_parse_product, LITEST_MOUSE);
litest_add_for_device("quirks:parsing", quirks_parse_product_invalid, LITEST_MOUSE);
litest_add_for_device("quirks:parsing", quirks_parse_version, LITEST_MOUSE);
litest_add_for_device("quirks:parsing", quirks_parse_version_invalid, LITEST_MOUSE);
litest_add_for_device("quirks:parsing", quirks_parse_name, LITEST_MOUSE);
litest_add_for_device("quirks:parsing", quirks_parse_name_invalid, LITEST_MOUSE);
litest_add_for_device("quirks:parsing", quirks_parse_udev, LITEST_MOUSE);