mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-25 11:40:06 +01:00
Introduce libinput_device_get_sysname() API
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
This commit is contained in:
parent
8ac43ac5b8
commit
1dad790a7f
5 changed files with 34 additions and 1 deletions
|
|
@ -617,6 +617,7 @@ register_device_capabilities(struct evdev_device *device)
|
|||
struct evdev_device *
|
||||
evdev_device_create(struct libinput_seat *seat,
|
||||
const char *devnode,
|
||||
const char *sysname,
|
||||
int fd)
|
||||
{
|
||||
struct libinput *libinput = seat->libinput;
|
||||
|
|
@ -633,6 +634,7 @@ evdev_device_create(struct libinput_seat *seat,
|
|||
device->is_mt = 0;
|
||||
device->mtdev = NULL;
|
||||
device->devnode = strdup(devnode);
|
||||
device->sysname = strdup(sysname);
|
||||
device->mt.slot = -1;
|
||||
device->rel.dx = 0;
|
||||
device->rel.dy = 0;
|
||||
|
|
@ -686,6 +688,12 @@ evdev_device_get_output(struct evdev_device *device)
|
|||
return device->output_name;
|
||||
}
|
||||
|
||||
const char *
|
||||
evdev_device_get_sysname(struct evdev_device *device)
|
||||
{
|
||||
return device->sysname;
|
||||
}
|
||||
|
||||
void
|
||||
evdev_device_calibrate(struct evdev_device *device, float calibration[6])
|
||||
{
|
||||
|
|
@ -749,5 +757,6 @@ evdev_device_destroy(struct evdev_device *device)
|
|||
|
||||
free(device->devname);
|
||||
free(device->devnode);
|
||||
free(device->sysname);
|
||||
free(device);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ struct evdev_device {
|
|||
struct evdev_dispatch *dispatch;
|
||||
char *output_name;
|
||||
char *devnode;
|
||||
char *sysname;
|
||||
char *devname;
|
||||
int fd;
|
||||
struct {
|
||||
|
|
@ -132,6 +133,7 @@ struct evdev_dispatch {
|
|||
struct evdev_device *
|
||||
evdev_device_create(struct libinput_seat *seat,
|
||||
const char *devnode,
|
||||
const char *sysname,
|
||||
int fd);
|
||||
|
||||
struct evdev_dispatch *
|
||||
|
|
@ -149,6 +151,9 @@ evdev_device_get_keys(struct evdev_device *device, char *keys, size_t size);
|
|||
const char *
|
||||
evdev_device_get_output(struct evdev_device *device);
|
||||
|
||||
const char *
|
||||
evdev_device_get_sysname(struct evdev_device *device);
|
||||
|
||||
void
|
||||
evdev_device_calibrate(struct evdev_device *device, float calibration[6]);
|
||||
|
||||
|
|
|
|||
|
|
@ -927,6 +927,12 @@ libinput_device_get_user_data(struct libinput_device *device)
|
|||
return device->user_data;
|
||||
}
|
||||
|
||||
LIBINPUT_EXPORT const char *
|
||||
libinput_device_get_sysname(struct libinput_device *device)
|
||||
{
|
||||
return evdev_device_get_sysname((struct evdev_device *) device);
|
||||
}
|
||||
|
||||
LIBINPUT_EXPORT const char *
|
||||
libinput_device_get_output_name(struct libinput_device *device)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -636,6 +636,17 @@ libinput_device_set_user_data(struct libinput_device *device, void *user_data);
|
|||
void *
|
||||
libinput_device_get_user_data(struct libinput_device *device);
|
||||
|
||||
/**
|
||||
* @ingroup device
|
||||
*
|
||||
* Get the system name of the device.
|
||||
*
|
||||
* @param device A previously obtained device
|
||||
* @return System name of the device
|
||||
*/
|
||||
const char *
|
||||
libinput_device_get_sysname(struct libinput_device *device);
|
||||
|
||||
/**
|
||||
* @ingroup device
|
||||
*
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ device_added(struct udev_device *udev_device, struct udev_input *input)
|
|||
struct libinput *libinput = &input->base;
|
||||
struct evdev_device *device;
|
||||
const char *devnode;
|
||||
const char *sysname;
|
||||
const char *device_seat, *seat_name, *output_name;
|
||||
const char *calibration_values;
|
||||
int fd;
|
||||
|
|
@ -58,6 +59,7 @@ device_added(struct udev_device *udev_device, struct udev_input *input)
|
|||
return 0;
|
||||
|
||||
devnode = udev_device_get_devnode(udev_device);
|
||||
sysname = udev_device_get_sysname(udev_device);
|
||||
|
||||
/* Search for matching logical seat */
|
||||
seat_name = udev_device_get_property_value(udev_device, "WL_SEAT");
|
||||
|
|
@ -78,7 +80,7 @@ device_added(struct udev_device *udev_device, struct udev_input *input)
|
|||
return 0;
|
||||
}
|
||||
|
||||
device = evdev_device_create(&seat->base, devnode, fd);
|
||||
device = evdev_device_create(&seat->base, devnode, sysname, fd);
|
||||
if (device == EVDEV_UNHANDLED_DEVICE) {
|
||||
close_restricted(libinput, fd);
|
||||
log_info("not using input device '%s'.\n", devnode);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue