diff options
-rw-r--r-- | include/evemu.h | 9 | ||||
-rw-r--r-- | src/evemu.c | 5 |
2 files changed, 14 insertions, 0 deletions
diff --git a/include/evemu.h b/include/evemu.h index 4f4db55..790b14a 100644 --- a/include/evemu.h +++ b/include/evemu.h @@ -288,6 +288,15 @@ int evemu_has_prop(const struct evemu_device *dev, int code); int evemu_has_event(const struct evemu_device *dev, int type, int code); /** + * evemu_has_bit() - check if a device has a certain EV_* bit set + * @dev: the device in use + * @type: the EV_* bit to query + * + * Returns true if the event bit is supported by the device. + */ +int evemu_has_bit(const struct evemu_device *dev, int type); + +/** * evemu_extract() - configure evemu instance directly from the kernel device * @dev: the device in use * @fd: file descriptor of the kernel device to query diff --git a/src/evemu.c b/src/evemu.c index 7301855..267e846 100644 --- a/src/evemu.c +++ b/src/evemu.c @@ -234,6 +234,11 @@ int evemu_has_event(const struct evemu_device *dev, int type, int code) return (dev->mask[type][code >> 3] >> (code & 7)) & 1; } +int evemu_has_bit(const struct evemu_device *dev, int type) +{ + return (dev->mask[0][type >> 3] >> (type & 7)) & 1; +} + int evemu_extract(struct evemu_device *dev, int fd) { unsigned long bits[64]; |