tools/record: print bus name

A follow up on commit 65eaabf91f ("tools/record: print the vid/pid
with proper 4 hex digits").

Print the bus name in addition to the bus ID. Only the busses available
in quirks are printed.

Example:

    $ sudo libinput record
    [...]
    # ID: bus 0x0003 (usb) vendor 0x046d product 0x406d version 0x0111
    [...]

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
This commit is contained in:
José Expósito 2023-09-01 16:21:15 +02:00
parent 53517dccb8
commit 973c461d4b

View file

@ -1486,12 +1486,37 @@ static void
print_description(FILE *fp, struct libevdev *dev)
{
const struct input_absinfo *x, *y;
int bustype;
const char *busname;
bustype = libevdev_get_id_bustype(dev);
switch (bustype) {
case BUS_USB:
busname = " (usb) ";
break;
case BUS_BLUETOOTH:
busname = " (bluetooth) ";
break;
case BUS_I2C:
busname = " (i2c) ";
break;
case BUS_SPI:
busname = " (spi) ";
break;
case BUS_RMI:
busname = " (rmi) ";
break;
default:
busname = " ";
break;
}
iprintf(fp, I_EVDEV, "# Name: %s\n", libevdev_get_name(dev));
iprintf(fp,
I_EVDEV,
"# ID: bus 0x%04x vendor 0x%04x product 0x%04x version 0x%04x\n",
libevdev_get_id_bustype(dev),
"# ID: bus 0x%04x%svendor 0x%04x product 0x%04x version 0x%04x\n",
bustype,
busname,
libevdev_get_id_vendor(dev),
libevdev_get_id_product(dev),
libevdev_get_id_version(dev));