From e3e8d834578dfedc379b6828202f10c86e2a2741 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 30 May 2016 15:19:37 +1000 Subject: [PATCH] tools: print the rotation angle in libinput-list-devices Signed-off-by: Peter Hutterer --- tools/libinput-list-devices.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tools/libinput-list-devices.c b/tools/libinput-list-devices.c index 7683c3f6..24943cf9 100644 --- a/tools/libinput-list-devices.c +++ b/tools/libinput-list-devices.c @@ -225,6 +225,22 @@ dwt_default(struct libinput_device *device) return "disabled"; } +static char * +rotation_default(struct libinput_device *device) +{ + char *str; + double angle; + + if (!libinput_device_config_rotation_is_available(device)) { + xasprintf(&str, "n/a"); + return str; + } + + angle = libinput_device_config_rotation_get_angle(device); + xasprintf(&str, "%.1f", angle); + return str; +} + static void print_device_notify(struct libinput_event *ev) { @@ -298,6 +314,10 @@ print_device_notify(struct libinput_event *ev) printf("Accel profiles: %s\n", str); free(str); + str = rotation_default(dev); + printf("Rotation: %s\n", str); + free(str); + printf("\n"); }