diff --git a/src/userland/usb/main.c b/src/userland/usb/main.c index 13903a7..8ffd584 100644 --- a/src/userland/usb/main.c +++ b/src/userland/usb/main.c @@ -70,6 +70,7 @@ // also interface assosciations... UsbInterfaceDescriptor *interface = (void *)slot->descriptor + slot->descriptor->size; slot->interface->setupEndpointsStart(slot->data, slot->descriptor->configurationValue); + UsbInterfaceDescriptor *firstInterface = NULL; while (U32(interface) < U32(slot->descriptor) + slot->descriptor->totalLength) { printf("interface %i: %i endpoint(s), class %i, subclass %i\n", interface->interfaceNumber, interface->endpointCount, @@ -83,14 +84,17 @@ } nextInterface += endpoint->size; } - if (interface->interfaceClass == 3) { - setupHID(slot, interface); - } else if (interface->interfaceClass == 8) { - setupMassStorage(slot, interface); + if (!firstInterface) { + firstInterface = interface; } interface = nextInterface; } slot->interface->setupEndpointsEnd(slot->data, slot->descriptor->configurationValue); + if (firstInterface->interfaceClass == 3) { + setupHID(slot, firstInterface); + } else if (firstInterface->interfaceClass == 8) { + setupMassStorage(slot, firstInterface); + } } ListElement *usbSlots = NULL; @@ -166,7 +170,6 @@ uint32_t *bufferHere = requestMemory(1, NULL, buffer); uint32_t size = *bufferHere; UsbSlot *usbSlot = listGet(usbSlots, slotId & 0xFFFF); - printf("write: %x, %x -> %x, %x (slot %i)\n", slotId, buffer, bufferHere, buffer + 4, slotId >> 16); void (*write)(void *, void *, uint32_t, uint32_t) = usbSlot->interface->writeNormal; write(usbSlot->data, buffer + 4, slotId >> 16, size); } diff --git a/src/userland/usb/main.c b/src/userland/usb/main.c index 13903a7..8ffd584 100644 --- a/src/userland/usb/main.c +++ b/src/userland/usb/main.c @@ -70,6 +70,7 @@ // also interface assosciations... UsbInterfaceDescriptor *interface = (void *)slot->descriptor + slot->descriptor->size; slot->interface->setupEndpointsStart(slot->data, slot->descriptor->configurationValue); + UsbInterfaceDescriptor *firstInterface = NULL; while (U32(interface) < U32(slot->descriptor) + slot->descriptor->totalLength) { printf("interface %i: %i endpoint(s), class %i, subclass %i\n", interface->interfaceNumber, interface->endpointCount, @@ -83,14 +84,17 @@ } nextInterface += endpoint->size; } - if (interface->interfaceClass == 3) { - setupHID(slot, interface); - } else if (interface->interfaceClass == 8) { - setupMassStorage(slot, interface); + if (!firstInterface) { + firstInterface = interface; } interface = nextInterface; } slot->interface->setupEndpointsEnd(slot->data, slot->descriptor->configurationValue); + if (firstInterface->interfaceClass == 3) { + setupHID(slot, firstInterface); + } else if (firstInterface->interfaceClass == 8) { + setupMassStorage(slot, firstInterface); + } } ListElement *usbSlots = NULL; @@ -166,7 +170,6 @@ uint32_t *bufferHere = requestMemory(1, NULL, buffer); uint32_t size = *bufferHere; UsbSlot *usbSlot = listGet(usbSlots, slotId & 0xFFFF); - printf("write: %x, %x -> %x, %x (slot %i)\n", slotId, buffer, bufferHere, buffer + 4, slotId >> 16); void (*write)(void *, void *, uint32_t, uint32_t) = usbSlot->interface->writeNormal; write(usbSlot->data, buffer + 4, slotId >> 16, size); } diff --git a/src/userland/usb/xhci/xhci.c b/src/userland/usb/xhci/xhci.c index 9e900bd..7be7c32 100644 --- a/src/userland/usb/xhci/xhci.c +++ b/src/userland/usb/xhci/xhci.c @@ -92,7 +92,7 @@ normal.interrupterTarget = 0; normal.interruptOnCompletion = 1; normal.interruptOnShortPacket = 1; - normal.transferSize = transferSize; + normal.transferSize = 4; normal.type = 1; uint32_t commandAddress = U32(enqueueCommand( slot->endpointRings[endpointIndex], (void *)&normal));