Hallo Community,
ich versuche ein altes USB Spielzeug zum laufen mit einem Arduino zu bringen. Das Gerät ist alt. Die Software läuft nicht vernünftig unter Windows 10 (nur teilweise). Außerdem habe ich mit einem USB Sniffer "versucht" Daten auszulesen. Diese Ergebnisse stimmen weitestgehend mit Coding aus dem Netz überein.
Sniffing Variante 1
000003: Class-Specific Request (DOWN), 2025-06-18 18:29:00,315954 +0,000139. (1. Device: Tenx Nonstandard Devic (Rocket Launcher))
Destination: Interface, Index 1
Reserved Bits: 34
Request: 0x9
Value: 0x200
Send 0x8 bytes to the device
000004: Control Transfer (UP), 2025-06-18 18:29:00,316561 +0,000607. (1. Device: Tenx Nonstandard Devic (Rocket Launcher)) Status: 000000x0
Pipe Handle: Control Pipe
55 53 42 43 00 40 02 00 USBC.@..
Setup Packet
000005: Class-Specific Request (DOWN), 2025-06-18 18:29:00,401962 +0,085401. (1. Device: Tenx Nonstandard Devic (Rocket Launcher))
Destination: Interface, Index 1
Reserved Bits: 34
Request: 0x9
Value: 0x200
Send 0x8 bytes to the device
000006: Control Transfer (UP), 2025-06-18 18:29:00,402416 +0,000454. (1. Device: Tenx Nonstandard Devic (Rocket Launcher)) Status: 000000x0
Pipe Handle: Control Pipe
55 53 42 43 00 00 04 00 USBC....
Setup Packet
Sniffing Variante 2
Setup Packet
000013: Class-Specific Request (DOWN), 2025-06-18 18:23:45,088762 +2,512216. (1. Device: Tenx Nonstandard Devic (Rocket Launcher))
Destination: Interface, Index 0
Reserved Bits: 34
Request: 0x9
Value: 0x200
Send 0x40 bytes to the device
000014: Control Transfer (UP), 2025-06-18 18:23:45,093767 +0,005005. (1. Device: Tenx Nonstandard Devic (Rocket Launcher)) Status: 000000x0
Pipe Handle: Control Pipe
00 00 00 01 00 00 08 08 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
Das ganze habe ich nun mit dem Host Shield versucht umzusetzen. Ist ein Version 1.0 Modell. Ich bekomme - endlich - eine Verbindung und konnte auch das Gerät auslesen.
Start
Device addressed... Requesting device descriptor.
Device descriptor:
Descriptor Length: 12
USB version: 1.10
Class: 00 Use class information in the Interface Descriptor
Subclass: 00
Protocol: 00
Max.packet size: 08
Vendor ID: 1130
Product ID: 0202
Revision ID: 0100
Mfg.string index: 00
Prod.string index: 02 Length: 46 Contents: Tenx Nonstandard Devic
Serial number index: 00
Number of conf.: 01
Configuration number 0
Total configuration length: 59 bytes
Configuration descriptor:
Total length: 003B
Number of interfaces: 02
Configuration value: 01
Configuration string: 00
Attributes: 80
Max.power: 32 100ma
Interface descriptor:
Interface number: 00
Alternate setting: 00
Endpoints: 01
Class: 03 HID (Human Interface Device)
Subclass: 00
Protocol: 00
Interface string: 00
HID descriptor:
Descriptor length: 09 9 bytes
HID version: 1.10
Country Code: 0 Not Supported
Class Descriptors: 1
Class Descriptor Type: 22 Report
Class Descriptor Length:43 bytes
HID report descriptor:
Descriptor length: 09 9 bytes
HID version: 1.10
Country Code: 0 Not Supported
Class Descriptors: 1
Class Descriptor Type: 22 Report
Class Descriptor Length:43 bytes
HID report descriptor:
Length: 1 Type: Global Tag: Usage Page Generic Desktop Controls Data: 01
Length: 1 Type: Local Tag: Usage Data: 00
Length: 1 Type: Main Tag: Collection Application (mouse, keyboard) Data: 01
Length: 1 Type: Global Tag: Report Count Data: 08
Length: 1 Type: Global Tag: Report Size Data: 08
Length: 1 Type: Global Tag: Logical Minimum Data: 00
Length: 2 Type: Global Tag: Logical Maximum Data: FF Data: 00
Length: 1 Type: Global Tag: Usage Page Keyboard/Keypad Data: 07
Length: 1 Type: Local Tag: Usage Minimum Data: 00
Length: 2 Type: Local Tag: Usage Maximum Data: FF Data: 00
Length: 1 Type: Main Tag: Feature Data,Array,Absolute,No Wrap,Linear,Preferred State,No Null Position,Non-volatile(Ignore for Input), Data: 00
Length: 1 Type: Global Tag: Logical Minimum Data: 00
Length: 2 Type: Global Tag: Logical Maximum Data: FF Data: 00
Length: 1 Type: Global Tag: Report Count Data: 40
Length: 1 Type: Global Tag: Report Size Data: 08
Length: 1 Type: Global Tag: Usage Page Keyboard/Keypad Data: 07
Length: 1 Type: Local Tag: Usage Minimum Data: 00
Length: 2 Type: Local Tag: Usage Maximum Data: FF Data: 00
Length: 1 Type: Main Tag: Output Data,Array,Absolute,No Wrap,Linear,Preferred State,No Null Position,Non-volatile(Ignore for Input), Data: 00
Length: 0 Type: Main Tag: End Collection
Endpoint descriptor:
Endpoint address: 01 Direction: IN
Attributes: 03 Transfer type: Interrupt
Max.packet size: 0008
Polling interval: 01 1 ms
Interface descriptor:
Interface number: 01
Alternate setting: 00
Endpoints: 01
Class: 03 HID (Human Interface Device)
Subclass: 00
Protocol: 00
Interface string: 00
HID descriptor:
Descriptor length: 09 9 bytes
HID version: 1.10
Country Code: 33 US
Class Descriptors: 1
Class Descriptor Type: 22 Report
Class Descriptor Length:23 bytes
HID report descriptor:
Length: 1 Type: Global Tag: Usage Page Generic Desktop Controls Data: 01
Length: 1 Type: Local Tag: Usage Data: 00
Length: 1 Type: Main Tag: Collection Application (mouse, keyboard) Data: 01
Length: 1 Type: Global Tag: Report Count Data: 08
Length: 1 Type: Global Tag: Report Size Data: 08
Length: 1 Type: Global Tag: Logical Minimum Data: 00
Length: 2 Type: Global Tag: Logical Maximum Data: FF Data: 00
Length: 1 Type: Global Tag: Usage Page Keyboard/Keypad Data: 07
Length: 1 Type: Local Tag: Usage Minimum Data: 00
Length: 2 Type: Local Tag: Usage Maximum Data: FF Data: 00
Length: 1 Type: Main Tag: Feature
Endpoint descriptor:
Endpoint address: 02 Direction: IN
Attributes: 03 Transfer type: Interrupt
Max.packet size: 0008
Polling interval: 01 1 ms
Das ganze habe ich nun - analog einem nahezu deckungsgleichen Beispiels aus dem Web - versucht umzusetzen.
uint8_t data[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
data[0] = 'U';
data[1] = 'S';
data[2] = 'B';
data[3] = 'C';
data[4] = 0;
data[5] = 0;
data[6] = 4;
data[7] = 0;
// ctrlReq(addr, endPoint, bmReqType, bRequest, wValLo, wValHi, wInd, total, sizeof(data) / sizeof(byte), data, NULL);
ctrlReq(addr, endPoint, bmReqType, bRequest, wValLo, wValHi, wInd, sizeof(data) / sizeof(uint8_t), data);
data[0] = 'U';
data[1] = 'S';
data[2] = 'B';
data[3] = 'C';
data[4] = 0;
data[5] = 64;
data[6] = 2;
data[7] = 0;
ctrlReq(addr, endPoint, bmReqType, bRequest, wValLo, wValHi, wInd, sizeof(data) / sizeof(byte), data);
data[0] |= 0x0;
data[1] |= 0x0;
data[2] |= 0x0;
data[3] |= 0x0;
data[4] |= 0x0;
data[5] |= 0x0;
data[6] |= 0x0;
data[7] |= 0x0;
switch (action) {
case MissileLauncherActions::LEFT:
data[1] |= 1;
break;
case MissileLauncherActions::RIGHT:
data[2] |= 1;
break;
case MissileLauncherActions::UP:
data[3] |= 1;
break;
case MissileLauncherActions::DOWN:
data[4] |= 1;
break;
case MissileLauncherActions::FIRE:
data[5] |= 1;
break;
}
data[6] |= 8;
data[7] |= 8;
ctrlReq(addr, endPoint, bmReqType, bRequest, wValLo, wValHi, wInd, sizeof(data) / sizeof(byte), data);
Es funktioniert nicht. Unabhängig davon habe ich das Gefühl, dass ich einer Lösung sehr nahe bin. Leider verstehe ich nicht, was der Aufruf von ctrlReq genau tut bzw. was die Parameter bedeuten (außer addr und data und natürlich die Berechnung der Array-Größe). Also: endPoint, bmReqType, bRequest, wValLo, wValHi, wInd
MissileLauncher::MissileLauncher()
: USB() {
addr = 1; // Todo need to change it if connected through a USB Hub
endPoint = 0;
bmReqType = 0x21;
bRequest = 0x09;
wValLo = 0x00;
wValHi = 0x02;
wInd = 0;
total = 1;
// addr = 1; // Todo need to change it if connected through a USB Hub
// endPoint = 0;
// bmReqType = 0x21;
// bRequest = 0x09;
// wValLo = 0x00;
// wValHi = 0x02;
// wInd = 0x200;
}
Über Hilfe und Anregungen würde ich mich freuen...