2 * Acess2 USB Stack HID Driver
3 * - By John Hodge (thePowersGang)
6 * - Keyboard translation
10 #include <Input/Keyboard/include/keyboard.h>
12 typedef struct sUSB_Keyboard tUSB_Keyboard;
21 void HID_Kb_DataAvail(tUSBInterface *Dev, int EndPt, int Length, void *Data);
23 tHID_ReportCallbacks *HID_Kb_Report_Collection(tUSBInterface *Dev, tHID_ReportGlobalState *Global, tHID_ReportLocalState *Local, Uint32 Value);
24 void HID_Kb_Report_EndCollection(tUSBInterface *Dev);
25 void HID_Kb_Report_Input(tUSBInterface *Dev, tHID_ReportGlobalState *Global, tHID_ReportLocalState *Local, Uint32 Value);
28 tHID_ReportCallbacks gHID_Kb_ReportCBs = {
29 .Collection = HID_Kb_Report_Collection,
30 .EndCollection = HID_Kb_Report_EndCollection,
31 .Input = HID_Kb_Report_Input
35 void HID_Kb_DataAvail(tUSBInterface *Dev, int EndPt, int Length, void *Data)
41 tHID_ReportCallbacks *HID_Kb_Report_Collection(
42 tUSBInterface *Dev, tHID_ReportGlobalState *Global, tHID_ReportLocalState *Local,
48 info = USB_GetDeviceDataPtr(Dev);
51 info = malloc( sizeof(tUSB_Keyboard) );
52 USB_SetDeviceDataPtr(Dev, info);
53 info->Keyboard = NULL;
54 info->CollectionDepth = 1;
58 info->CollectionDepth ++;
61 return &gHID_Kb_ReportCBs;
64 void HID_Kb_Report_EndCollection(tUSBInterface *Dev)
68 info = USB_GetDeviceDataPtr(Dev);
71 info->CollectionDepth --;
72 if( info->CollectionDepth == 0 )
74 info->Keyboard = Keyboard_CreateInstance(0, "USBKeyboard");
78 void HID_Kb_Report_Input(tUSBInterface *Dev, tHID_ReportGlobalState *Global, tHID_ReportLocalState *Local, Uint32 Value)