blob: ed4392004dc35fb43e96f89eac00e32b78759cc1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#!/usr/bin/python3
import argparse
import contextlib
import evdev
import json
import sys
parser = argparse.ArgumentParser()
parser.add_argument('device')
args = parser.parse_args(sys.argv[1:])
with contextlib.closing(evdev.InputDevice(args.device)) as device:
out = {}
out['linux-evdev-device-desc'] = 0
out['name'] = device.name
info = {}
info['bustype'] = device.info.bustype
info['vendor'] = device.info.vendor
info['product'] = device.info.product
info['version'] = device.info.version
out['info'] = info
out['capabilities'] = device.capabilities()
# TODO: LEDs
json.dump(out, sys.stdout, indent = 4)
|