diff options
author | Filipe Laíns <lains@riseup.net> | 2021-06-24 16:36:51 +0100 |
---|---|---|
committer | Filipe Laíns <lains@riseup.net> | 2021-06-24 16:36:51 +0100 |
commit | 29661c641bc39a9c6e404642ad97c5b1bc8acd58 (patch) | |
tree | e79416e6ce007fae86043bd382f7312e42fca27c /examples | |
parent | fa44c97731391f9923178eda754e5de54d70006d (diff) |
examples: add print hidraw example
Signed-off-by: Filipe Laíns <lains@riseup.net>
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/print-hidraw.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/print-hidraw.py b/examples/print-hidraw.py new file mode 100755 index 0000000..f75b31a --- /dev/null +++ b/examples/print-hidraw.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python +import sys + +import ioctl.hidraw + + +if __name__ == '__main__': + if len(sys.argv) < 2: + print(f'usage: {sys.argv[0]} /dev/hidrawX') + exit(1) + + d = ioctl.hidraw.Hidraw(sys.argv[1]) + + print(f'Name: {d.name}') + print(f'Device Info: {", ".join(hex(value) for value in d.info)}') + print(f'Physical Name: {d.phys}') + print(f'Unique Name: {d.uniq or "None"}') + print(f'Report Descriptor Size: {d.report_descriptor_size}') + print(f'Report Descriptor: {d.report_descriptor}') |