mirror of
https://gitlab.freedesktop.org/libevdev/libevdev.git
synced 2026-01-03 02:10:12 +01:00
tools: print the hwdb match line from the dpi tool
Let's make this as easy as possible Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
bb406fe411
commit
6ce23c6d79
1 changed files with 28 additions and 0 deletions
|
|
@ -183,6 +183,24 @@ print_summary(struct measurements *m)
|
|||
}
|
||||
}
|
||||
|
||||
static inline const char*
|
||||
bustype(int bustype)
|
||||
{
|
||||
const char *bus;
|
||||
|
||||
switch(bustype) {
|
||||
case BUS_PCI: bus = "pci"; break;
|
||||
case BUS_ISAPNP: bus = "isapnp"; break;
|
||||
case BUS_USB: bus = "usb"; break;
|
||||
case BUS_HIL: bus = "hil"; break;
|
||||
case BUS_BLUETOOTH: bus = "bluetooth"; break;
|
||||
case BUS_VIRTUAL: bus = "virtual"; break;
|
||||
default: bus = "unknown bus type"; break;
|
||||
}
|
||||
|
||||
return bus;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv) {
|
||||
int rc;
|
||||
|
|
@ -228,6 +246,16 @@ main (int argc, char **argv) {
|
|||
|
||||
print_summary(&measurements);
|
||||
|
||||
printf("\n");
|
||||
printf("Entry for hwdb match (replace XXX with the resolution in DPI):\n"
|
||||
"mouse:%s:v%4xp%4x:name:%s:\n"
|
||||
" MOUSE_DPI=XXX@%d\n",
|
||||
bustype(libevdev_get_id_bustype(dev)),
|
||||
libevdev_get_id_vendor(dev),
|
||||
libevdev_get_id_product(dev),
|
||||
libevdev_get_name(dev),
|
||||
(int)measurements.frequency);
|
||||
|
||||
libevdev_free(dev);
|
||||
close(fd);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue