Replace log_bug with per-component bug macros

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>
This commit is contained in:
Peter Hutterer 2014-05-21 14:36:01 +10:00
parent b52b9440ee
commit 055b1c8bc9
3 changed files with 11 additions and 9 deletions

View 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);

View 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;
}

View 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, ...);