Merge pull request #17395 from keszybz/hwdb-drop-quotes
hwdb: drop quotes from XKB_FIXED_*= properties
This commit is contained in:
commit
9d7b11fdc8
|
@ -72,14 +72,14 @@
|
||||||
|
|
||||||
# A device with a fixed keyboard layout that must not be changed by
|
# A device with a fixed keyboard layout that must not be changed by
|
||||||
# the desktop environment may specify that layout as:
|
# the desktop environment may specify that layout as:
|
||||||
# XKB_FIXED_LAYOUT="us"
|
# XKB_FIXED_LAYOUT=us
|
||||||
# XKB_FIXED_VARIANT=""
|
# XKB_FIXED_VARIANT=
|
||||||
# Examples of such devices: the Yubikey or other key-code generating
|
# Examples of such devices: the Yubikey or other key-code generating
|
||||||
# devices.
|
# devices.
|
||||||
|
|
||||||
# A device where the scan code to key code mapping is insufficient and
|
# A device where the scan code to key code mapping is insufficient and
|
||||||
# requires a special key code to symbol configuration may specify that with:
|
# requires a special key code to symbol configuration may specify that with:
|
||||||
# XKB_FIXED_MODEL="xkbmodel"
|
# XKB_FIXED_MODEL=xkbmodel
|
||||||
# Examples of such devices: Chromebooks where the top row is used for both
|
# Examples of such devices: Chromebooks where the top row is used for both
|
||||||
# media and F1-F10 keys.
|
# media and F1-F10 keys.
|
||||||
|
|
||||||
|
@ -1796,8 +1796,8 @@ evdev:input:b0003v1050p0111:*
|
||||||
evdev:input:b0003v1050p0116:*
|
evdev:input:b0003v1050p0116:*
|
||||||
# OKE Electron Company USB barcode reader
|
# OKE Electron Company USB barcode reader
|
||||||
evdev:input:b0003v05FEp1010:*
|
evdev:input:b0003v05FEp1010:*
|
||||||
XKB_FIXED_LAYOUT="us"
|
XKB_FIXED_LAYOUT=us
|
||||||
XKB_FIXED_VARIANT=""
|
XKB_FIXED_VARIANT=
|
||||||
|
|
||||||
######################### LACK OF MODIFIER LEDS ############################
|
######################### LACK OF MODIFIER LEDS ############################
|
||||||
# This section lists keyboard which do not have their own LEDs for some
|
# This section lists keyboard which do not have their own LEDs for some
|
||||||
|
@ -1846,4 +1846,4 @@ evdev:atkbd:dmi:bvn*:bvr*:bd*:svnLENOVO:pn*:pvrThinkPadX1Carbon3rd:*
|
||||||
# Chromebooks
|
# Chromebooks
|
||||||
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnHewlett-Packard*:pnFalco:*
|
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnHewlett-Packard*:pnFalco:*
|
||||||
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnAcer*:pnPeppy:*
|
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnAcer*:pnPeppy:*
|
||||||
XKB_FIXED_MODEL="chromebook"
|
XKB_FIXED_MODEL=chromebook
|
||||||
|
|
|
@ -32,7 +32,7 @@ try:
|
||||||
from pyparsing import (Word, White, Literal, ParserElement, Regex, LineEnd,
|
from pyparsing import (Word, White, Literal, ParserElement, Regex, LineEnd,
|
||||||
OneOrMore, Combine, Or, Optional, Suppress, Group,
|
OneOrMore, Combine, Or, Optional, Suppress, Group,
|
||||||
nums, alphanums, printables,
|
nums, alphanums, printables,
|
||||||
stringEnd, pythonStyleComment, QuotedString,
|
stringEnd, pythonStyleComment,
|
||||||
ParseBaseException)
|
ParseBaseException)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print('pyparsing is not available')
|
print('pyparsing is not available')
|
||||||
|
@ -54,7 +54,6 @@ EOL = LineEnd().suppress()
|
||||||
EMPTYLINE = LineEnd()
|
EMPTYLINE = LineEnd()
|
||||||
COMMENTLINE = pythonStyleComment + EOL
|
COMMENTLINE = pythonStyleComment + EOL
|
||||||
INTEGER = Word(nums)
|
INTEGER = Word(nums)
|
||||||
STRING = QuotedString('"')
|
|
||||||
REAL = Combine((INTEGER + Optional('.' + Optional(INTEGER))) ^ ('.' + INTEGER))
|
REAL = Combine((INTEGER + Optional('.' + Optional(INTEGER))) ^ ('.' + INTEGER))
|
||||||
SIGNED_REAL = Combine(Optional(Word('-+')) + REAL)
|
SIGNED_REAL = Combine(Optional(Word('-+')) + REAL)
|
||||||
UDEV_TAG = Word(string.ascii_uppercase, alphanums + '_')
|
UDEV_TAG = Word(string.ascii_uppercase, alphanums + '_')
|
||||||
|
@ -94,7 +93,8 @@ def hwdb_grammar():
|
||||||
matchline = (matchline_typed | matchline_general) + EOL
|
matchline = (matchline_typed | matchline_general) + EOL
|
||||||
|
|
||||||
propertyline = (White(' ', exact=1).suppress() +
|
propertyline = (White(' ', exact=1).suppress() +
|
||||||
Combine(UDEV_TAG - '=' - Word(alphanums + '_=:@*.!-;, "') - Optional(pythonStyleComment)) +
|
Combine(UDEV_TAG - '=' - Optional(Word(alphanums + '_=:@*.!-;, "'))
|
||||||
|
- Optional(pythonStyleComment)) +
|
||||||
EOL)
|
EOL)
|
||||||
propertycomment = White(' ', exact=1) + pythonStyleComment + EOL
|
propertycomment = White(' ', exact=1) + pythonStyleComment + EOL
|
||||||
|
|
||||||
|
@ -114,6 +114,7 @@ def property_grammar():
|
||||||
dpi_setting = (Optional('*')('DEFAULT') + INTEGER('DPI') + Suppress('@') + INTEGER('HZ'))('SETTINGS*')
|
dpi_setting = (Optional('*')('DEFAULT') + INTEGER('DPI') + Suppress('@') + INTEGER('HZ'))('SETTINGS*')
|
||||||
mount_matrix_row = SIGNED_REAL + ',' + SIGNED_REAL + ',' + SIGNED_REAL
|
mount_matrix_row = SIGNED_REAL + ',' + SIGNED_REAL + ',' + SIGNED_REAL
|
||||||
mount_matrix = (mount_matrix_row + ';' + mount_matrix_row + ';' + mount_matrix_row)('MOUNT_MATRIX')
|
mount_matrix = (mount_matrix_row + ';' + mount_matrix_row + ';' + mount_matrix_row)('MOUNT_MATRIX')
|
||||||
|
xkb_setting = Optional(Word(alphanums + '+-/@._'))
|
||||||
|
|
||||||
props = (('MOUSE_DPI', Group(OneOrMore(dpi_setting))),
|
props = (('MOUSE_DPI', Group(OneOrMore(dpi_setting))),
|
||||||
('MOUSE_WHEEL_CLICK_ANGLE', INTEGER),
|
('MOUSE_WHEEL_CLICK_ANGLE', INTEGER),
|
||||||
|
@ -138,9 +139,9 @@ def property_grammar():
|
||||||
('POINTINGSTICK_CONST_ACCEL', REAL),
|
('POINTINGSTICK_CONST_ACCEL', REAL),
|
||||||
('ID_INPUT_JOYSTICK_INTEGRATION', Or(('internal', 'external'))),
|
('ID_INPUT_JOYSTICK_INTEGRATION', Or(('internal', 'external'))),
|
||||||
('ID_INPUT_TOUCHPAD_INTEGRATION', Or(('internal', 'external'))),
|
('ID_INPUT_TOUCHPAD_INTEGRATION', Or(('internal', 'external'))),
|
||||||
('XKB_FIXED_LAYOUT', STRING),
|
('XKB_FIXED_LAYOUT', xkb_setting),
|
||||||
('XKB_FIXED_VARIANT', STRING),
|
('XKB_FIXED_VARIANT', xkb_setting),
|
||||||
('XKB_FIXED_MODEL', STRING),
|
('XKB_FIXED_MODEL', xkb_setting),
|
||||||
('KEYBOARD_LED_NUMLOCK', Literal('0')),
|
('KEYBOARD_LED_NUMLOCK', Literal('0')),
|
||||||
('KEYBOARD_LED_CAPSLOCK', Literal('0')),
|
('KEYBOARD_LED_CAPSLOCK', Literal('0')),
|
||||||
('ACCEL_MOUNT_MATRIX', mount_matrix),
|
('ACCEL_MOUNT_MATRIX', mount_matrix),
|
||||||
|
|
|
@ -105,12 +105,10 @@ static struct trie_node *node_lookup(const struct trie_node *node, uint8_t c) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void trie_node_cleanup(struct trie_node *node) {
|
static void trie_node_cleanup(struct trie_node *node) {
|
||||||
size_t i;
|
|
||||||
|
|
||||||
if (!node)
|
if (!node)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < node->children_count; i++)
|
for (size_t i = 0; i < node->children_count; i++)
|
||||||
trie_node_cleanup(node->children[i].child);
|
trie_node_cleanup(node->children[i].child);
|
||||||
free(node->children);
|
free(node->children);
|
||||||
free(node->values);
|
free(node->values);
|
||||||
|
@ -191,10 +189,9 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node,
|
||||||
static int trie_insert(struct trie *trie, struct trie_node *node, const char *search,
|
static int trie_insert(struct trie *trie, struct trie_node *node, const char *search,
|
||||||
const char *key, const char *value,
|
const char *key, const char *value,
|
||||||
const char *filename, uint16_t file_priority, uint32_t line_number, bool compat) {
|
const char *filename, uint16_t file_priority, uint32_t line_number, bool compat) {
|
||||||
size_t i = 0;
|
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
for (;;) {
|
for (size_t i = 0;; i++) {
|
||||||
size_t p;
|
size_t p;
|
||||||
uint8_t c;
|
uint8_t c;
|
||||||
struct trie_node *child;
|
struct trie_node *child;
|
||||||
|
@ -273,7 +270,6 @@ static int trie_insert(struct trie *trie, struct trie_node *node, const char *se
|
||||||
}
|
}
|
||||||
|
|
||||||
node = child;
|
node = child;
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,20 +285,17 @@ struct trie_f {
|
||||||
|
|
||||||
/* calculate the storage space for the nodes, children arrays, value arrays */
|
/* calculate the storage space for the nodes, children arrays, value arrays */
|
||||||
static void trie_store_nodes_size(struct trie_f *trie, struct trie_node *node, bool compat) {
|
static void trie_store_nodes_size(struct trie_f *trie, struct trie_node *node, bool compat) {
|
||||||
uint64_t i;
|
for (uint64_t i = 0; i < node->children_count; i++)
|
||||||
|
|
||||||
for (i = 0; i < node->children_count; i++)
|
|
||||||
trie_store_nodes_size(trie, node->children[i].child, compat);
|
trie_store_nodes_size(trie, node->children[i].child, compat);
|
||||||
|
|
||||||
trie->strings_off += sizeof(struct trie_node_f);
|
trie->strings_off += sizeof(struct trie_node_f);
|
||||||
for (i = 0; i < node->children_count; i++)
|
for (uint64_t i = 0; i < node->children_count; i++)
|
||||||
trie->strings_off += sizeof(struct trie_child_entry_f);
|
trie->strings_off += sizeof(struct trie_child_entry_f);
|
||||||
for (i = 0; i < node->values_count; i++)
|
for (uint64_t i = 0; i < node->values_count; i++)
|
||||||
trie->strings_off += compat ? sizeof(struct trie_value_entry_f) : sizeof(struct trie_value_entry2_f);
|
trie->strings_off += compat ? sizeof(struct trie_value_entry_f) : sizeof(struct trie_value_entry2_f);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int64_t trie_store_nodes(struct trie_f *trie, struct trie_node *node, bool compat) {
|
static int64_t trie_store_nodes(struct trie_f *trie, struct trie_node *node, bool compat) {
|
||||||
uint64_t i;
|
|
||||||
struct trie_node_f n = {
|
struct trie_node_f n = {
|
||||||
.prefix_off = htole64(trie->strings_off + node->prefix_off),
|
.prefix_off = htole64(trie->strings_off + node->prefix_off),
|
||||||
.children_count = node->children_count,
|
.children_count = node->children_count,
|
||||||
|
@ -318,7 +311,7 @@ static int64_t trie_store_nodes(struct trie_f *trie, struct trie_node *node, boo
|
||||||
}
|
}
|
||||||
|
|
||||||
/* post-order recursion */
|
/* post-order recursion */
|
||||||
for (i = 0; i < node->children_count; i++) {
|
for (uint64_t i = 0; i < node->children_count; i++) {
|
||||||
int64_t child_off;
|
int64_t child_off;
|
||||||
|
|
||||||
child_off = trie_store_nodes(trie, node->children[i].child, compat);
|
child_off = trie_store_nodes(trie, node->children[i].child, compat);
|
||||||
|
@ -343,7 +336,7 @@ static int64_t trie_store_nodes(struct trie_f *trie, struct trie_node *node, boo
|
||||||
}
|
}
|
||||||
|
|
||||||
/* append values array */
|
/* append values array */
|
||||||
for (i = 0; i < node->values_count; i++) {
|
for (uint64_t i = 0; i < node->values_count; i++) {
|
||||||
struct trie_value_entry2_f v = {
|
struct trie_value_entry2_f v = {
|
||||||
.key_off = htole64(trie->strings_off + node->values[i].key_off),
|
.key_off = htole64(trie->strings_off + node->values[i].key_off),
|
||||||
.value_off = htole64(trie->strings_off + node->values[i].value_off),
|
.value_off = htole64(trie->strings_off + node->values[i].value_off),
|
||||||
|
@ -447,7 +440,7 @@ static int insert_data(struct trie *trie, char **match_list, char *line, const c
|
||||||
value = strchr(line, '=');
|
value = strchr(line, '=');
|
||||||
if (!value)
|
if (!value)
|
||||||
return log_syntax(NULL, LOG_WARNING, filename, line_number, SYNTHETIC_ERRNO(EINVAL),
|
return log_syntax(NULL, LOG_WARNING, filename, line_number, SYNTHETIC_ERRNO(EINVAL),
|
||||||
"Key-value pair expected but got \"%s\", ignoring", line);
|
"Key-value pair expected but got \"%s\", ignoring.", line);
|
||||||
|
|
||||||
value[0] = '\0';
|
value[0] = '\0';
|
||||||
value++;
|
value++;
|
||||||
|
@ -456,10 +449,9 @@ static int insert_data(struct trie *trie, char **match_list, char *line, const c
|
||||||
while (isblank(line[0]) && isblank(line[1]))
|
while (isblank(line[0]) && isblank(line[1]))
|
||||||
line++;
|
line++;
|
||||||
|
|
||||||
if (isempty(line + 1) || isempty(value))
|
if (isempty(line + 1))
|
||||||
return log_syntax(NULL, LOG_WARNING, filename, line_number, SYNTHETIC_ERRNO(EINVAL),
|
return log_syntax(NULL, LOG_WARNING, filename, line_number, SYNTHETIC_ERRNO(EINVAL),
|
||||||
"Empty %s in \"%s=%s\", ignoring",
|
"Empty key in \"%s=%s\", ignoring.",
|
||||||
isempty(line + 1) ? "key" : "value",
|
|
||||||
line, value);
|
line, value);
|
||||||
|
|
||||||
STRV_FOREACH(entry, match_list)
|
STRV_FOREACH(entry, match_list)
|
||||||
|
@ -494,7 +486,7 @@ static int import_file(struct trie *trie, const char *filename, uint16_t file_pr
|
||||||
if (r == 0)
|
if (r == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
++line_number;
|
line_number ++;
|
||||||
|
|
||||||
/* comment line */
|
/* comment line */
|
||||||
if (line[0] == '#')
|
if (line[0] == '#')
|
||||||
|
@ -518,7 +510,7 @@ static int import_file(struct trie *trie, const char *filename, uint16_t file_pr
|
||||||
|
|
||||||
if (line[0] == ' ') {
|
if (line[0] == ' ') {
|
||||||
r = log_syntax(NULL, LOG_WARNING, filename, line_number, SYNTHETIC_ERRNO(EINVAL),
|
r = log_syntax(NULL, LOG_WARNING, filename, line_number, SYNTHETIC_ERRNO(EINVAL),
|
||||||
"Match expected but got indented property \"%s\", ignoring line", line);
|
"Match expected but got indented property \"%s\", ignoring line.", line);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -534,7 +526,7 @@ static int import_file(struct trie *trie, const char *filename, uint16_t file_pr
|
||||||
case HW_MATCH:
|
case HW_MATCH:
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
r = log_syntax(NULL, LOG_WARNING, filename, line_number, SYNTHETIC_ERRNO(EINVAL),
|
r = log_syntax(NULL, LOG_WARNING, filename, line_number, SYNTHETIC_ERRNO(EINVAL),
|
||||||
"Property expected, ignoring record with no properties");
|
"Property expected, ignoring record with no properties.");
|
||||||
state = HW_NONE;
|
state = HW_NONE;
|
||||||
match_list = strv_free(match_list);
|
match_list = strv_free(match_list);
|
||||||
break;
|
break;
|
||||||
|
@ -566,7 +558,7 @@ static int import_file(struct trie *trie, const char *filename, uint16_t file_pr
|
||||||
|
|
||||||
if (line[0] != ' ') {
|
if (line[0] != ' ') {
|
||||||
r = log_syntax(NULL, LOG_WARNING, filename, line_number, SYNTHETIC_ERRNO(EINVAL),
|
r = log_syntax(NULL, LOG_WARNING, filename, line_number, SYNTHETIC_ERRNO(EINVAL),
|
||||||
"Property or empty line expected, got \"%s\", ignoring record", line);
|
"Property or empty line expected, got \"%s\", ignoring record.", line);
|
||||||
state = HW_NONE;
|
state = HW_NONE;
|
||||||
match_list = strv_free(match_list);
|
match_list = strv_free(match_list);
|
||||||
break;
|
break;
|
||||||
|
@ -581,7 +573,7 @@ static int import_file(struct trie *trie, const char *filename, uint16_t file_pr
|
||||||
|
|
||||||
if (state == HW_MATCH)
|
if (state == HW_MATCH)
|
||||||
log_syntax(NULL, LOG_WARNING, filename, line_number, 0,
|
log_syntax(NULL, LOG_WARNING, filename, line_number, 0,
|
||||||
"Property expected, ignoring record with no properties");
|
"Property expected, ignoring record with no properties.");
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue