[USBHUB_NEW]

- Some devices implement a default Language, LangId of 0. Some do not. Use LangId 0x0409 (English) until LangId is implemented.
- Remove an unused variable.

svn path=/branches/usb-bringup/; revision=51622
This commit is contained in:
Michael Martin 2011-05-07 16:10:09 +00:00
parent e9fe271ad6
commit 54c5af9906
2 changed files with 10 additions and 12 deletions

View file

@ -688,21 +688,19 @@ GetUsbStringDescriptor(
// //
// Get the index string descriptor length // Get the index string descriptor length
// FIXME: Implement LangIds
// //
Status = GetUsbDeviceDescriptor(ChildDeviceObject, Status = GetUsbDeviceDescriptor(ChildDeviceObject,
USB_STRING_DESCRIPTOR_TYPE, USB_STRING_DESCRIPTOR_TYPE,
Index, Index,
0, 0x0409,
StringDesc, StringDesc,
sizeof(USB_STRING_DESCRIPTOR)); sizeof(USB_STRING_DESCRIPTOR));
if (!NT_SUCCESS(Status))
//
// If lenght is 4 only then either this is a bad index or the device is not reporting
//
if (StringDesc->bLength == 4)
{ {
DPRINT1("USBHUB: Device Data Error\n"); DPRINT1("GetUsbDeviceDescriptor failed with status %x\n", Status);
return STATUS_UNSUCCESSFUL; ExFreePool(StringDesc);
return Status;
} }
DPRINT1("StringDesc->bLength %d\n", StringDesc->bLength); DPRINT1("StringDesc->bLength %d\n", StringDesc->bLength);
@ -724,19 +722,21 @@ GetUsbStringDescriptor(
DPRINT1("Failed to allocate buffer for string!\n"); DPRINT1("Failed to allocate buffer for string!\n");
return STATUS_INSUFFICIENT_RESOURCES; return STATUS_INSUFFICIENT_RESOURCES;
} }
RtlZeroMemory(StringDesc, SizeNeeded); RtlZeroMemory(StringDesc, SizeNeeded);
// //
// Get the string // Get the string
// //
Status = GetUsbDeviceDescriptor(ChildDeviceObject, Status = GetUsbDeviceDescriptor(ChildDeviceObject,
USB_STRING_DESCRIPTOR_TYPE, USB_STRING_DESCRIPTOR_TYPE,
Index, Index,
0, 0x0409,
StringDesc, StringDesc,
SizeNeeded); SizeNeeded);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("Failed to get string from device\n"); DPRINT1("GetUsbDeviceDescriptor failed with status %x\n", Status);
ExFreePool(StringDesc); ExFreePool(StringDesc);
return Status; return Status;
} }

View file

@ -190,8 +190,6 @@ DriverEntry(
IN PDRIVER_OBJECT DriverObject, IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath) IN PUNICODE_STRING RegistryPath)
{ {
ULONG i;
DriverObject->DriverExtension->AddDevice = USBHUB_AddDevice; DriverObject->DriverExtension->AddDevice = USBHUB_AddDevice;
DPRINT1("USBHUB: DriverEntry\n"); DPRINT1("USBHUB: DriverEntry\n");