mirror of
https://gitlab.freedesktop.org/libevdev/libevdev.git
synced 2025-12-21 12:00:06 +01:00
Export version fields as well
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
e8e4bc37c7
commit
a98c9b3bee
5 changed files with 46 additions and 3 deletions
|
|
@ -54,6 +54,7 @@ struct libevdev {
|
||||||
|
|
||||||
char name[MAX_NAME];
|
char name[MAX_NAME];
|
||||||
struct input_id ids;
|
struct input_id ids;
|
||||||
|
int driver_version;
|
||||||
unsigned long bits[NLONGS(EV_CNT)];
|
unsigned long bits[NLONGS(EV_CNT)];
|
||||||
unsigned long props[NLONGS(INPUT_PROP_CNT)];
|
unsigned long props[NLONGS(INPUT_PROP_CNT)];
|
||||||
unsigned long key_bits[NLONGS(KEY_CNT)];
|
unsigned long key_bits[NLONGS(KEY_CNT)];
|
||||||
|
|
|
||||||
|
|
@ -220,6 +220,10 @@ libevdev_set_fd(struct libevdev* dev, int fd)
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
rc = ioctl(fd, EVIOCGVERSION, &dev->driver_version);
|
||||||
|
if (rc < 0)
|
||||||
|
goto out;
|
||||||
|
|
||||||
rc = ioctl(fd, EVIOCGPROP(sizeof(dev->props)), dev->props);
|
rc = ioctl(fd, EVIOCGPROP(sizeof(dev->props)), dev->props);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
@ -599,6 +603,16 @@ int libevdev_get_bustype(const struct libevdev *dev)
|
||||||
return dev->ids.bustype;
|
return dev->ids.bustype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int libevdev_get_version(const struct libevdev *dev)
|
||||||
|
{
|
||||||
|
return dev->ids.version;
|
||||||
|
}
|
||||||
|
|
||||||
|
int libevdev_get_driver_version(const struct libevdev *dev)
|
||||||
|
{
|
||||||
|
return dev->driver_version;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
libevdev_has_property(const struct libevdev *dev, unsigned int prop)
|
libevdev_has_property(const struct libevdev *dev, unsigned int prop)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -201,6 +201,20 @@ int libevdev_get_vendor_id(const struct libevdev *dev);
|
||||||
*/
|
*/
|
||||||
int libevdev_get_bustype(const struct libevdev *dev);
|
int libevdev_get_bustype(const struct libevdev *dev);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The device's firmware version
|
||||||
|
*
|
||||||
|
* @note This function is signal-safe.
|
||||||
|
*/
|
||||||
|
int libevdev_get_version(const struct libevdev *dev);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The driver version for this device
|
||||||
|
*
|
||||||
|
* @note This function is signal-safe.
|
||||||
|
*/
|
||||||
|
int libevdev_get_driver_version(const struct libevdev *dev);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return 1 if the device supports this event type, or 0 otherwise.
|
* @return 1 if the device supports this event type, or 0 otherwise.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,8 @@ libevdev_get_name(3)
|
||||||
NAME
|
NAME
|
||||||
----
|
----
|
||||||
|
|
||||||
libevdev_get_name, libevdev_get_product_id, libevdev_get_vendor_id, libevdev_get_bustype - retreive information about this device
|
libevdev_get_name, libevdev_get_product_id, libevdev_get_vendor_id,
|
||||||
|
libevdev_get_bustype, libevdev_get_version, libevdev_get_driver_version - retreive information about this device
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
|
|
@ -19,6 +20,10 @@ int libevdev_get_vendor_id(const struct libevdev *dev);
|
||||||
|
|
||||||
int libevdev_get_bustype(const struct libevdev *dev);
|
int libevdev_get_bustype(const struct libevdev *dev);
|
||||||
|
|
||||||
|
int libevdev_get_version(const struct libevdev *dev);
|
||||||
|
|
||||||
|
int libevdev_get_driver_version(const struct libevdev *dev);
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
|
@ -30,6 +35,11 @@ product and vendor ID as set by the kernel.
|
||||||
|
|
||||||
*libevdev_get_bustype* returns the numeric bus type as set by the kernel.
|
*libevdev_get_bustype* returns the numeric bus type as set by the kernel.
|
||||||
|
|
||||||
|
*libevdev_get_version* returns the firmware or driver version.
|
||||||
|
|
||||||
|
*libevdev_get_driver_version* returns the version of the evdev kernel
|
||||||
|
driver.
|
||||||
|
|
||||||
PARAMETERS
|
PARAMETERS
|
||||||
----------
|
----------
|
||||||
*dev*::
|
*dev*::
|
||||||
|
|
@ -40,8 +50,11 @@ RETURN VALUE
|
||||||
*libevdev_get_name* returns a const pointer to the device name.
|
*libevdev_get_name* returns a const pointer to the device name.
|
||||||
|
|
||||||
*libevdev_get_product_id*, *libevdev_get_vendor_id* and
|
*libevdev_get_product_id*, *libevdev_get_vendor_id* and
|
||||||
*libevdev_get_bustype* return the numeric product ID, vendor ID, or bus
|
*libevdev_get_bustype*, *libevdev_get_version* return the numeric product
|
||||||
type.
|
ID, vendor ID, bus type or version.
|
||||||
|
|
||||||
|
*libevdev_get_driver_version* returns the version of the evdev kernel
|
||||||
|
driver.
|
||||||
|
|
||||||
SEE ALSO
|
SEE ALSO
|
||||||
--------
|
--------
|
||||||
|
|
|
||||||
|
|
@ -135,6 +135,7 @@ main(int argc, char **argv)
|
||||||
libevdev_get_bustype(dev),
|
libevdev_get_bustype(dev),
|
||||||
libevdev_get_vendor_id(dev),
|
libevdev_get_vendor_id(dev),
|
||||||
libevdev_get_product_id(dev));
|
libevdev_get_product_id(dev));
|
||||||
|
printf("Evdev version: %x\n", libevdev_get_driver_version(dev));
|
||||||
printf("Input device name: \"%s\"\n", libevdev_get_name(dev));
|
printf("Input device name: \"%s\"\n", libevdev_get_name(dev));
|
||||||
print_bits(dev);
|
print_bits(dev);
|
||||||
print_props(dev);
|
print_props(dev);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue