Replace log_bug with per-component bug macros
authorPeter Hutterer <peter.hutterer@who-t.net>
Wed, 21 May 2014 04:36:01 +0000 (14:36 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Fri, 30 May 2014 01:55:23 +0000 (11:55 +1000)
When we knowingly hit a bug, we should know what the bug is caused by. Log
that in a standardized fashion.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
src/evdev-mt-touchpad-buttons.c
src/evdev.c
src/libinput-private.h

index 65fa21beb84446abb5dcfeb91abb154079be228e..a3220c5b6e19359135bf581eabd0b5f183c5795c 100644 (file)
@@ -365,8 +365,8 @@ tp_process_button(struct tp_dispatch *tp,
 
        /* Ignore other buttons on clickpads */
        if (tp->buttons.is_clickpad && e->code != BTN_LEFT) {
-               log_bug("received %s button event on a clickpad (kernel bug?)\n",
-                       libevdev_event_code_get_name(EV_KEY, e->code));
+               log_bug_kernel("received %s button event on a clickpad\n",
+                              libevdev_event_code_get_name(EV_KEY, e->code));
                return 0;
        }
 
@@ -416,10 +416,10 @@ tp_init_buttons(struct tp_dispatch *tp,
        if (libevdev_has_event_code(device->evdev, EV_KEY, BTN_MIDDLE) ||
            libevdev_has_event_code(device->evdev, EV_KEY, BTN_RIGHT)) {
                if (tp->buttons.is_clickpad)
-                       log_bug("clickpad advertising right button (kernel bug?)\n");
+                       log_bug_kernel("clickpad advertising right button\n");
        } else {
                if (!tp->buttons.is_clickpad)
-                       log_bug("non clickpad without right button (kernel bug)?\n");
+                       log_bug_kernel("non clickpad without right button?\n");
        }
 
        width = abs(device->abs.max_x - device->abs.min_x);
index cc54ab378a9bb021433a3f3c6d4a83959b4985b8..ed5749e7baf83cbd40484449ef5fcec291809e08 100644 (file)
@@ -149,8 +149,8 @@ evdev_flush_pending_event(struct evdev_device *device, uint64_t time)
                        break;
 
                if (device->mt.slots[slot].seat_slot != -1) {
-                       log_bug("%s: Driver sent multiple touch down for the "
-                               "same slot", device->devnode);
+                       log_bug_kernel("%s: Driver sent multiple touch down for the "
+                                      "same slot", device->devnode);
                        break;
                }
 
@@ -198,8 +198,8 @@ evdev_flush_pending_event(struct evdev_device *device, uint64_t time)
                        break;
 
                if (device->abs.seat_slot != -1) {
-                       log_bug("%s: Driver sent multiple touch down for the "
-                               "same slot", device->devnode);
+                       log_bug_kernel("%s: Driver sent multiple touch down for the "
+                                      "same slot", device->devnode);
                        break;
                }
 
index dc1d5905f0dc672dd1d26c644e1203b1037b7268..61cdc79c319e8b247d06dc0bb2de9babe299228f 100644 (file)
@@ -84,7 +84,9 @@ struct libinput_source;
 #define log_debug(...) log_msg(LIBINPUT_LOG_PRIORITY_DEBUG, __VA_ARGS__)
 #define log_info(...) log_msg(LIBINPUT_LOG_PRIORITY_INFO, __VA_ARGS__)
 #define log_error(...) log_msg(LIBINPUT_LOG_PRIORITY_ERROR, __VA_ARGS__)
-#define log_bug(...) log_msg(LIBINPUT_LOG_PRIORITY_ERROR, "BUG: "__VA_ARGS__)
+#define log_bug_kernel(...) log_msg(LIBINPUT_LOG_PRIORITY_ERROR, "kernel bug: " __VA_ARGS__)
+#define log_bug_libinput(...) log_msg(LIBINPUT_LOG_PRIORITY_ERROR, "libinput bug: " __VA_ARGS__);
+#define log_bug_client(...) log_msg(LIBINPUT_LOG_PRIORITY_ERROR, "client bug: " __VA_ARGS__);
 
 void
 log_msg(enum libinput_log_priority priority, const char *format, ...);