Hallo,
hat shconmal jemand von euch mit der HID-USB-Host Library gearbeitet?
In der Funktion GetDeviceType:
1 | if(USBH_HID_GetDeviceType(&hUSBHost) == HID_KEYBOARD)
|
2 | {
|
3 | hid_demo.keyboard_state = HID_KEYBOARD_IDLE;
|
4 | hid_demo.state = HID_DEMO_KEYBOARD;
|
5 | [c/]
|
6 |
|
7 |
|
8 | wird abgefragt, ob ein Keyboard angeschlossen ist.
|
9 | Öffnet man die Funktion, dann sieht sie wie folgt aus:
|
10 |
|
11 | [c]
|
12 | HID_TypeTypeDef USBH_HID_GetDeviceType(USBH_HandleTypeDef *phost)
|
13 | {
|
14 | HID_TypeTypeDef type = HID_UNKNOWN;
|
15 |
|
16 | if(phost->gState == HOST_CLASS)
|
17 | {
|
18 |
|
19 | if(phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].bInterfaceProtocol \
|
20 | == HID_KEYBRD_BOOT_CODE)
|
21 | {
|
22 | type = HID_KEYBOARD;
|
23 | }
|
24 |
|
25 | }
|
26 | return type;
|
27 | }
|
Nun frage ich mich an dieser Stelle, wie das Programm offenbar ohne
Einlesen des Report Deskriptors erkennen kann, dass ein Keyboard
angeschlossen ist.
Es wird der Protokollcode abgefragt, aber dies ist ja nicht der
Reportdeskriptor.
Ist das eine Lücke in der Software, oder wird das Feld
".bInterfaceProtocol" noch an anderer Stelle aus dem Reportdeskriptor
gefüllt?