[USBCCGP]
authorCameron Gutman <aicommander@gmail.com>
Sat, 3 Mar 2012 21:23:04 +0000 (21:23 +0000)
committerCameron Gutman <aicommander@gmail.com>
Sat, 3 Mar 2012 21:23:04 +0000 (21:23 +0000)
- Implement support for getting string descriptors (may need more work)
- USB mass storage devices which are part of a composite device now initialize

svn path=/trunk/; revision=55976

reactos/drivers/usb/usbccgp/pdo.c

index 39f25dc..034536a 100644 (file)
@@ -976,6 +976,40 @@ PDO_HandleInternalDeviceControl(
                 IoCompleteRequest(Irp, IO_NO_INCREMENT);
                 return Status;
             }
+            else if (Urb->UrbControlDescriptorRequest.DescriptorType == USB_STRING_DESCRIPTOR_TYPE)
+            {
+                PUSB_STRING_DESCRIPTOR StringDescriptor;
+
+                //
+                // get the requested string descriptor
+                //
+                ASSERT(Urb->UrbControlDescriptorRequest.TransferBuffer);
+                Status = USBCCGP_GetDescriptor(PDODeviceExtension->FDODeviceExtension->NextDeviceObject,
+                                               USB_STRING_DESCRIPTOR_TYPE,
+                                               Urb->UrbControlDescriptorRequest.TransferBufferLength,
+                                               Urb->UrbControlDescriptorRequest.Index,
+                                               Urb->UrbControlDescriptorRequest.LanguageId,
+                                               (PVOID*)&StringDescriptor);
+                if (NT_SUCCESS(Status))
+                {
+                    if (StringDescriptor->bLength == 2)
+                    {
+                        FreeItem(StringDescriptor);
+                        Status = STATUS_DEVICE_DATA_ERROR;
+                    }
+                    else
+                    {
+                        RtlCopyMemory(Urb->UrbControlDescriptorRequest.TransferBuffer,
+                                      StringDescriptor->bString,
+                                      StringDescriptor->bLength + sizeof(WCHAR));
+                        FreeItem(StringDescriptor);
+                        Status = STATUS_SUCCESS;
+                    }
+                }
+                Irp->IoStatus.Status = Status;
+                IoCompleteRequest(Irp, IO_NO_INCREMENT);
+                return Status;
+            }
         }
         else
         {