mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-08 11:40:15 +01:00
Add libinput_device_get_id_bustype()
Allow to get the device bus type ID in addition to its vid and pid. Closes: https://gitlab.freedesktop.org/libinput/libinput/-/issues/975 Signed-off-by: José Expósito <jose.exposito89@gmail.com> Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/977>
This commit is contained in:
parent
7ac26ed9c2
commit
a43f1edbfe
6 changed files with 33 additions and 1 deletions
|
|
@ -2517,6 +2517,12 @@ evdev_device_get_name(struct evdev_device *device)
|
|||
return device->devname;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
evdev_device_get_id_bustype(struct evdev_device *device)
|
||||
{
|
||||
return libevdev_get_id_bustype(device->evdev);
|
||||
}
|
||||
|
||||
unsigned int
|
||||
evdev_device_get_id_product(struct evdev_device *device)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -473,6 +473,9 @@ evdev_device_get_sysname(struct evdev_device *device);
|
|||
const char *
|
||||
evdev_device_get_name(struct evdev_device *device);
|
||||
|
||||
unsigned int
|
||||
evdev_device_get_id_bustype(struct evdev_device *device);
|
||||
|
||||
unsigned int
|
||||
evdev_device_get_id_product(struct evdev_device *device);
|
||||
|
||||
|
|
|
|||
|
|
@ -3304,6 +3304,12 @@ libinput_device_get_name(struct libinput_device *device)
|
|||
return evdev_device_get_name((struct evdev_device *) device);
|
||||
}
|
||||
|
||||
LIBINPUT_EXPORT unsigned int
|
||||
libinput_device_get_id_bustype(struct libinput_device *device)
|
||||
{
|
||||
return evdev_device_get_id_bustype((struct evdev_device *) device);
|
||||
}
|
||||
|
||||
LIBINPUT_EXPORT unsigned int
|
||||
libinput_device_get_id_product(struct libinput_device *device)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4197,6 +4197,19 @@ libinput_device_get_sysname(struct libinput_device *device);
|
|||
const char *
|
||||
libinput_device_get_name(struct libinput_device *device);
|
||||
|
||||
/**
|
||||
* @ingroup device
|
||||
*
|
||||
* Get the bus type ID for this device.
|
||||
*
|
||||
* @param device A previously obtained device
|
||||
* @return The bus type ID of this device (see BUS_* in linux/input.h)
|
||||
*
|
||||
* @since 1.26
|
||||
*/
|
||||
unsigned int
|
||||
libinput_device_get_id_bustype(struct libinput_device *device);
|
||||
|
||||
/**
|
||||
* @ingroup device
|
||||
*
|
||||
|
|
|
|||
|
|
@ -335,6 +335,7 @@ LIBINPUT_1.23 {
|
|||
} LIBINPUT_1.21;
|
||||
|
||||
LIBINPUT_1.26 {
|
||||
libinput_device_get_id_bustype;
|
||||
libinput_device_tablet_pad_get_num_dials;
|
||||
libinput_event_tablet_pad_get_dial_delta_v120;
|
||||
libinput_event_tablet_pad_get_dial_number;
|
||||
|
|
|
|||
|
|
@ -748,14 +748,17 @@ START_TEST(device_ids)
|
|||
{
|
||||
struct litest_device *dev = litest_current_device();
|
||||
const char *name;
|
||||
unsigned int pid, vid;
|
||||
unsigned int bus, pid, vid;
|
||||
|
||||
name = libevdev_get_name(dev->evdev);
|
||||
bus = libevdev_get_id_bustype(dev->evdev);
|
||||
pid = libevdev_get_id_product(dev->evdev);
|
||||
vid = libevdev_get_id_vendor(dev->evdev);
|
||||
|
||||
ck_assert_str_eq(name,
|
||||
libinput_device_get_name(dev->libinput_device));
|
||||
ck_assert_int_eq(bus,
|
||||
libinput_device_get_id_bustype(dev->libinput_device));
|
||||
ck_assert_int_eq(pid,
|
||||
libinput_device_get_id_product(dev->libinput_device));
|
||||
ck_assert_int_eq(vid,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue