+
+ // TODO: Register endpoint early
+ int ep_num = endpt->Address & 15;
+ if( dev->EndpointHandles[ep_num] ) {
+ Log_Notice("USB", "Device %p:%i ep %i reused", dev->Host->Ptr, dev->Address, ep_num);
+ }
+ else {
+ int addr = dev->Address*16+ep_num;
+ int mps = dev_if->Endpoints[k].MaxPacketSize;
+ void *handle = NULL;
+ switch( endpt->Attributes & 3)
+ {
+ case 0: // Control
+ handle = dev->Host->HostDef->InitControl(dev->Host->Ptr, addr, mps);
+ break;
+ case 1: // Isochronous
+ // handle = dev->Host->HostDef->InitIsoch(dev->Host->Ptr, addr, mps);
+ break;
+ case 2: // Bulk
+ handle = dev->Host->HostDef->InitBulk(dev->Host->Ptr, addr, mps);
+ break;
+ case 3: // Interrupt
+ // handle = dev->Host->HostDef->InitInterrupt(dev->Host->Ptr, addr, ...);
+ break;
+ }
+ dev->EndpointHandles[ep_num] = handle;
+ }