tools: print the rotation angle in libinput-list-devices

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2016-05-30 15:19:37 +10:00
parent 7aa6b40f31
commit e3e8d83457

View file

@ -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");
}