diff options
author | Filipe Laíns <lains@archlinux.org> | 2020-08-10 20:27:21 +0100 |
---|---|---|
committer | Filipe Laíns <lains@archlinux.org> | 2020-08-10 20:40:00 +0100 |
commit | 60b7590f674f7fcb8bec1f525a5cb5d52623972e (patch) | |
tree | 5e25d9589a7a236067db07aeae127bb8276c7ef9 | |
parent | e472e588cd027f3058e5663fc8aedf22a01a20e3 (diff) |
hidraw: add support for phys
Signed-off-by: Filipe Laíns <lains@archlinux.org>
-rw-r--r-- | ioctl/hidraw.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/ioctl/hidraw.py b/ioctl/hidraw.py index 13b476c..94cd1b4 100644 --- a/ioctl/hidraw.py +++ b/ioctl/hidraw.py @@ -39,6 +39,7 @@ class Hidraw(object): HIDIOCGRAWPHYS = 0x05 HIDIOCSFEATURE = 0x06 HIDIOCGFEATURE = 0x07 + HIDIOCGRAWUNIQ = 0x08 HID_NAME_SIZE = 1024 @@ -115,4 +116,22 @@ class Hidraw(object): 'H', self.HIDIOCGRAWNAME, self.HID_NAME_SIZE ).perform(self._fd).decode('utf-8').strip('\x00') - # TODO: HIDIOCGRAWPHYS, HIDIOCSFEATURE, HIDIOCGFEATURE, HIDIOCGRAWUNIQ + @property + def phys(self) -> str: + ''' + HID physical name of the hidraw node + ''' + return ioctl.IOCTL.IOR( + 'H', self.HIDIOCGRAWPHYS, self.HID_NAME_SIZE + ).perform(self._fd).decode('utf-8').strip('\x00') + + @property + def uniq(self) -> str: + ''' + HID unique identifier 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 |