|
|
17b0f1 |
From a347fcea7ab1648cfa28b4fbb903ae95b879b86e Mon Sep 17 00:00:00 2001
|
|
|
17b0f1 |
From: Peter Hutterer <peter.hutterer@who-t.net>
|
|
|
17b0f1 |
Date: Fri, 20 Mar 2015 14:00:31 +1000
|
|
|
17b0f1 |
Subject: [PATCH] udev: builtin-keyboard: invert a condition
|
|
|
17b0f1 |
|
|
|
17b0f1 |
No functional changes, just to make the next patch easier to review
|
|
|
17b0f1 |
|
|
|
17b0f1 |
(cherry picked from commit 8a0fd83cf03547653a195582ba004d2ff69dfbd0)
|
|
|
17b0f1 |
|
|
|
17b0f1 |
Resolves: #1500119
|
|
|
17b0f1 |
---
|
|
|
17b0f1 |
src/udev/udev-builtin-keyboard.c | 56 ++++++++++++++++----------------
|
|
|
17b0f1 |
1 file changed, 28 insertions(+), 28 deletions(-)
|
|
|
17b0f1 |
|
|
|
17b0f1 |
diff --git a/src/udev/udev-builtin-keyboard.c b/src/udev/udev-builtin-keyboard.c
|
|
|
17b0f1 |
index f33401790c..86f4018ef5 100644
|
|
|
17b0f1 |
--- a/src/udev/udev-builtin-keyboard.c
|
|
|
17b0f1 |
+++ b/src/udev/udev-builtin-keyboard.c
|
|
|
17b0f1 |
@@ -115,43 +115,43 @@ static int builtin_keyboard(struct udev_device *dev, int argc, char *argv[], boo
|
|
|
17b0f1 |
udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev)) {
|
|
|
17b0f1 |
const char *key;
|
|
|
17b0f1 |
char *endptr;
|
|
|
17b0f1 |
- unsigned scancode;
|
|
|
17b0f1 |
- const char *keycode;
|
|
|
17b0f1 |
|
|
|
17b0f1 |
key = udev_list_entry_get_name(entry);
|
|
|
17b0f1 |
- if (!startswith(key, "KEYBOARD_KEY_"))
|
|
|
17b0f1 |
- continue;
|
|
|
17b0f1 |
-
|
|
|
17b0f1 |
- /* KEYBOARD_KEY_<hex scan code>=<key identifier string> */
|
|
|
17b0f1 |
- scancode = strtoul(key + 13, &endptr, 16);
|
|
|
17b0f1 |
- if (endptr[0] != '\0') {
|
|
|
17b0f1 |
- log_error("Error, unable to parse scan code from '%s'", key);
|
|
|
17b0f1 |
- continue;
|
|
|
17b0f1 |
- }
|
|
|
17b0f1 |
+ if (startswith(key, "KEYBOARD_KEY_")) {
|
|
|
17b0f1 |
+ const char *keycode;
|
|
|
17b0f1 |
+ unsigned scancode;
|
|
|
17b0f1 |
+
|
|
|
17b0f1 |
+ /* KEYBOARD_KEY_<hex scan code>=<key identifier string> */
|
|
|
17b0f1 |
+ scancode = strtoul(key + 13, &endptr, 16);
|
|
|
17b0f1 |
+ if (endptr[0] != '\0') {
|
|
|
17b0f1 |
+ log_error("Error, unable to parse scan code from '%s'", key);
|
|
|
17b0f1 |
+ continue;
|
|
|
17b0f1 |
+ }
|
|
|
17b0f1 |
|
|
|
17b0f1 |
- keycode = udev_list_entry_get_value(entry);
|
|
|
17b0f1 |
+ keycode = udev_list_entry_get_value(entry);
|
|
|
17b0f1 |
|
|
|
17b0f1 |
- /* a leading '!' needs a force-release entry */
|
|
|
17b0f1 |
- if (keycode[0] == '!') {
|
|
|
17b0f1 |
- keycode++;
|
|
|
17b0f1 |
+ /* a leading '!' needs a force-release entry */
|
|
|
17b0f1 |
+ if (keycode[0] == '!') {
|
|
|
17b0f1 |
+ keycode++;
|
|
|
17b0f1 |
|
|
|
17b0f1 |
- release[release_count] = scancode;
|
|
|
17b0f1 |
- if (release_count < ELEMENTSOF(release)-1)
|
|
|
17b0f1 |
- release_count++;
|
|
|
17b0f1 |
+ release[release_count] = scancode;
|
|
|
17b0f1 |
+ if (release_count < ELEMENTSOF(release)-1)
|
|
|
17b0f1 |
+ release_count++;
|
|
|
17b0f1 |
|
|
|
17b0f1 |
- if (keycode[0] == '\0')
|
|
|
17b0f1 |
- continue;
|
|
|
17b0f1 |
- }
|
|
|
17b0f1 |
+ if (keycode[0] == '\0')
|
|
|
17b0f1 |
+ continue;
|
|
|
17b0f1 |
+ }
|
|
|
17b0f1 |
|
|
|
17b0f1 |
- if (fd == -1) {
|
|
|
17b0f1 |
- fd = open(node, O_RDWR|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
|
|
|
17b0f1 |
- if (fd < 0) {
|
|
|
17b0f1 |
- log_error_errno(errno, "Error, opening device '%s': %m", node);
|
|
|
17b0f1 |
- return EXIT_FAILURE;
|
|
|
17b0f1 |
+ if (fd == -1) {
|
|
|
17b0f1 |
+ fd = open(node, O_RDWR|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
|
|
|
17b0f1 |
+ if (fd < 0) {
|
|
|
17b0f1 |
+ log_error_errno(errno, "Error, opening device '%s': %m", node);
|
|
|
17b0f1 |
+ return EXIT_FAILURE;
|
|
|
17b0f1 |
+ }
|
|
|
17b0f1 |
}
|
|
|
17b0f1 |
- }
|
|
|
17b0f1 |
|
|
|
17b0f1 |
- map_keycode(fd, node, scancode, keycode);
|
|
|
17b0f1 |
+ map_keycode(fd, node, scancode, keycode);
|
|
|
17b0f1 |
+ }
|
|
|
17b0f1 |
}
|
|
|
17b0f1 |
|
|
|
17b0f1 |
/* install list of force-release codes */
|