diff --git a/src/userland/usb/main.c b/src/userland/usb/main.c index ed4af4e..5e28370 100644 --- a/src/userland/usb/main.c +++ b/src/userland/usb/main.c @@ -234,8 +234,8 @@ xhciCommand(controller, U32(inputContext), 0, 0, control); } -uint32_t *getDeviceInformation(XHCIInputContext *inputContext, TrbRing *ring, - uint32_t slotIndex) { +void *getDeviceInformation(XHCIInputContext *inputContext, TrbRing *ring, + uint32_t slotIndex) { XHCISetupStageTRB setup = {0}; setup.requestType = 0x80; setup.request = 6; @@ -326,9 +326,18 @@ printf("port %i: addressing slot\n", portIndex - 1); addressDevice(getPhysicalAddress((void *)&inputContext->inputControl), slotIndex, true); - uint32_t *data = getDeviceInformation(inputContext, ring, slotIndex); - printf("port %i: device information: %x, %x\n", portIndex - 1, data[0], - data[1]); + UsbDeviceDescriptor *data = + getDeviceInformation(inputContext, ring, slotIndex); + printf("port %i: device information: length: %i, type: %i, release %x\n", + portIndex - 1, data->size, data->descriptorType, data->usbVersion); + printf("port %i: class: %i, subclass: %i, protocol %i, maxPacketSize: %i\n", + portIndex - 1, data->deviceClass, data->deviceSubclass, + data->deviceProtocol, data->maxPacketSize); + printf("port %i: vendor: %i, product: %i, deviceRelease: %x, manufacturer: " + "%i, product: %i\n", + portIndex - 1, data->vendor, data->product, data->deviceRelease, + data->manufacturerStringDescriptor); + printf("--------\n"); // configure endpoint gives a trb error as of now ... // configureEndpoint(getPhysicalAddress((void // *)&inputContext->inputControl), diff --git a/src/userland/usb/main.c b/src/userland/usb/main.c index ed4af4e..5e28370 100644 --- a/src/userland/usb/main.c +++ b/src/userland/usb/main.c @@ -234,8 +234,8 @@ xhciCommand(controller, U32(inputContext), 0, 0, control); } -uint32_t *getDeviceInformation(XHCIInputContext *inputContext, TrbRing *ring, - uint32_t slotIndex) { +void *getDeviceInformation(XHCIInputContext *inputContext, TrbRing *ring, + uint32_t slotIndex) { XHCISetupStageTRB setup = {0}; setup.requestType = 0x80; setup.request = 6; @@ -326,9 +326,18 @@ printf("port %i: addressing slot\n", portIndex - 1); addressDevice(getPhysicalAddress((void *)&inputContext->inputControl), slotIndex, true); - uint32_t *data = getDeviceInformation(inputContext, ring, slotIndex); - printf("port %i: device information: %x, %x\n", portIndex - 1, data[0], - data[1]); + UsbDeviceDescriptor *data = + getDeviceInformation(inputContext, ring, slotIndex); + printf("port %i: device information: length: %i, type: %i, release %x\n", + portIndex - 1, data->size, data->descriptorType, data->usbVersion); + printf("port %i: class: %i, subclass: %i, protocol %i, maxPacketSize: %i\n", + portIndex - 1, data->deviceClass, data->deviceSubclass, + data->deviceProtocol, data->maxPacketSize); + printf("port %i: vendor: %i, product: %i, deviceRelease: %x, manufacturer: " + "%i, product: %i\n", + portIndex - 1, data->vendor, data->product, data->deviceRelease, + data->manufacturerStringDescriptor); + printf("--------\n"); // configure endpoint gives a trb error as of now ... // configureEndpoint(getPhysicalAddress((void // *)&inputContext->inputControl), diff --git a/src/userland/usb/usb.h b/src/userland/usb/usb.h index 36dbfcb..2aa8622 100644 --- a/src/userland/usb/usb.h +++ b/src/userland/usb/usb.h @@ -148,6 +148,23 @@ XHCIDevice deviceContext; } __attribute__((packed)) XHCIInputContext; +typedef volatile struct { + uint8_t size; + uint8_t descriptorType; + uint16_t usbVersion; + uint8_t deviceClass; + uint8_t deviceSubclass; + uint8_t deviceProtocol; + uint8_t maxPacketSize; + uint16_t vendor; + uint16_t product; + uint16_t deviceRelease; + uint8_t manufacturerStringDescriptor; + uint8_t deviceStringDescriptor; + uint8_t serialNumberStringDescriptor; + uint8_t configurationCount; +} __attribute__((packed)) UsbDeviceDescriptor; + typedef struct { XHCITRB *trbs, *physical; uint32_t size, enqueue, dequeue;