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