diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2017-02-14 09:07:33 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2017-02-14 09:07:33 +1000 |
commit | 63fcf46951118b94a37070cfe48f16ac9690457f (patch) | |
tree | 304fe6c9aa9a58b1abd12d17147c0b513f9de5c9 /tools | |
parent | 8c1aa1de006bbb3321c29bf4634090da39f5fa37 (diff) |
tools: don't print device options on device removed
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/event-debug.c | 102 |
1 files changed, 55 insertions, 47 deletions
diff --git a/tools/event-debug.c b/tools/event-debug.c index 9022e39..a9d15a7 100644 --- a/tools/event-debug.c +++ b/tools/event-debug.c @@ -154,55 +154,10 @@ print_event_time(uint32_t time) printf("%+6.2fs ", (time - start_time) / 1000.0); } -static void -print_device_notify(struct libinput_event *ev) +static inline void +print_device_options(struct libinput_device *dev) { - struct libinput_device *dev = libinput_event_get_device(ev); - struct libinput_seat *seat = libinput_device_get_seat(dev); - struct libinput_device_group *group; - double w, h; uint32_t scroll_methods, click_methods; - static int next_group_id = 0; - intptr_t group_id; - - group = libinput_device_get_device_group(dev); - group_id = (intptr_t)libinput_device_group_get_user_data(group); - if (!group_id) { - group_id = ++next_group_id; - libinput_device_group_set_user_data(group, (void*)group_id); - } - - printf("%-33s %5s %7s group%-2d", - libinput_device_get_name(dev), - libinput_seat_get_physical_name(seat), - libinput_seat_get_logical_name(seat), - (int)group_id); - - printf(" cap:"); - if (libinput_device_has_capability(dev, - LIBINPUT_DEVICE_CAP_KEYBOARD)) - printf("k"); - if (libinput_device_has_capability(dev, - LIBINPUT_DEVICE_CAP_POINTER)) - printf("p"); - if (libinput_device_has_capability(dev, - LIBINPUT_DEVICE_CAP_TOUCH)) - printf("t"); - if (libinput_device_has_capability(dev, - LIBINPUT_DEVICE_CAP_GESTURE)) - printf("g"); - if (libinput_device_has_capability(dev, - LIBINPUT_DEVICE_CAP_TABLET_TOOL)) - printf("T"); - if (libinput_device_has_capability(dev, - LIBINPUT_DEVICE_CAP_TABLET_PAD)) - printf("P"); - if (libinput_device_has_capability(dev, - LIBINPUT_DEVICE_CAP_SWITCH)) - printf("S"); - - if (libinput_device_get_size(dev, &w, &h) == 0) - printf(" size %.0fx%.0fmm", w, h); if (libinput_device_config_tap_get_finger_count(dev)) { printf(" tap"); @@ -261,6 +216,59 @@ print_device_notify(struct libinput_event *ev) nrings, ngroups); } +} + +static void +print_device_notify(struct libinput_event *ev) +{ + struct libinput_device *dev = libinput_event_get_device(ev); + struct libinput_seat *seat = libinput_device_get_seat(dev); + struct libinput_device_group *group; + double w, h; + static int next_group_id = 0; + intptr_t group_id; + + group = libinput_device_get_device_group(dev); + group_id = (intptr_t)libinput_device_group_get_user_data(group); + if (!group_id) { + group_id = ++next_group_id; + libinput_device_group_set_user_data(group, (void*)group_id); + } + + printf("%-33s %5s %7s group%-2d", + libinput_device_get_name(dev), + libinput_seat_get_physical_name(seat), + libinput_seat_get_logical_name(seat), + (int)group_id); + + printf(" cap:"); + if (libinput_device_has_capability(dev, + LIBINPUT_DEVICE_CAP_KEYBOARD)) + printf("k"); + if (libinput_device_has_capability(dev, + LIBINPUT_DEVICE_CAP_POINTER)) + printf("p"); + if (libinput_device_has_capability(dev, + LIBINPUT_DEVICE_CAP_TOUCH)) + printf("t"); + if (libinput_device_has_capability(dev, + LIBINPUT_DEVICE_CAP_GESTURE)) + printf("g"); + if (libinput_device_has_capability(dev, + LIBINPUT_DEVICE_CAP_TABLET_TOOL)) + printf("T"); + if (libinput_device_has_capability(dev, + LIBINPUT_DEVICE_CAP_TABLET_PAD)) + printf("P"); + if (libinput_device_has_capability(dev, + LIBINPUT_DEVICE_CAP_SWITCH)) + printf("S"); + + if (libinput_device_get_size(dev, &w, &h) == 0) + printf(" size %.0fx%.0fmm", w, h); + + if (libinput_event_get_type(ev) == LIBINPUT_EVENT_DEVICE_ADDED) + print_device_options(dev); printf("\n"); |