summaryrefslogtreecommitdiff
path: root/ioctl
diff options
context:
space:
mode:
authorFilipe Laíns <lains@archlinux.org>2020-08-10 20:42:00 +0100
committerFilipe Laíns <lains@archlinux.org>2020-08-10 20:42:31 +0100
commit2e556a670664335eae46866f598c924501fd95ce (patch)
tree57c42d5d52e888ae2f7fe662326abc5bbf27b7e1 /ioctl
parent1dc57ea0e5088e34e7611baa8e2af2654bd846c7 (diff)
hidraw: add support for uniq
Signed-off-by: Filipe Laíns <lains@archlinux.org>
Diffstat (limited to 'ioctl')
-rw-r--r--ioctl/hidraw.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/ioctl/hidraw.py b/ioctl/hidraw.py
index d72ec33..1d70012 100644
--- a/ioctl/hidraw.py
+++ b/ioctl/hidraw.py
@@ -46,6 +46,7 @@ class Hidraw(object):
HIDIOCGRAWPHYS = 0x05
HIDIOCSFEATURE = 0x06
HIDIOCGFEATURE = 0x07
+ HIDIOCGRAWUNIQ = 0x08
HID_NAME_SIZE = 1024
@@ -131,4 +132,13 @@ class Hidraw(object):
'H', self.HIDIOCGRAWPHYS, self.HID_NAME_SIZE
).perform(self._fd).decode('utf-8').strip('\x00')
- # TODO: HIDIOCSFEATURE, HIDIOCGFEATURE, HIDIOCGRAWUNIQ
+ @property
+ def uniq(self) -> str:
+ '''
+ Unique name of the hidraw node
+ '''
+ return ioctl.IOCTL.IOR(
+ 'H', self.HIDIOCGRAWUNIQ, self.HID_NAME_SIZE
+ ).perform(self._fd).decode('utf-8').strip('\x00')
+
+ # TODO: HIDIOCSFEATURE, HIDIOCGFEATURE