Skip to content

Commit fd83731

Browse files
committed
add hid report printing from hid-tools
1 parent 6e09a14 commit fd83731

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+4876
-3
lines changed

MANIFEST.in

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
recursive-include src/hhd *.yml
22
recursive-include src/hhd *.yaml
33
recursive-include src/hhd *.mo
4+
recursive-include src/hhd *.hut
5+
46
graft usr/
57
graft src/hhd/http/static
68
include src/hhd/http/index.html

src/hhd/contrib/dev.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,12 @@ def hidraw(dev: str | None):
141141
sel = f"/dev/hidraw{int(dev)}".encode()
142142
except Exception:
143143
sel = dev.encode()
144-
if sel not in avail:
144+
if sel not in avail or not sel:
145145
print(f"Device '{sel.decode()}' not found.")
146146
return
147147
else:
148148
sel = None
149-
while sel not in avail:
149+
while not sel or sel not in avail:
150150
try:
151151
sel = input("Enter device path (/dev/hidraw# or #): ")
152152
except EOFError:
@@ -158,7 +158,16 @@ def hidraw(dev: str | None):
158158
print()
159159

160160
d = Device(path=sel)
161-
print(f"Selected device `{str(sel)}`.")
161+
162+
try:
163+
from .hid_desc import print_descriptor
164+
print('\nDevice Descriptor:')
165+
print_descriptor(d.fd)
166+
except Exception as e:
167+
print(f"Could not get descriptor:\n{e}")
168+
169+
print()
170+
print(f"Selected device `{sel.decode()}`.")
162171

163172
start = perf_counter()
164173
prev = 0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
(00) Undefined
2+
00 Undefined
3+
01-FFFF Reserved
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
(01) Generic Desktop
2+
00 Undefined
3+
01 Pointer
4+
02 Mouse
5+
03 Reserved
6+
04 Joystick
7+
05 Game Pad
8+
06 Keyboard
9+
07 Keypad
10+
08 Multi Axis
11+
09 Reserved
12+
0A Water Cooling Device
13+
0B Computer Chassis Device
14+
0C Wireless Radio Controls
15+
0D Portable Device Control
16+
0E System Multi-Axis Controller
17+
0F Spatial Controller
18+
10 Assistive Control
19+
11-2F Reserved
20+
30 X
21+
31 Y
22+
32 Z
23+
33 Rx
24+
34 Ry
25+
35 Rz
26+
36 Slider
27+
37 Dial
28+
38 Wheel
29+
39 Hat switch
30+
3A Counted Buffer
31+
3B Byte Count
32+
3C Motion
33+
3D Start
34+
3E Select
35+
3F Reserved
36+
40 Vx
37+
41 Vy
38+
42 Vz
39+
43 Vbrx
40+
44 Vbry
41+
45 Vbrz
42+
46 Vno
43+
47 Feature
44+
48 Resolution Multiplier
45+
49 Qx
46+
4A Qy
47+
4B Qz
48+
4C Qw
49+
4D-7F Reserved
50+
80 System Control
51+
81 System Power Down
52+
82 System Sleep
53+
83 System Wake Up
54+
84 System Context Menu
55+
85 System Main Menu
56+
86 System App Menu
57+
87 System Help Menu
58+
88 System Menu Exit
59+
89 System Menu Select
60+
8A System Menu Right
61+
8B System Menu Left
62+
8C System Menu Up
63+
8D System Menu Down
64+
8E System Cold Restart
65+
8F System Warm Restart
66+
90 D-Pad Up
67+
91 D-Pad Down
68+
92 D-Pad Right
69+
93 D-Pad Left
70+
94 Index Trigger
71+
95 Palm Trigger
72+
96 Thumbstick
73+
97 System Function Shift
74+
98 System Function Shift Lock
75+
99 System Function Shift Lock Indicator
76+
9A System Dismiss Notification
77+
9B-9F Reserved
78+
A0 System Dock
79+
A1 System UnDock
80+
A2 System Setup
81+
A3 System Break
82+
A4 System Debugger Break
83+
A5 Application Break
84+
A6 Application Debugger Break
85+
A7 System Speaker Mute
86+
A8 System Hibernate
87+
A9-AF Reserved
88+
B0 System Display Invert
89+
B1 System Display Internal
90+
B2 System Display External
91+
B3 System Display Both
92+
B4 System Display Dual
93+
B5 System Display Toggle Internal External
94+
B6 System Display Swap Primary Secondary
95+
B7 System Display LCDAuto Scale
96+
B8-BF Reserved
97+
C0 Sensor Zone
98+
C1 RPM
99+
C2 Coolant Level
100+
C3 Coolant Critical Level
101+
C4 Coolant Pump
102+
C5 Chassis Enclosure
103+
C6 Wireless Radio Button
104+
C7 Wireless Radio LED
105+
C8 Wireless Radio Slider Switch
106+
C9 System Display Rotation Lock Button
107+
CA System Display Rotation Lock Slider Switch
108+
CB Control Enable
109+
CC-FFFF Reserved
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
(02) Simulation Controls
2+
00 Undefined
3+
01 Flight Simulation Device
4+
02 Automobile Simulation Device
5+
03 Tank Simulation Device
6+
04 Spaceship Simulation Device
7+
05 Submarine Simulation Device
8+
06 Sailing Simulation Device
9+
07 Motorcycle Simulation Device
10+
08 Sports Simulation Device
11+
09 Airplane Simulation Device
12+
0A Helicopter Simulation Device
13+
0B Magic Carpet Simulation Device
14+
0C Bicycle
15+
0D-1F reserved
16+
20 Flight Control Stick
17+
21 Flight Stick
18+
22 Cyclic Control
19+
23 Cyclic Trim
20+
24 Flight Yoke
21+
25 Track Control
22+
26 Driving Control
23+
27-CF reserved
24+
B0 Aileron
25+
B1 Aileron Trim
26+
B2 Anti-Torque Control
27+
B3 Auto-pilot enable
28+
B4 Chaff Release
29+
B5 Collective Control
30+
B6 Dive Brake
31+
B7 Electronic Counter Measures
32+
B8 Elevator
33+
B9 Elevator Trim
34+
BA Rudder
35+
BB Throttle
36+
BC Flight Communication
37+
BD Flare Release
38+
BE Landing Gear
39+
BF Toe Brake
40+
C0 Trigger
41+
C1 Weapons Arm
42+
C2 Weapons Select
43+
C3 Wing Flaps
44+
C4 Accelerator
45+
C5 Brake
46+
C6 Clutch
47+
C7 Shifter
48+
C8 Steering
49+
C9 Turret Direction
50+
CA Barrel Elevation
51+
CB Dive Plane
52+
CC Ballast
53+
CD Bicycle Crank
54+
CE Handle Bars
55+
CF Front Brake
56+
D0 Rear Brake
57+
D1-FFFF reserved
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
(03) VR Controls
2+
00 Unidentified
3+
01 Belt
4+
02 Body Suit
5+
03 Flexor
6+
04 Glove
7+
05 Head Tracker
8+
06 Head Mounted Display
9+
07 Hand Tracker
10+
08 Oculometer
11+
09 Vest
12+
0A Animatronic Device
13+
0B-1F Reserved
14+
20 Stereo Enable
15+
21 Display Enable
16+
22-FFFF Reserved
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
(04) Sports Controls
2+
00 Unidentified
3+
01 Baseball Bat
4+
02 Golf Club
5+
03 Rowing Machine
6+
04 Treadmill
7+
05-2F Reserved
8+
30 Oar
9+
31 Slope
10+
32 Rate
11+
33 Stick Speed
12+
34 Stick Face Angle
13+
35 Stick Heel/Toe
14+
36 Stick Follow Through
15+
37 Stick Tempo
16+
38 Stick Type
17+
39 Stick Height
18+
3A-4F Reserved
19+
50 Putter
20+
51 1 Iron
21+
52 2 Iron
22+
53 3 Iron
23+
54 4 Iron
24+
55 5 Iron
25+
56 6 Iron
26+
57 7 Iron
27+
58 8 Iron
28+
59 9 Iron
29+
5A 10 Iron
30+
5B 11 Iron
31+
5C Sand Wedge
32+
5D Loft Wedge
33+
5E Power Wedge
34+
5F 1 Wood
35+
60 3 Wood
36+
61 5 Wood
37+
62 7 Wood
38+
63 9 Wood
39+
64-FFFF Reserved
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
(05) Gaming Controls
2+
00 Undefined
3+
01 3D Game Controller
4+
02 Pinball Device
5+
03 Gun Device
6+
04-1F Reserved
7+
20 Point of View
8+
21 Turn Right/Left
9+
22 Pitch Forward/Backward
10+
23 Roll Right/Left
11+
24 Move Right/Left
12+
25 Move Forward/Backward
13+
26 Move Up/Down
14+
27 Lean Right/Left
15+
28 Lean Forward/Backward
16+
29 Height of POV
17+
2A Flipper
18+
2B Secondary Flipper
19+
2C Bump
20+
2D New Game
21+
2E Shoot Ball
22+
2F Player
23+
30 Gun Bolt
24+
31 Gun Clip
25+
32 Gun Selector
26+
33 Gun Single Shot
27+
34 Gun Burst
28+
35 Gun Automatic
29+
36 Gun Safety
30+
37 Gamepad Fire/Jump
31+
38 Reserved
32+
39 Gamepad Trigger
33+
3A Form-fitting gamepad
34+
3B-FFFF Reserved
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
(06) Generic Device Controls
2+
00 Unidentified
3+
01 Background Controls
4+
02-1F Reserved
5+
20 Battery Strength
6+
21 Wireless Channel
7+
22 Wireless ID
8+
23 Discover Wireless Control
9+
24 Security Code Character Entered
10+
25 Security Code Character Erased
11+
26 Security Code Cleared
12+
27 Sequence ID
13+
28 Sequence ID Reset
14+
29 RF Signal Strength
15+
2A Software Version
16+
2B Protocol Version
17+
2C Hardware Version
18+
2D Major
19+
2E Minor
20+
2F Revision
21+
30 Handedness
22+
31 Either Hand
23+
32 Left Hand
24+
33 Right Hand
25+
34 Both Hands
26+
35-3F Reserved
27+
40 Grip Pose Offset
28+
41 Pointer Pose Offset
29+
42-FFFF Reserved

0 commit comments

Comments
 (0)