mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-20 09:10:04 +01:00
quirks: enforce uppercase hex numbers
No specific reason other than consistency. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
8630e0ef67
commit
c412924003
4 changed files with 17 additions and 14 deletions
|
|
@ -1,11 +1,11 @@
|
||||||
[Contour Design RollerMouse Free 2]
|
[Contour Design RollerMouse Free 2]
|
||||||
MatchVendor=0x0b33
|
MatchVendor=0x0B33
|
||||||
MatchProduct=0x0401
|
MatchProduct=0x0401
|
||||||
MatchUdevType=mouse
|
MatchUdevType=mouse
|
||||||
ModelBouncingKeys=1
|
ModelBouncingKeys=1
|
||||||
|
|
||||||
[Contour Design RollerMouse Re:d]
|
[Contour Design RollerMouse Re:d]
|
||||||
MatchVendor=0x0b33
|
MatchVendor=0x0B33
|
||||||
MatchProduct=0x1000
|
MatchProduct=0x1000
|
||||||
MatchUdevType=mouse
|
MatchUdevType=mouse
|
||||||
ModelBouncingKeys=1
|
ModelBouncingKeys=1
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# Kensington Orbit claims to have a middle button, same for
|
# Kensington Orbit claims to have a middle button, same for
|
||||||
[Kensington Orbit Scroll Wheel]
|
[Kensington Orbit Scroll Wheel]
|
||||||
MatchBus=usb
|
MatchBus=usb
|
||||||
MatchVendor=0x047d
|
MatchVendor=0x047D
|
||||||
MatchProduct=0x2048
|
MatchProduct=0x2048
|
||||||
ModelTrackball=1
|
ModelTrackball=1
|
||||||
AttrEventCodeDisable=BTN_MIDDLE
|
AttrEventCodeDisable=BTN_MIDDLE
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,6 @@ AttrTPKComboLayout=below
|
||||||
[Chicony Lenovo MIIX 720 Touchpad]
|
[Chicony Lenovo MIIX 720 Touchpad]
|
||||||
MatchUdevType=touchpad
|
MatchUdevType=touchpad
|
||||||
MatchBus=usb
|
MatchBus=usb
|
||||||
MatchVendor=0x17ef
|
MatchVendor=0x17EF
|
||||||
MatchProduct=0x60a6
|
MatchProduct=0x60A6
|
||||||
AttrTPKComboLayout=below
|
AttrTPKComboLayout=below
|
||||||
|
|
|
||||||
21
src/quirks.c
21
src/quirks.c
|
|
@ -438,6 +438,15 @@ section_destroy(struct section *s)
|
||||||
free(s);
|
free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool
|
||||||
|
parse_hex(const char *value, unsigned int *parsed)
|
||||||
|
{
|
||||||
|
return strneq(value, "0x", 2) &&
|
||||||
|
safe_atou_base(value, parsed, 16) &&
|
||||||
|
strspn(value, "0123456789xABCDEF") == strlen(value) &&
|
||||||
|
*parsed <= 0xFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse a MatchFooBar=banana line.
|
* Parse a MatchFooBar=banana line.
|
||||||
*
|
*
|
||||||
|
|
@ -483,9 +492,7 @@ parse_match(struct quirks_context *ctx,
|
||||||
unsigned int vendor;
|
unsigned int vendor;
|
||||||
|
|
||||||
check_set_bit(s, M_VID);
|
check_set_bit(s, M_VID);
|
||||||
if (!strneq(value, "0x", 2) ||
|
if (!parse_hex(value, &vendor))
|
||||||
!safe_atou_base(value, &vendor, 16) ||
|
|
||||||
vendor > 0xFFFF)
|
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
s->match.vendor = vendor;
|
s->match.vendor = vendor;
|
||||||
|
|
@ -493,9 +500,7 @@ parse_match(struct quirks_context *ctx,
|
||||||
unsigned int product;
|
unsigned int product;
|
||||||
|
|
||||||
check_set_bit(s, M_PID);
|
check_set_bit(s, M_PID);
|
||||||
if (!strneq(value, "0x", 2) ||
|
if (!parse_hex(value, &product))
|
||||||
!safe_atou_base(value, &product, 16) ||
|
|
||||||
product > 0xFFFF)
|
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
s->match.product = product;
|
s->match.product = product;
|
||||||
|
|
@ -503,9 +508,7 @@ parse_match(struct quirks_context *ctx,
|
||||||
unsigned int version;
|
unsigned int version;
|
||||||
|
|
||||||
check_set_bit(s, M_VERSION);
|
check_set_bit(s, M_VERSION);
|
||||||
if (!strneq(value, "0x", 2) ||
|
if (!parse_hex(value, &version))
|
||||||
!safe_atou_base(value, &version, 16) ||
|
|
||||||
version > 0xFFFF)
|
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
s->match.version = version;
|
s->match.version = version;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue