2 * PROJECT: ReactOS Universal Serial Bus Bulk Enhanced Host Controller Interface
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: drivers/usb/usbccgp/pdo.c
5 * PURPOSE: USB device driver.
7 * Michael Martin (michael.martin@reactos.org)
8 * Johannes Anderwald (johannes.anderwald@reactos.org)
15 USBCCGP_PdoHandleQueryDeviceText(
16 IN PDEVICE_OBJECT DeviceObject
,
20 PPDO_DEVICE_EXTENSION PDODeviceExtension
;
21 LPWSTR GenericString
= L
"Composite USB Device";
23 // get device extension
25 PDODeviceExtension
= (PPDO_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
28 // is there a device description
30 if (PDODeviceExtension
->FunctionDescriptor
->FunctionDescription
.Length
)
35 Buffer
= AllocateItem(NonPagedPool
, PDODeviceExtension
->FunctionDescriptor
->FunctionDescription
.Length
+ sizeof(WCHAR
));
41 return STATUS_INSUFFICIENT_RESOURCES
;
47 Irp
->IoStatus
.Information
= (ULONG_PTR
)Buffer
;
48 RtlCopyMemory(Buffer
, PDODeviceExtension
->FunctionDescriptor
->FunctionDescription
.Buffer
, PDODeviceExtension
->FunctionDescriptor
->FunctionDescription
.Length
);
49 return STATUS_SUCCESS
;
53 // FIXME use GenericCompositeUSBDeviceString
56 Buffer
= AllocateItem(PagedPool
, (wcslen(GenericString
) + 1) * sizeof(WCHAR
));
62 return STATUS_INSUFFICIENT_RESOURCES
;
64 RtlCopyMemory(Buffer
, GenericString
, (wcslen(GenericString
) + 1) * sizeof(WCHAR
));
65 Irp
->IoStatus
.Information
= (ULONG_PTR
)Buffer
;
67 return STATUS_SUCCESS
;
71 USBCCGP_PdoHandleDeviceRelations(
72 IN PDEVICE_OBJECT DeviceObject
,
75 PDEVICE_RELATIONS DeviceRelations
;
76 PIO_STACK_LOCATION IoStack
;
78 DPRINT("USBCCGP_PdoHandleDeviceRelations\n");
81 // get current irp stack location
83 IoStack
= IoGetCurrentIrpStackLocation(Irp
);
86 // check if relation type is BusRelations
88 if (IoStack
->Parameters
.QueryDeviceRelations
.Type
!= TargetDeviceRelation
)
91 // PDO handles only target device relation
93 return Irp
->IoStatus
.Status
;
97 // allocate device relations
99 DeviceRelations
= (PDEVICE_RELATIONS
)AllocateItem(PagedPool
, sizeof(DEVICE_RELATIONS
));
100 if (!DeviceRelations
)
105 return STATUS_INSUFFICIENT_RESOURCES
;
109 // initialize device relations
111 DeviceRelations
->Count
= 1;
112 DeviceRelations
->Objects
[0] = DeviceObject
;
113 ObReferenceObject(DeviceObject
);
118 Irp
->IoStatus
.Information
= (ULONG_PTR
)DeviceRelations
;
121 // completed successfully
123 return STATUS_SUCCESS
;
127 USBCCGP_PdoAppendInterfaceNumber(
129 IN ULONG InterfaceNumber
,
130 OUT LPWSTR
*OutString
)
132 ULONG Length
= 0, StringLength
;
136 // count length of string
141 StringLength
= wcslen(String
) + 1;
142 Length
+= StringLength
;
143 Length
+= 6; //&MI_XX
144 String
+= StringLength
;
148 // now allocate the buffer
150 String
= AllocateItem(NonPagedPool
, (Length
+ 2) * sizeof(WCHAR
));
156 return STATUS_INSUFFICIENT_RESOURCES
;
166 StringLength
= swprintf(String
, L
"%s&MI_%02x", DeviceId
) + 1;
167 Length
= wcslen(DeviceId
) + 1;
168 DPRINT("String %p\n", String
);
173 String
+= StringLength
;
180 return STATUS_SUCCESS
;
185 USBCCGP_PdoHandleQueryId(
186 PDEVICE_OBJECT DeviceObject
,
189 PIO_STACK_LOCATION IoStack
;
190 PUNICODE_STRING DeviceString
= NULL
;
191 PPDO_DEVICE_EXTENSION PDODeviceExtension
;
196 // get current irp stack location
198 IoStack
= IoGetCurrentIrpStackLocation(Irp
);
201 // get device extension
203 PDODeviceExtension
= (PPDO_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
206 if (IoStack
->Parameters
.QueryId
.IdType
== BusQueryDeviceID
)
209 // handle query device id
211 Status
= USBCCGP_SyncForwardIrp(PDODeviceExtension
->NextDeviceObject
, Irp
);
212 if (NT_SUCCESS(Status
))
217 Buffer
= AllocateItem(NonPagedPool
, (wcslen((LPWSTR
)Irp
->IoStatus
.Information
) + 7) * sizeof(WCHAR
));
221 // append interface number
223 ASSERT(Irp
->IoStatus
.Information
);
224 swprintf(Buffer
, L
"%s&MI_%02x", (LPWSTR
)Irp
->IoStatus
.Information
, PDODeviceExtension
->FunctionDescriptor
->FunctionNumber
);
225 DPRINT("BusQueryDeviceID %S\n", Buffer
);
227 ExFreePool((PVOID
)Irp
->IoStatus
.Information
);
228 Irp
->IoStatus
.Information
= (ULONG_PTR
)Buffer
;
235 Status
= STATUS_INSUFFICIENT_RESOURCES
;
240 else if (IoStack
->Parameters
.QueryId
.IdType
== BusQueryHardwareIDs
)
243 // handle instance id
245 DeviceString
= &PDODeviceExtension
->FunctionDescriptor
->HardwareId
;
247 else if (IoStack
->Parameters
.QueryId
.IdType
== BusQueryInstanceID
)
250 // handle instance id
252 Buffer
= AllocateItem(NonPagedPool
, 5 * sizeof(WCHAR
));
258 return STATUS_INSUFFICIENT_RESOURCES
;
262 // use function number
264 swprintf(Buffer
, L
"%04x", PDODeviceExtension
->FunctionDescriptor
->FunctionNumber
);
265 Irp
->IoStatus
.Information
= (ULONG_PTR
)Buffer
;
266 return STATUS_SUCCESS
;
268 else if (IoStack
->Parameters
.QueryId
.IdType
== BusQueryCompatibleIDs
)
271 // handle instance id
273 DeviceString
= &PDODeviceExtension
->FunctionDescriptor
->CompatibleId
;
279 ASSERT(DeviceString
!= NULL
);
284 Buffer
= AllocateItem(NonPagedPool
, DeviceString
->Length
+ sizeof(WCHAR
));
290 return STATUS_INSUFFICIENT_RESOURCES
;
296 RtlCopyMemory(Buffer
, DeviceString
->Buffer
, DeviceString
->Length
);
297 Irp
->IoStatus
.Information
= (ULONG_PTR
)Buffer
;
299 return STATUS_SUCCESS
;
304 PDEVICE_OBJECT DeviceObject
,
307 PIO_STACK_LOCATION IoStack
;
308 PPDO_DEVICE_EXTENSION PDODeviceExtension
;
313 // get current stack location
315 IoStack
= IoGetCurrentIrpStackLocation(Irp
);
318 // get device extension
320 PDODeviceExtension
= (PPDO_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
325 ASSERT(PDODeviceExtension
->Common
.IsFDO
== FALSE
);
327 switch(IoStack
->MinorFunction
)
329 case IRP_MN_QUERY_DEVICE_RELATIONS
:
332 // handle device relations
334 Status
= USBCCGP_PdoHandleDeviceRelations(DeviceObject
, Irp
);
337 case IRP_MN_QUERY_DEVICE_TEXT
:
340 // handle query device text
342 Status
= USBCCGP_PdoHandleQueryDeviceText(DeviceObject
, Irp
);
345 case IRP_MN_QUERY_ID
:
350 Status
= USBCCGP_PdoHandleQueryId(DeviceObject
, Irp
);
353 case IRP_MN_REMOVE_DEVICE
:
356 // remove us from the fdo's pdo list
359 for(Index
= 0; Index
< PDODeviceExtension
->FDODeviceExtension
->FunctionDescriptorCount
; Index
++)
361 if (PDODeviceExtension
->FDODeviceExtension
->ChildPDO
[Index
] == DeviceObject
)
366 PDODeviceExtension
->FDODeviceExtension
->ChildPDO
[Index
] = NULL
;
375 Irp
->IoStatus
.Status
= STATUS_SUCCESS
;
376 IoCompleteRequest(Irp
, IO_NO_INCREMENT
);
381 // Delete the device object
383 IoDeleteDevice(DeviceObject
);
385 return STATUS_SUCCESS
;
387 case IRP_MN_QUERY_CAPABILITIES
:
390 // copy device capabilities
392 RtlCopyMemory(IoStack
->Parameters
.DeviceCapabilities
.Capabilities
, &PDODeviceExtension
->Capabilities
, sizeof(DEVICE_CAPABILITIES
));
394 /* Complete the IRP */
395 Irp
->IoStatus
.Status
= STATUS_SUCCESS
;
396 IoCompleteRequest(Irp
, IO_NO_INCREMENT
);
397 return STATUS_SUCCESS
;
399 case IRP_MN_QUERY_REMOVE_DEVICE
:
400 case IRP_MN_QUERY_STOP_DEVICE
:
405 Status
= STATUS_SUCCESS
;
408 case IRP_MN_START_DEVICE
:
413 DPRINT("[USBCCGP] PDO IRP_MN_START\n");
414 Status
= STATUS_SUCCESS
;
422 Status
= Irp
->IoStatus
.Status
;
430 if (Status
!= STATUS_PENDING
)
435 Irp
->IoStatus
.Status
= Status
;
440 IoCompleteRequest(Irp
, IO_NO_INCREMENT
);
451 USBCCGP_BuildConfigurationDescriptor(
452 PDEVICE_OBJECT DeviceObject
,
455 PIO_STACK_LOCATION IoStack
;
456 PPDO_DEVICE_EXTENSION PDODeviceExtension
;
457 PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor
;
458 PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor
;
459 ULONG TotalSize
, Index
;
465 // get current stack location
467 IoStack
= IoGetCurrentIrpStackLocation(Irp
);
469 DPRINT("USBCCGP_BuildConfigurationDescriptor\n");
472 // get device extension
474 PDODeviceExtension
= (PPDO_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
477 // get configuration descriptor
479 ConfigurationDescriptor
= PDODeviceExtension
->ConfigurationDescriptor
;
482 // calculate size of configuration descriptor
484 TotalSize
= sizeof(USB_CONFIGURATION_DESCRIPTOR
);
486 for(Index
= 0; Index
< PDODeviceExtension
->FunctionDescriptor
->NumberOfInterfaces
; Index
++)
489 // get current interface descriptor
491 InterfaceDescriptor
= PDODeviceExtension
->FunctionDescriptor
->InterfaceDescriptorList
[Index
];
494 // add to size and move to next descriptor
496 TotalSize
+= InterfaceDescriptor
->bLength
;
497 InterfaceDescriptor
= (PUSB_INTERFACE_DESCRIPTOR
)((ULONG_PTR
)InterfaceDescriptor
+ InterfaceDescriptor
->bLength
);
501 if ((ULONG_PTR
)InterfaceDescriptor
>= ((ULONG_PTR
)ConfigurationDescriptor
+ ConfigurationDescriptor
->wTotalLength
))
504 // reached end of configuration descriptor
510 // association descriptors are removed
512 if (InterfaceDescriptor
->bDescriptorType
!= USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE
)
514 if (InterfaceDescriptor
->bDescriptorType
== USB_INTERFACE_DESCRIPTOR_TYPE
)
517 // reached next descriptor
525 TotalSize
+= InterfaceDescriptor
->bLength
;
529 // move to next descriptor
531 InterfaceDescriptor
= (PUSB_INTERFACE_DESCRIPTOR
)((ULONG_PTR
)InterfaceDescriptor
+ InterfaceDescriptor
->bLength
);
536 // now allocate temporary buffer for the configuration descriptor
538 Buffer
= AllocateItem(NonPagedPool
, TotalSize
);
542 // failed to allocate buffer
544 DPRINT1("[USBCCGP] Failed to allocate %lu Bytes\n", TotalSize
);
545 return STATUS_INSUFFICIENT_RESOURCES
;
549 // first copy the configuration descriptor
551 RtlCopyMemory(Buffer
, ConfigurationDescriptor
, sizeof(USB_CONFIGURATION_DESCRIPTOR
));
552 BufferPtr
= (PUCHAR
)((ULONG_PTR
)Buffer
+ ConfigurationDescriptor
->bLength
);
554 for(Index
= 0; Index
< PDODeviceExtension
->FunctionDescriptor
->NumberOfInterfaces
; Index
++)
557 // get current interface descriptor
559 InterfaceDescriptor
= PDODeviceExtension
->FunctionDescriptor
->InterfaceDescriptorList
[Index
];
562 // copy descriptor and move to next descriptor
564 RtlCopyMemory(BufferPtr
, InterfaceDescriptor
, InterfaceDescriptor
->bLength
);
565 BufferPtr
+= InterfaceDescriptor
->bLength
;
566 InterfaceDescriptor
= (PUSB_INTERFACE_DESCRIPTOR
)((ULONG_PTR
)InterfaceDescriptor
+ InterfaceDescriptor
->bLength
);
570 if ((ULONG_PTR
)InterfaceDescriptor
>= ((ULONG_PTR
)ConfigurationDescriptor
+ ConfigurationDescriptor
->wTotalLength
))
573 // reached end of configuration descriptor
579 // association descriptors are removed
581 if (InterfaceDescriptor
->bDescriptorType
!= USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE
)
583 if (InterfaceDescriptor
->bDescriptorType
== USB_INTERFACE_DESCRIPTOR_TYPE
)
586 // reached next descriptor
594 RtlCopyMemory(BufferPtr
, InterfaceDescriptor
, InterfaceDescriptor
->bLength
);
595 BufferPtr
+= InterfaceDescriptor
->bLength
;
599 // move to next descriptor
601 InterfaceDescriptor
= (PUSB_INTERFACE_DESCRIPTOR
)((ULONG_PTR
)InterfaceDescriptor
+ InterfaceDescriptor
->bLength
);
606 // modify configuration descriptor
608 ConfigurationDescriptor
= Buffer
;
609 ConfigurationDescriptor
->wTotalLength
= TotalSize
;
610 ConfigurationDescriptor
->bNumInterfaces
= PDODeviceExtension
->FunctionDescriptor
->NumberOfInterfaces
;
615 Urb
= (PURB
)IoStack
->Parameters
.Others
.Argument1
;
621 RtlCopyMemory(Urb
->UrbControlDescriptorRequest
.TransferBuffer
, Buffer
, min(TotalSize
, Urb
->UrbControlDescriptorRequest
.TransferBufferLength
));
626 Urb
->UrbControlDescriptorRequest
.TransferBufferLength
= TotalSize
;
636 return STATUS_SUCCESS
;
640 USBCCGP_PDOSelectConfiguration(
641 PDEVICE_OBJECT DeviceObject
,
644 PIO_STACK_LOCATION IoStack
;
645 PPDO_DEVICE_EXTENSION PDODeviceExtension
;
647 PUSBD_INTERFACE_INFORMATION InterfaceInformation
;
648 ULONG InterfaceInformationCount
, Index
, InterfaceIndex
;
649 PUSBD_INTERFACE_LIST_ENTRY Entry
;
650 ULONG NeedSelect
, FoundInterface
;
654 // get current stack location
656 IoStack
= IoGetCurrentIrpStackLocation(Irp
);
659 // get device extension
661 PDODeviceExtension
= (PPDO_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
666 Urb
= (PURB
)IoStack
->Parameters
.Others
.Argument1
;
670 // is there already an configuration handle
672 if (Urb
->UrbSelectConfiguration
.ConfigurationHandle
)
677 return STATUS_SUCCESS
;
681 // count interface information
683 InterfaceInformationCount
= 0;
684 InterfaceInformation
= &Urb
->UrbSelectConfiguration
.Interface
;
687 InterfaceInformationCount
++;
688 InterfaceInformation
= (PUSBD_INTERFACE_INFORMATION
)((ULONG_PTR
)InterfaceInformation
+ InterfaceInformation
->Length
);
689 }while((ULONG_PTR
)InterfaceInformation
< (ULONG_PTR
)Urb
+ Urb
->UrbSelectConfiguration
.Hdr
.Length
);
692 // check all interfaces
694 InterfaceInformation
= &Urb
->UrbSelectConfiguration
.Interface
;
697 DPRINT("Count %x\n", InterfaceInformationCount
);
700 DPRINT1("[USBCCGP] SelectConfiguration Function %x InterfaceNumber %x Alternative %x\n", PDODeviceExtension
->FunctionDescriptor
->FunctionNumber
, InterfaceInformation
->InterfaceNumber
, InterfaceInformation
->AlternateSetting
);
703 // search for the interface in the local interface list
705 FoundInterface
= FALSE
;
706 for(InterfaceIndex
= 0; InterfaceIndex
< PDODeviceExtension
->FunctionDescriptor
->NumberOfInterfaces
; InterfaceIndex
++)
708 if (PDODeviceExtension
->FunctionDescriptor
->InterfaceDescriptorList
[InterfaceIndex
]->bInterfaceNumber
== InterfaceInformation
->InterfaceNumber
)
710 // found interface entry
711 FoundInterface
= TRUE
;
721 DPRINT1("InterfaceInformation InterfaceNumber %x Alternative %x NumberOfPipes %x not found\n", InterfaceInformation
->InterfaceNumber
, InterfaceInformation
->AlternateSetting
, InterfaceInformation
->NumberOfPipes
);
723 return STATUS_INVALID_PARAMETER
;
727 // now query the total interface list
730 for(InterfaceIndex
= 0; InterfaceIndex
< PDODeviceExtension
->InterfaceListCount
; InterfaceIndex
++)
732 if (PDODeviceExtension
->InterfaceList
[InterfaceIndex
].Interface
->InterfaceNumber
== InterfaceInformation
->InterfaceNumber
)
737 Entry
= &PDODeviceExtension
->InterfaceList
[InterfaceIndex
];
748 // corruption detected
754 if (Entry
->InterfaceDescriptor
->bAlternateSetting
== InterfaceInformation
->AlternateSetting
)
757 for(InterfaceIndex
= 0; InterfaceIndex
< InterfaceInformation
->NumberOfPipes
; InterfaceIndex
++)
759 if (InterfaceInformation
->Pipes
[InterfaceIndex
].MaximumTransferSize
!= Entry
->Interface
->Pipes
[InterfaceIndex
].MaximumTransferSize
)
771 // need select as the interface number differ
779 // interface is already selected
781 RtlCopyMemory(InterfaceInformation
, Entry
->Interface
, min(InterfaceInformation
->Length
, Entry
->Interface
->Length
));
788 DPRINT1("Selecting InterfaceIndex %lu AlternateSetting %lu NumberOfPipes %lu\n", InterfaceInformation
->InterfaceNumber
, InterfaceInformation
->AlternateSetting
, InterfaceInformation
->NumberOfPipes
);
789 ASSERT(InterfaceInformation
->Length
== Entry
->Interface
->Length
);
794 NewUrb
= AllocateItem(NonPagedPool
, GET_SELECT_INTERFACE_REQUEST_SIZE(InterfaceInformation
->NumberOfPipes
));
800 return STATUS_INSUFFICIENT_RESOURCES
;
804 // now prepare interface urb
806 UsbBuildSelectInterfaceRequest(NewUrb
, GET_SELECT_INTERFACE_REQUEST_SIZE(InterfaceInformation
->NumberOfPipes
), PDODeviceExtension
->ConfigurationHandle
, InterfaceInformation
->InterfaceNumber
, InterfaceInformation
->AlternateSetting
);
809 // now select the interface
811 Status
= USBCCGP_SyncUrbRequest(PDODeviceExtension
->NextDeviceObject
, NewUrb
);
812 DPRINT1("SelectInterface Status %x\n", Status
);
817 if (NT_SUCCESS(Status
))
820 // update configuration info
822 ASSERT(Entry
->Interface
->Length
== NewUrb
->UrbSelectInterface
.Interface
.Length
);
823 ASSERT(InterfaceInformation
->Length
== NewUrb
->UrbSelectInterface
.Interface
.Length
);
824 RtlCopyMemory(Entry
->Interface
, &NewUrb
->UrbSelectInterface
.Interface
, NewUrb
->UrbSelectInterface
.Interface
.Length
);
827 // update provided interface information
829 RtlCopyMemory(InterfaceInformation
, Entry
->Interface
, Entry
->Interface
->Length
);
839 // move to next information
841 InterfaceInformation
= (PUSBD_INTERFACE_INFORMATION
)((ULONG_PTR
)InterfaceInformation
+ InterfaceInformation
->Length
);
843 }while(Index
< InterfaceInformationCount
);
846 // store configuration handle
848 Urb
->UrbSelectConfiguration
.ConfigurationHandle
= PDODeviceExtension
->ConfigurationHandle
;
850 DPRINT1("[USBCCGP] SelectConfiguration Function %x Completed\n", PDODeviceExtension
->FunctionDescriptor
->FunctionNumber
);
855 return STATUS_SUCCESS
;
859 PDO_HandleInternalDeviceControl(
860 PDEVICE_OBJECT DeviceObject
,
863 PIO_STACK_LOCATION IoStack
;
864 PPDO_DEVICE_EXTENSION PDODeviceExtension
;
869 // get current stack location
871 IoStack
= IoGetCurrentIrpStackLocation(Irp
);
874 // get device extension
876 PDODeviceExtension
= (PPDO_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
878 if (IoStack
->Parameters
.DeviceIoControl
.IoControlCode
== IOCTL_INTERNAL_USB_SUBMIT_URB
)
883 Urb
= (PURB
)IoStack
->Parameters
.Others
.Argument1
;
885 DPRINT("IOCTL_INTERNAL_USB_SUBMIT_URB Function %x\n", Urb
->UrbHeader
.Function
);
887 if (Urb
->UrbHeader
.Function
== URB_FUNCTION_SELECT_CONFIGURATION
)
890 // select configuration
892 Status
= USBCCGP_PDOSelectConfiguration(DeviceObject
, Irp
);
893 Irp
->IoStatus
.Status
= Status
;
894 IoCompleteRequest(Irp
, IO_NO_INCREMENT
);
897 else if (Urb
->UrbHeader
.Function
== URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE
)
899 if(Urb
->UrbControlDescriptorRequest
.DescriptorType
== USB_DEVICE_DESCRIPTOR_TYPE
)
902 // is the buffer big enough
904 if (Urb
->UrbControlDescriptorRequest
.TransferBufferLength
< sizeof(USB_DEVICE_DESCRIPTOR
))
907 // invalid buffer size
909 DPRINT1("[USBCCGP] invalid device descriptor size %lu\n", Urb
->UrbControlDescriptorRequest
.TransferBufferLength
);
910 Urb
->UrbControlDescriptorRequest
.TransferBufferLength
= sizeof(USB_DEVICE_DESCRIPTOR
);
911 Irp
->IoStatus
.Status
= STATUS_INVALID_BUFFER_SIZE
;
912 IoCompleteRequest(Irp
, IO_NO_INCREMENT
);
913 return STATUS_INVALID_BUFFER_SIZE
;
917 // copy device descriptor
919 ASSERT(Urb
->UrbControlDescriptorRequest
.TransferBuffer
);
920 RtlCopyMemory(Urb
->UrbControlDescriptorRequest
.TransferBuffer
, &PDODeviceExtension
->DeviceDescriptor
, sizeof(USB_DEVICE_DESCRIPTOR
));
921 Irp
->IoStatus
.Status
= STATUS_SUCCESS
;
922 IoCompleteRequest(Irp
, IO_NO_INCREMENT
);
923 return STATUS_SUCCESS
;
925 else if (Urb
->UrbControlDescriptorRequest
.DescriptorType
== USB_CONFIGURATION_DESCRIPTOR_TYPE
)
928 // build configuration descriptor
930 Status
= USBCCGP_BuildConfigurationDescriptor(DeviceObject
, Irp
);
931 Irp
->IoStatus
.Status
= Status
;
932 IoCompleteRequest(Irp
, IO_NO_INCREMENT
);
938 IoSkipCurrentIrpStackLocation(Irp
);
939 Status
= IoCallDriver(PDODeviceExtension
->NextDeviceObject
, Irp
);
943 else if (IoStack
->Parameters
.DeviceIoControl
.IoControlCode
== IOCTL_INTERNAL_USB_GET_PORT_STATUS
)
945 IoSkipCurrentIrpStackLocation(Irp
);
946 Status
= IoCallDriver(PDODeviceExtension
->NextDeviceObject
, Irp
);
949 else if (IoStack
->Parameters
.DeviceIoControl
.IoControlCode
== IOCTL_INTERNAL_USB_RESET_PORT
)
951 IoSkipCurrentIrpStackLocation(Irp
);
952 Status
= IoCallDriver(PDODeviceExtension
->NextDeviceObject
, Irp
);
955 else if (IoStack
->Parameters
.DeviceIoControl
.IoControlCode
== IOCTL_INTERNAL_USB_CYCLE_PORT
)
957 IoSkipCurrentIrpStackLocation(Irp
);
958 Status
= IoCallDriver(PDODeviceExtension
->NextDeviceObject
, Irp
);
964 DPRINT1("IOCTL %x\n", IoStack
->Parameters
.DeviceIoControl
.IoControlCode
);
965 DPRINT1("InputBufferLength %lu\n", IoStack
->Parameters
.DeviceIoControl
.InputBufferLength
);
966 DPRINT1("OutputBufferLength %lu\n", IoStack
->Parameters
.DeviceIoControl
.OutputBufferLength
);
967 DPRINT1("Type3InputBuffer %p\n", IoStack
->Parameters
.DeviceIoControl
.Type3InputBuffer
);
971 Irp
->IoStatus
.Status
= STATUS_NOT_IMPLEMENTED
;
972 IoCompleteRequest(Irp
, IO_NO_INCREMENT
);
973 return STATUS_NOT_IMPLEMENTED
;
979 PDEVICE_OBJECT DeviceObject
,
982 PIO_STACK_LOCATION IoStack
;
985 /* get stack location */
986 IoStack
= IoGetCurrentIrpStackLocation(Irp
);
988 switch(IoStack
->MajorFunction
)
991 return PDO_HandlePnp(DeviceObject
, Irp
);
992 case IRP_MJ_INTERNAL_DEVICE_CONTROL
:
993 return PDO_HandleInternalDeviceControl(DeviceObject
, Irp
);
995 DPRINT1("PDO_Dispatch Function %x not implemented\n", IoStack
->MajorFunction
);
997 Status
= Irp
->IoStatus
.Status
;
998 IoCompleteRequest(Irp
, IO_NO_INCREMENT
);