These can't work without ... a full HID report descriptor parser.
I am not sure if they are still made? I see used ones up there:Can I buy this Wacom Bambo device on Amazon?
USB Host Testing
sizeof Device = 32
sizeof Pipe = 96
sizeof Transfer = 64
power up USBHS PHY
ISR: 408C
Port Change
port change: 10001803
connect
ISR: 1004088
Timer0
begin reset
ISR: 408C
Port Change
port change: 10001805
port enabled
ISR: 1004080
Timer0
end recovery
new_Device: 12 Mbit/sec
new_Pipe
new_Control_Transfer
ISR: 4E081
USB Async
Async Followup
Followup 1FFF5420 token=80000200
Followup 1FFF5360 token=100
Followup 1FFF53A0 token=8000
enumeration:
new_Control_Transfer
Followup 1FFF53E0 token=80280
Followup 1FFF5420 token=80008180
ISR: 4E081
USB Async
Async Followup
Followup 1FFF53E0 token=80000200
Followup 1FFF5420 token=8100
enumeration:
new_Control_Transfer
Followup 1FFF5360 token=80280
Followup 1FFF2EC0 token=80120180
Followup 1FFF53A0 token=80008080
ISR: 4E081
USB Async
Async Followup
Followup 1FFF5360 token=80000200
Followup 1FFF2EC0 token=100
Followup 1FFF53A0 token=8000
enumeration:
new_Control_Transfer
Followup 1FFF53E0 token=80280
Followup 1FFF5420 token=80FC0180
Followup 1FFF5360 token=80008080
ISR: 4E081
USB Async
Async Followup
Followup 1FFF53E0 token=80000200
Followup 1FFF5420 token=F80100
Followup 1FFF5360 token=8000
enumeration:
new_Control_Transfer
Followup 1FFF2EC0 token=80280
Followup 1FFF53A0 token=80FC0180
Followup 1FFF53E0 token=80008080
ISR: 4E081
USB Async
Async Followup
Followup 1FFF2EC0 token=80000200
Followup 1FFF53A0 token=E40100
Followup 1FFF53E0 token=8000
enumeration:
new_Control_Transfer
Followup 1FFF5420 token=80280
Followup 1FFF5360 token=80FC0180
Followup 1FFF2EC0 token=80008080
ISR: 4E081
USB Async
Async Followup
Followup 1FFF5420 token=80000200
Followup 1FFF5360 token=CC0100
Followup 1FFF2EC0 token=8000
enumeration:
new_Control_Transfer
Followup 1FFF53A0 token=80280
Followup 1FFF53E0 token=80FC0180
Followup 1FFF5420 token=80008080
ISR: 4E081
USB Async
Async Followup
Followup 1FFF53A0 token=80000200
Followup 1FFF53E0 token=EC0100
Followup 1FFF5420 token=8000
enumeration:
new_Control_Transfer
Followup 1FFF5360 token=80280
Followup 1FFF2EC0 token=80090180
Followup 1FFF53A0 token=80008080
ISR: 4E081
USB Async
Async Followup
Followup 1FFF5360 token=80000200
Followup 1FFF2EC0 token=100
Followup 1FFF53A0 token=8000
enumeration:
Config data length = 141
new_Control_Transfer
Followup 1FFF53E0 token=80280
Followup 1FFF5420 token=808D0180
Followup 1FFF5360 token=80008080
ISR: 4E081
USB Async
Async Followup
Followup 1FFF53E0 token=80000200
Followup 1FFF5420 token=100
Followup 1FFF5360 token=8000
enumeration:
bNumInterfaces = 5
bConfigurationValue = 1
new_Control_Transfer
Followup 1FFF2EC0 token=80280
Followup 1FFF53E0 token=80008180
ISR: 4E081
USB Async
Async Followup
Followup 1FFF2EC0 token=80000200
Followup 1FFF53E0 token=8100
enumeration:
USBHub memory usage = 1312
USBHub claim_device this=1FFF2F00
USBHub memory usage = 1312
USBHub claim_device this=1FFF3420
USBHub memory usage = 1312
USBHub claim_device this=1FFF3940
KeyboardController claim this=1FFF2020
KeyboardController claim this=1FFF2220
HIDParser claim this=1FFF3E80
HIDParser claim this=1FFF4220
HIDParser claim this=1FFF2420
HIDParser claim this=1FFF27C0
HIDParser claim this=1FFF2B60
Descriptor 4 = INTERFACE
KeyboardController claim this=1FFF2020
ep = 83
packet size = 8
polling interval = 1
new_Pipe
allocate_interrupt_pipe_bandwidth
best_bandwidth = 3
, at offset = 0, shift= 0
add_qh_to_periodic_schedule:
interval = 1
offset = 0
add to slot 0
add to slot 1
add to slot 2
add to slot 3
add to slot 4
add to slot 5
add to slot 6
add to slot 7
add to slot 8
add to slot 9
add to slot 10
add to slot 11
add to slot 12
add to slot 13
add to slot 14
add to slot 15
add to slot 16
add to slot 17
add to slot 18
add to slot 19
add to slot 20
add to slot 21
add to slot 22
add to slot 23
add to slot 24
add to slot 25
add to slot 26
add to slot 27
add to slot 28
add to slot 29
add to slot 30
add to slot 31
Periodic Schedule:
0: 1FFF2DA0
1: 1FFF2DA0
2: 1FFF2DA0
3: 1FFF2DA0
4: 1FFF2DA0
5: 1FFF2DA0
6: 1FFF2DA0
7: 1FFF2DA0
8: 1FFF2DA0
9: 1FFF2DA0
10: 1FFF2DA0
11: 1FFF2DA0
12: 1FFF2DA0
13: 1FFF2DA0
14: 1FFF2DA0
15: 1FFF2DA0
16: 1FFF2DA0
17: 1FFF2DA0
18: 1FFF2DA0
19: 1FFF2DA0
20: 1FFF2DA0
21: 1FFF2DA0
22: 1FFF2DA0
23: 1FFF2DA0
24: 1FFF2DA0
25: 1FFF2DA0
26: 1FFF2DA0
27: 1FFF2DA0
28: 1FFF2DA0
29: 1FFF2DA0
30: 1FFF2DA0
31: 1FFF2DA0
new_Data_Transfer
new_Control_Transfer
Descriptor 33 = HID
Descriptor 5 = ENDPOINT
Descriptor 4 = INTERFACE
KeyboardController claim this=1FFF2220
HIDParser claim this=1FFF3E80
bInterfaceClass = 3
bInterfaceSubClass = 0
bInterfaceProtocol = 0
report descriptor size = 84
Single endpoint HID:
endpoint = 85
size = 8
interval = 1
*** before new pipe ***
new_Pipe
allocate_interrupt_pipe_bandwidth
best_bandwidth = 5
, at offset = 0, shift= 3
add_qh_to_periodic_schedule:
interval = 1
offset = 0
traverse list 0
traverse list 1
// TODO: does this really make an inverted tree like EHCI figure 4-18, page 93
#include <Bounce.h>
Bounce button2 = Bounce(15, 10);
Bounce button3 = Bounce(16, 10);
Bounce button4 = Bounce(17, 10);
Bounce button5 = Bounce(18, 10);
void setup() {
// put your setup code here, to run once:
pinMode(15, INPUT_PULLUP);
pinMode(16, INPUT_PULLUP);
pinMode(17, INPUT_PULLUP);
pinMode(18, INPUT_PULLUP);
delay(1);
}
void loop() {
button2.update();
button3.update();
button4.update();
button5.update();
if (button3.fallingEdge()) {
Mouse.move(-1, 0); // move Left
}
if (button2.fallingEdge()) {
Mouse.move(1, 0); // move Right
}
if (button5.fallingEdge()) {
Keyboard.press(KEY_B);
}
if (button5.risingEdge()) {
Keyboard.release(KEY_B);
}
if (button4.fallingEdge()) {
Keyboard.press(KEY_MEDIA_PLAY_PAUSE);
}
if (button4.risingEdge()) {
Keyboard.release(KEY_MEDIA_PLAY_PAUSE);
}
}
With PS3 - I believe I read that you also need to tell the PS3 to start sending Report 1 to get it to work...
I think the command bytes is:Code:static const uint8_t ps3_feature_F4_report[] = {0x42, 0x0c, 0x00, 0x00};
I tried a few different things like:
But that appears to crash the USB, so probably wrong...Code:if ((dev->idVendor == 0x54c) && (dev->idProduct == 0x268)) { println("*** Sony PS3"); mk_setup(setup, 0x21, 9, 0x3f4, 0, 4); // ps3 tell it to send report 1? print_hexbytes((uint8_t*)&setup, 8); queue_Control_Transfer(dev, &setup, (void*)ps3_feature_F4_report, this); }
So you have a Joystick subclass I can start working with or should I pick it up from my other branch and adapt it to your HID parser?
If I am reading the code correctly, you are interpreting the HID descriptor with each packet that is received?
Side note: Wonder with Mouse if the method should be: getMouseX(), or maybe getX() or maybe just x()
likewise getButtons, should simply be buttons()
if (joystick1.available()) {
Serial.print("Joystick: buttons = ");
Serial.print(joystick1.getButtons(), HEX);
Serial.print(", X = ");
Serial.print(joystick1.getAxis(0));
Serial.print(", Y = ");
Serial.print(joystick1.getAxis(1));
Serial.print(", RX = ");
Serial.print(joystick1.getAxis(2));
Serial.print(", RY = ");
Serial.print(joystick1.getAxis(5));
Serial.println();
joystick1.joystickDataClear();
}
kurt@kurt-UP-CHT01:~$ sudo usbhid-dump -i0 | grep -v : | xxd -r -p | hidrd-convert -o spec
Usage Page (Desktop), ; Generic desktop controls (01h)
Usage (Gamepad), ; Gamepad (05h, application collection)
Collection (Application),
Report ID (1),
[COLOR="#FF0000"] Usage (X), ; X (30h, dynamic value)
Usage (Y), ; Y (31h, dynamic value)
Usage (Z), ; Z (32h, dynamic value)
Usage (Rz), ; Rz (35h, dynamic value)[/COLOR]
Logical Minimum (0),
Logical Maximum (255),
Report Size (8),
Report Count (4),
[COLOR="#FF0000"] Input (Variable),
Usage (Hat Switch), ; Hat switch (39h, dynamic value)
Logical Minimum (0),
Logical Maximum (7),
Physical Minimum (0),
Physical Maximum (315),
Unit (Degrees),
Report Size (4),
Report Count (1),
Input (Variable, Null State),[/COLOR]
Unit,
Usage Page (Button), ; Button (09h)
Usage Minimum (01h),
Usage Maximum (0Eh),
Logical Minimum (0),
Logical Maximum (1),
Report Size (1),
Report Count (14),
Input (Variable),
Usage Page (FF00h), ; FF00h, vendor-defined
Usage (20h),
Report Size (6),
Report Count (1),
Logical Minimum (0),
Logical Maximum (127),
Input (Variable),
[COLOR="#FF0000"] Usage Page (Desktop), ; Generic desktop controls (01h)
Usage (Rx), ; Rx (33h, dynamic value)
Usage (Ry), ; Ry (34h, dynamic value)[/COLOR]
Logical Minimum (0),
Logical Maximum (255),
Report Size (8),
Report Count (2),
Input (Variable),
Usage Page (FF00h), ; FF00h, vendor-defined
Usage (21h),
Report Count (54),
Input (Variable),
Report ID (5),
...
... How are you feeling about the performance of HID parsing this way, walking the report descriptor every time?
Ordering 4 more HID devices for testing.
https://www.amazon.com/Controller-Joystick-Gamepad-Computer-RECCAZR/dp/B0748JBWFZ
https://www.amazon.com/Guhui-Gamepad-Controller-Joystick-Raspberry/dp/B074SWJPBG
https://www.amazon.com/Perixx-PERIPAD-501II-Professional-Wired-Touchpad/dp/B001CX85I8
https://www.amazon.com/DualShock-Wireless-Controller-PlayStation-Black-4/dp/B01LWVX2RG
(this thread is where I'm keeping notes on all HID testing....)
kurt@kurt-UP-CHT01:~$ sudo usbhid-dump -i0 | grep -v : | xxd -r -p | hidrd-convert -o spec
Usage Page (Desktop), ; Generic desktop controls (01h)
Usage (Gamepad), ; Gamepad (05h, application collection)
Collection (Application),
[COLOR="#FF0000"] Report ID (1),
Usage (X), ; X (30h, dynamic value)
Usage (Y), ; Y (31h, dynamic value)
Usage (Z), ; Z (32h, dynamic value)
Usage (Rz), ; Rz (35h, dynamic value)
Logical Minimum (0),
Logical Maximum (255),
Report Size (8),
Report Count (4),
Input (Variable),
Usage (Hat Switch), ; Hat switch (39h, dynamic value)
Logical Minimum (0),
Logical Maximum (7),
Physical Minimum (0),
Physical Maximum (315),
Unit (Degrees),
Report Size (4),
Report Count (1),
Input (Variable, Null State),
Unit,
Usage Page (Button), ; Button (09h)
Usage Minimum (01h),
Usage Maximum (0Eh),
Logical Minimum (0),
Logical Maximum (1),
Report Size (1),
Report Count (14),
Input (Variable),
Usage Page (FF00h), ; FF00h, vendor-defined
Usage (20h),
Report Size (6),
Report Count (1),
Logical Minimum (0),
Logical Maximum (127),
Input (Variable),
Usage Page (Desktop), ; Generic desktop controls (01h)
Usage (Rx), ; Rx (33h, dynamic value)
Usage (Ry), ; Ry (34h, dynamic value)
Logical Minimum (0),
Logical Maximum (255),
Report Size (8),
Report Count (2),
Input (Variable),
Usage Page (FF00h), ; FF00h, vendor-defined
Usage (21h),
Report Count (54),
Input (Variable),[/COLOR]
Report ID (5),
Usage (22h),
Report Count (31),
Output (Variable),
Report ID (4),
Usage (23h),
Report Count (36),
Feature (Variable),
Report ID (2),
Usage (24h),
Report Count (36),
Feature (Variable),
Report ID (8),
Usage (25h),
Report Count (3),
Feature (Variable),
Report ID (16),
Usage (26h),
Report Count (4),
Feature (Variable),
Report ID (17),
Usage (27h),
Report Count (2),
Feature (Variable),
Report ID (18),
Usage Page (FF02h), ; FF02h, vendor-defined
Usage (21h),
Report Count (15),
Feature (Variable),
Report ID (19),
Usage (22h),
Report Count (22),
Feature (Variable),
Report ID (20),
Usage Page (FF05h), ; FF05h, vendor-defined
Usage (20h),
Report Count (16),
Feature (Variable),
Report ID (21),
Usage (21h),
Report Count (44),
Feature (Variable),
Usage Page (FF80h), ; FF80h, vendor-defined
Report ID (128),
Usage (20h),
Report Count (6),
Feature (Variable),
Report ID (129),
Usage (21h),
Report Count (6),
Feature (Variable),
Report ID (130),
Usage (22h),
Report Count (5),
Feature (Variable),
Report ID (131),
Usage (23h),
Report Count (1),
Feature (Variable),
Report ID (132),
Usage (24h),
Report Count (4),
Feature (Variable),
Report ID (133),
Usage (25h),
Report Count (6),
Feature (Variable),
Report ID (134),
Usage (26h),
Report Count (6),
Feature (Variable),
Report ID (135),
Usage (27h),
Report Count (35),
Feature (Variable),
Report ID (136),
Usage (28h),
Report Count (34),
Feature (Variable),
Report ID (137),
Usage (29h),
Report Count (2),
Feature (Variable),
Report ID (144),
Usage (30h),
Report Count (5),
Feature (Variable),
Report ID (145),
Usage (31h),
Report Count (3),
Feature (Variable),
Report ID (146),
Usage (32h),
Report Count (3),
Feature (Variable),
Report ID (147),
Usage (33h),
Report Count (12),
Feature (Variable),
Report ID (160),
Usage (40h),
Report Count (6),
Feature (Variable),
Report ID (161),
Usage (41h),
Report Count (1),
Feature (Variable),
Report ID (162),
Usage (42h),
Report Count (1),
Feature (Variable),
Report ID (163),
Usage (43h),
Report Count (48),
Feature (Variable),
Report ID (164),
Usage (44h),
Report Count (13),
Feature (Variable),
Report ID (165),
Usage (45h),
Report Count (21),
Feature (Variable),
Report ID (166),
Usage (46h),
Report Count (21),
Feature (Variable),
Report ID (240),
Usage (47h),
Report Count (63),
Feature (Variable),
Report ID (241),
Usage (48h),
Report Count (63),
Feature (Variable),
Report ID (242),
Usage (49h),
Report Count (15),
Feature (Variable),
Report ID (167),
Usage (4Ah),
Report Count (1),
Feature (Variable),
Report ID (168),
Usage (4Bh),
Report Count (1),
Feature (Variable),
Report ID (169),
Usage (4Ch),
Report Count (8),
Feature (Variable),
Report ID (170),
Usage (4Eh),
Report Count (1),
Feature (Variable),
Report ID (171),
Usage (4Fh),
Report Count (57),
Feature (Variable),
Report ID (172),
Usage (50h),
Report Count (57),
Feature (Variable),
Report ID (173),
Usage (51h),
Report Count (11),
Feature (Variable),
Report ID (174),
Usage (52h),
Report Count (1),
Feature (Variable),
Report ID (175),
Usage (53h),
Report Count (2),
Feature (Variable),
Report ID (176),
Usage (54h),
Report Count (63),
Feature (Variable),
Report ID (177),
Usage (55h),
Report Count (2),
Feature (Variable),
Report ID (178),
Usage (56h),
Report Count (2),
Feature (Variable),
End Collection
kurt@kurt-UP-CHT01:~$
Joystick: buttons = 0, X = 125, Y = 129, Z = 129, Rz = 129, Rx = 0, Ry = 0, Hat = 8
Joystick: buttons = 0, X = 125, Y = 129, Z = 130, Rz = 129, Rx = 0, Ry = 0, Hat = 8
Joystick: buttons = 0, X = 125, Y = 129, Z = 129, Rz = 129, Rx = 0, Ry = 0, Hat = 8
Joystick: buttons = 0, X = 125, Y = 129, Z = 130, Rz = 129, Rx = 0, Ry = 0, Hat = 8
Joystick: buttons = 0, X = 125, Y = 129, Z = 129, Rz = 129, Rx = 0, Ry = 0, Hat = 8
Joystick: buttons = 0, X = 125, Y = 129, Z = 130, Rz = 129, Rx = 0, Ry = 0, Hat = 8
Joystick: buttons = 0, X = 125, Y = 129, Z = 129, Rz = 129, Rx = 0, Ry = 0, Hat = 8
Joystick: buttons = 0, X = 125, Y = 129, Z = 129, Rz = 128, Rx = 0, Ry = 0, Hat = 8
I was thinking of something like this before I went down the Rabbit hole. That is have a table by Vendor ID/Product ID - Maps to table of offset, size, type values for each of the fields, but that probably would be pretty limited and then at best maybe guessing for those other PIDs that are not in table. That is there may be 50? logitech mice over the years? ...Are you considering making a static table of 'known' devices stored in flash table versus parsing on the fly on device arrival?
kurt@kurt-UP-CHT01:~$ sudo usbhid-dump -i0 | grep -v : | xxd -r -p | hidrd-convert -o spec
Usage Page (Desktop), ; Generic desktop controls (01h)
Usage (Joystik), ; Joystik (04h, application collection)
[COLOR="#FF0000"]Collection (Application),
Collection (Logical),
Report ID (1),
Report Size (8),
Report Count (1),
Logical Minimum (0),
Logical Maximum (255),
Input (Constant, Variable),
Report Size (1),
Report Count (19),
Logical Minimum (0),
Logical Maximum (1),
Physical Minimum (0),
Physical Maximum (1),
Usage Page (Button), ; Button (09h)
Usage Minimum (01h),
Usage Maximum (13h),
Input (Variable),
Report Size (1),
Report Count (13),
Usage Page (FF00h), ; FF00h, vendor-defined
Input (Constant, Variable),
Logical Minimum (0),
Logical Maximum (255),
Usage Page (Desktop), ; Generic desktop controls (01h)
Usage (Pointer), ; Pointer (01h, physical collection)
Collection (Physical),
Report Size (8),
Report Count (4),
Physical Minimum (0),
Physical Maximum (255),
Usage (X), ; X (30h, dynamic value)
Usage (Y), ; Y (31h, dynamic value)
Usage (Z), ; Z (32h, dynamic value)
Usage (Rz), ; Rz (35h, dynamic value)
Input (Variable),
End Collection,
Usage Page (Desktop), ; Generic desktop controls (01h)
Report Size (8),
Report Count (39),
Usage (Pointer), ; Pointer (01h, physical collection)
Input (Variable),
Report Size (8),
Report Count (48),
Usage (Pointer), ; Pointer (01h, physical collection)
Output (Variable),
Report Size (8),
Report Count (48),
Usage (Pointer), ; Pointer (01h, physical collection)
Feature (Variable),
End Collection,
Collection (Logical),
[/COLOR] Report ID (2),
Report Size (8),
Report Count (48),
Usage (Pointer), ; Pointer (01h, physical collection)
Feature (Variable),
End Collection,
Collection (Logical),
Report ID (238),
Report Size (8),
Report Count (48),
Usage (Pointer), ; Pointer (01h, physical collection)
Feature (Variable),
End Collection,
Collection (Logical),
Report ID (239),
Report Size (8),
Report Count (48),
Usage (Pointer), ; Pointer (01h, physical collection)
Feature (Variable),
End Collection,
End Collection
kurt@kurt-UP-CHT01:~$
HID: 1 0 0 0 0 0 80 7c a7 ff 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 ee 12 ff c8 0 0 12 ae 77 0 40 2 e 2 19 1 96 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Joystick: usage=90001, value=0
Joystick: usage=90002, value=0
Joystick: usage=90003, value=0
Joystick: usage=90004, value=0
Joystick: usage=90005, value=0
Joystick: usage=90006, value=0
Joystick: usage=90007, value=0
Joystick: usage=90008, value=0
Joystick: usage=90009, value=0
Joystick: usage=9000A, value=0
Joystick: usage=9000B, value=0
Joystick: usage=9000C, value=0
Joystick: usage=9000D, value=0
Joystick: usage=9000E, value=0
Joystick: usage=9000F, value=0
Joystick: usage=90010, value=0
Joystick: usage=90011, value=0
Joystick: usage=90012, value=0
Joystick: usage=90013, value=0
J[COLOR="#FF0000"]oystick: usage=10030, value=128
Joystick: usage=10031, value=124
Joystick: usage=10032, value=167
Joystick: usage=10035, value=255[/COLOR]
Joystick: usage=10001, value=0
Joystick: usage=10000, value=0
Joystick: usage=10032, value=0
Joystick: usage=10035, value=0
Joystick: usage=10000, value=0
Joystick: usage=10000, value=0
Joystick: usage=10000, value=0
Joystick: usage=10000, value=0
Joystick: usage=10000, value=0
Joystick: usage=10000, value=0
Joystick: usage=10000, value=0
Joystick: usage=10000, value=0
Joystick: usage=10000, value=0
Joystick: usage=10000, value=0
Joystick: usage=10000, value=0
Joystick: usage=10000, value=0
Joystick: usage=10000, value=0
Joystick: usage=10000, value=0
Joystick: usage=10000, value=0
Joystick: usage=10000, value=2
Joystick: usage=10000, value=238
Joystick: usage=10000, value=18
Joystick: usage=10000, value=255
Joystick: usage=10000, value=200
Joystick: usage=10000, value=0
Joystick: usage=10000, value=0
Joystick: usage=10000, value=18
Joystick: usage=10000, value=174
Joystick: usage=10000, value=119
Joystick: usage=10000, value=0
Joystick: usage=10000, value=64
Joystick: usage=10000, value=2
Joystick: usage=10000, value=14
Joystick: usage=10000, value=2
Joystick: usage=10000, value=25
Joystick: usage=10000, value=1
Joystick: usage=10000, value=150
Joystick: usage=10000, value=0
Joystick: usage=10000, value=5
Joystick: buttons = 0, X = 128, Y = 124, Z = 0, Rz = 0, Rx = 0, Ry = 0, Hat = 0
HID: 1 0 0 0 0 0 80 7c a7 ff 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 ee 12 ff c8 0 0 12 ae 77 0 40 2 d 2 19 1 95 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0