diff --git a/src/userland/hid/main.c b/src/userland/hid/main.c index 42389f7..afa5ab6 100644 --- a/src/userland/hid/main.c +++ b/src/userland/hid/main.c @@ -30,7 +30,9 @@ } } -uint32_t registerHID(uint32_t usbDevice, uint32_t _, uint32_t serviceName, uint32_t serviceId) { +uint32_t registerHID(uint32_t usbDevice, void *reportDescriptor, uint32_t serviceName, uint32_t serviceId) { + uint8_t *report = requestMemory(1, 0, reportDescriptor); + printf("hid registered: %x %x %x %x %x %x %x %x\n", report[0], report[1], report[2], report[3], report[4], report[5], report[6], report[7]); HIDDevice *device = malloc(sizeof(HIDDevice)); device->serviceId = serviceId; device->deviceId = usbDevice; // USB calls this a interface, others may differ diff --git a/src/userland/hid/main.c b/src/userland/hid/main.c index 42389f7..afa5ab6 100644 --- a/src/userland/hid/main.c +++ b/src/userland/hid/main.c @@ -30,7 +30,9 @@ } } -uint32_t registerHID(uint32_t usbDevice, uint32_t _, uint32_t serviceName, uint32_t serviceId) { +uint32_t registerHID(uint32_t usbDevice, void *reportDescriptor, uint32_t serviceName, uint32_t serviceId) { + uint8_t *report = requestMemory(1, 0, reportDescriptor); + printf("hid registered: %x %x %x %x %x %x %x %x\n", report[0], report[1], report[2], report[3], report[4], report[5], report[6], report[7]); HIDDevice *device = malloc(sizeof(HIDDevice)); device->serviceId = serviceId; device->deviceId = usbDevice; // USB calls this a interface, others may differ diff --git a/src/userland/usb/main.c b/src/userland/usb/main.c index 2b197bf..8093bad 100644 --- a/src/userland/usb/main.c +++ b/src/userland/usb/main.c @@ -36,8 +36,6 @@ UsbEndpointDescriptor *endpoint = (void *) findDescriptor((void *) interface, 5); UsbDescriptor *report = requestMemory(1, 0, 0); slot->interface->getDescriptor(slot->data, 0x22 << 8, 0, report, 1); - uint8_t *data = (void *)report; - printf("report descriptor: %x / %x, %x %x %x %x %x %x\n", report, endpoint, data[0], data[1], data[2], data[3], data[4], data[5]); uint8_t endpointNumber = endpoint->address & 0xF; // never 0 uint8_t direction = endpoint->address >> 7; @@ -47,7 +45,8 @@ // set IDLE slot->interface->command(slot->data, 0x21, 0x0A, 0, 1); // HID id is 0xFFFF0000: endpoint, 0xFFFF: index in a list - registerHID(slot->id | (uint32_t)endpointIndex << 16, 0); + registerHID(slot->id | (uint32_t)endpointIndex << 16, U32(getPhysicalAddress(report))); + free(report); } void setupInterfaces(UsbSlot *slot, void *start, uint32_t configurationValue) {