summaryrefslogtreecommitdiff
path: root/examples/print-hidraw.py
blob: f75b31ac898e4d4583764bc4d9f65256371388ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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}')