diff --git a/src/userland/usb/include/usb.h b/src/userland/usb/include/usb.h index c35da42..96bcd6f 100644 --- a/src/userland/usb/include/usb.h +++ b/src/userland/usb/include/usb.h @@ -62,7 +62,7 @@ void (*getDeviceDescriptor)(void *, uint32_t, uint32_t, void *); void (*setupEndpoints)(void *, ListElement *, uint32_t); void (*setupHID)(void *, uint32_t, void *); - void (*doNormal)(void *, void *); + void (*doNormal)(void *, void *, uint32_t); void (*command)(void *, uint8_t, uint8_t, uint16_t); } UsbHostControllerInterface; diff --git a/src/userland/usb/include/usb.h b/src/userland/usb/include/usb.h index c35da42..96bcd6f 100644 --- a/src/userland/usb/include/usb.h +++ b/src/userland/usb/include/usb.h @@ -62,7 +62,7 @@ void (*getDeviceDescriptor)(void *, uint32_t, uint32_t, void *); void (*setupEndpoints)(void *, ListElement *, uint32_t); void (*setupHID)(void *, uint32_t, void *); - void (*doNormal)(void *, void *); + void (*doNormal)(void *, void *, uint32_t); void (*command)(void *, uint8_t, uint8_t, uint16_t); } UsbHostControllerInterface; diff --git a/src/userland/usb/main.c b/src/userland/usb/main.c index 1f62f5a..e6bf57c 100644 --- a/src/userland/usb/main.c +++ b/src/userland/usb/main.c @@ -68,7 +68,8 @@ slot->interface->command(slot->data, 0x21, 0x0B, 0); // set IDLE slot->interface->command(slot->data, 0x21, 0x0A, 0); - registerHID(slot->id, 0); + // HID id is 0xFFFF0000: endpoint, 0xFFFF: index in a list + registerHID(slot->id | (uint32_t)endpointIndex << 16, 0); }) // clear list } @@ -140,8 +141,8 @@ bool initialized = false; void hidNormal(uint32_t slotId, void *bufferPhysical) { - UsbSlot *usbSlot = listGet(usbSlots, slotId); - usbSlot->interface->doNormal(usbSlot->data, bufferPhysical); + UsbSlot *usbSlot = listGet(usbSlots, slotId & 0xFFFF); + usbSlot->interface->doNormal(usbSlot->data, bufferPhysical, slotId >> 16); // data is returned to buffer } diff --git a/src/userland/usb/include/usb.h b/src/userland/usb/include/usb.h index c35da42..96bcd6f 100644 --- a/src/userland/usb/include/usb.h +++ b/src/userland/usb/include/usb.h @@ -62,7 +62,7 @@ void (*getDeviceDescriptor)(void *, uint32_t, uint32_t, void *); void (*setupEndpoints)(void *, ListElement *, uint32_t); void (*setupHID)(void *, uint32_t, void *); - void (*doNormal)(void *, void *); + void (*doNormal)(void *, void *, uint32_t); void (*command)(void *, uint8_t, uint8_t, uint16_t); } UsbHostControllerInterface; diff --git a/src/userland/usb/main.c b/src/userland/usb/main.c index 1f62f5a..e6bf57c 100644 --- a/src/userland/usb/main.c +++ b/src/userland/usb/main.c @@ -68,7 +68,8 @@ slot->interface->command(slot->data, 0x21, 0x0B, 0); // set IDLE slot->interface->command(slot->data, 0x21, 0x0A, 0); - registerHID(slot->id, 0); + // HID id is 0xFFFF0000: endpoint, 0xFFFF: index in a list + registerHID(slot->id | (uint32_t)endpointIndex << 16, 0); }) // clear list } @@ -140,8 +141,8 @@ bool initialized = false; void hidNormal(uint32_t slotId, void *bufferPhysical) { - UsbSlot *usbSlot = listGet(usbSlots, slotId); - usbSlot->interface->doNormal(usbSlot->data, bufferPhysical); + UsbSlot *usbSlot = listGet(usbSlots, slotId & 0xFFFF); + usbSlot->interface->doNormal(usbSlot->data, bufferPhysical, slotId >> 16); // data is returned to buffer } diff --git a/src/userland/usb/xhci/xhci.c b/src/userland/usb/xhci/xhci.c index d550ea7..f515f71 100644 --- a/src/userland/usb/xhci/xhci.c +++ b/src/userland/usb/xhci/xhci.c @@ -133,8 +133,7 @@ awaitCode(serviceId, xhciEvent, commandAddress); } -void xhciNormal(SlotXHCI *slot, void *bufferPhysical) { - uint32_t endpointIndex = 2; // TODO +void xhciNormal(SlotXHCI *slot, void *bufferPhysical, uint32_t endpointIndex) { XHCINormalTRB normal = {0}; normal.type = 1; normal.inDirection = 1;