Author: phoudoin Date: 2011-10-25 08:46:40 +0200 (Tue, 25 Oct 2011) New Revision: 42908 Changeset: https://dev.haiku-os.org/changeset/42908 Modified: haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp Log: Revert back my change as its broken. I will take some rest as obviously I should not allwed to commit anything rigth now. Sorry guys. Modified: haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp 2011-10-25 06:19:49 UTC (rev 42907) +++ haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp 2011-10-25 06:46:40 UTC (rev 42908) @@ -545,31 +545,21 @@ return B_BUFFER_OVERFLOW; size_t actualLength = 0; - uint8 firstBytes[4]; - size_t bytesNeeded = - command->descriptor.type == USB_DESCRIPTOR_CONFIGURATION ? - 4 : 2; + uint8 firstTwoBytes[2]; if (gUSBModule->get_descriptor(device->device, command->descriptor.type, command->descriptor.index, - command->descriptor.language_id, firstBytes, bytesNeeded, + command->descriptor.language_id, firstTwoBytes, 2, &actualLength) < B_OK - || actualLength != bytesNeeded - || firstBytes[1] != command->descriptor.type) { + || actualLength != 2 + || firstTwoBytes[1] != command->descriptor.type) { command->descriptor.status = B_USB_RAW_STATUS_ABORTED; command->descriptor.length = 0; return B_OK; } - uint8 descriptorLength = firstBytes[0]; - if (command->descriptor.type == USB_DESCRIPTOR_CONFIGURATION) { - // configuration complete descriptor total length is - // bigger than just its header size - descriptorLength = - ((usb_configuration_descriptor*)firstBytes)->total_length; - } - descriptorLength = MIN(descriptorLength, command->descriptor.length); - + uint8 descriptorLength = MIN(firstTwoBytes[0], + command->descriptor.length); uint8 *descriptorBuffer = (uint8 *)malloc(descriptorLength); if (descriptorBuffer == NULL) { command->descriptor.status = B_USB_RAW_STATUS_ABORTED;