3 * - By John Hodge (thePowersGang)
16 void Hub_Connected(tUSBInterface *Dev);
17 void Hub_Disconnected(tUSBInterface *Dev);
18 void Hub_PortStatusChange(tUSBInterface *Dev, int Length, void *Data);
21 tUSBDriver gUSBHub_Driver = {
23 .Match = {.Class = {0x090000, 0xFF0000}},
24 .Connected = Hub_Connected,
25 .Disconnected = Hub_Disconnected,
28 {0x83, Hub_PortStatusChange}
33 void Hub_Connected(tUSBInterface *Dev)
35 // Register poll on endpoint
36 USB_PollEndpoint(Dev, 0);
38 USB_RegisterHub(Dev, nPorts);
41 void Hub_Disconnected(tUSBInterface *Dev)
45 void Hub_PortStatusChange(tUSBInterface *Dev, int Length, void *Data)
49 for( i = 0; i < info->nPorts; i += 8, status ++ )
51 if( i/8 >= Length ) break;
52 if( *status == 0 ) continue;
54 for( int j = 0; j < 8; j ++ )
55 if( *status & (1 << j) )
56 Hub_int_HandleChange(Dev, i+j);
60 void Hub_int_HandleChange(tUSBInterface *Dev, int Port)
62 Uint16 status[2]; // Status, Change
64 USB_Request(Dev, 0, 0xA3, 0, 0, Port, 4, status);