mirror of
https://github.com/reactos/reactos.git
synced 2025-05-27 13:08:23 +00:00
[USBHUB_NEW]
- Implement IOCTL_INTERNAL_USB_GET_PORT_STATUS. - Fixes to comments svn path=/branches/usb-bringup/; revision=51683
This commit is contained in:
parent
b0b03bfdd1
commit
8d98341ac8
4 changed files with 57 additions and 15 deletions
|
@ -112,7 +112,7 @@ GetPortStatusAndChange(
|
||||||
RtlZeroMemory(Urb, sizeof(URB));
|
RtlZeroMemory(Urb, sizeof(URB));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create URB for getting Port Status
|
// Initialize URB for getting Port Status
|
||||||
//
|
//
|
||||||
UsbBuildVendorRequest(Urb,
|
UsbBuildVendorRequest(Urb,
|
||||||
URB_FUNCTION_CLASS_OTHER,
|
URB_FUNCTION_CLASS_OTHER,
|
||||||
|
@ -165,7 +165,7 @@ SetPortFeature(
|
||||||
RtlZeroMemory(Urb, sizeof(URB));
|
RtlZeroMemory(Urb, sizeof(URB));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create URB for Clearing Port Reset
|
// Initialize URB for Clearing Port Reset
|
||||||
//
|
//
|
||||||
UsbBuildVendorRequest(Urb,
|
UsbBuildVendorRequest(Urb,
|
||||||
URB_FUNCTION_CLASS_OTHER,
|
URB_FUNCTION_CLASS_OTHER,
|
||||||
|
@ -217,7 +217,7 @@ ClearPortFeature(
|
||||||
RtlZeroMemory(Urb, sizeof(URB));
|
RtlZeroMemory(Urb, sizeof(URB));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create URB for Clearing Port Reset
|
// Initialize URB for Clearing Port Reset
|
||||||
//
|
//
|
||||||
UsbBuildVendorRequest(Urb,
|
UsbBuildVendorRequest(Urb,
|
||||||
URB_FUNCTION_CLASS_OTHER,
|
URB_FUNCTION_CLASS_OTHER,
|
||||||
|
@ -655,7 +655,7 @@ GetUsbDeviceDescriptor(
|
||||||
RtlZeroMemory(Urb, sizeof(URB));
|
RtlZeroMemory(Urb, sizeof(URB));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create URB for getting device descriptor
|
// Initialize URB for getting device descriptor
|
||||||
//
|
//
|
||||||
UsbBuildGetDescriptorRequest(Urb,
|
UsbBuildGetDescriptorRequest(Urb,
|
||||||
sizeof(Urb->UrbControlDescriptorRequest),
|
sizeof(Urb->UrbControlDescriptorRequest),
|
||||||
|
|
|
@ -137,7 +137,15 @@ USBHUB_PdoHandleInternalDeviceControl(
|
||||||
|
|
||||||
//DPRINT1("UsbhubInternalDeviceControlPdo(%x) called\n", DeviceObject);
|
//DPRINT1("UsbhubInternalDeviceControlPdo(%x) called\n", DeviceObject);
|
||||||
|
|
||||||
|
//
|
||||||
|
// get current stack location
|
||||||
|
//
|
||||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
|
ASSERT(Stack);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Set default status
|
||||||
|
//
|
||||||
Status = Irp->IoStatus.Status;
|
Status = Irp->IoStatus.Status;
|
||||||
|
|
||||||
ChildDeviceExtension = (PHUB_CHILDDEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
ChildDeviceExtension = (PHUB_CHILDDEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||||
|
@ -173,11 +181,6 @@ USBHUB_PdoHandleInternalDeviceControl(
|
||||||
case IOCTL_INTERNAL_USB_SUBMIT_URB:
|
case IOCTL_INTERNAL_USB_SUBMIT_URB:
|
||||||
{
|
{
|
||||||
//DPRINT1("IOCTL_INTERNAL_USB_SUBMIT_URB\n");
|
//DPRINT1("IOCTL_INTERNAL_USB_SUBMIT_URB\n");
|
||||||
//
|
|
||||||
// get current stack location
|
|
||||||
//
|
|
||||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
|
||||||
ASSERT(Stack);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the Urb
|
// Get the Urb
|
||||||
|
@ -229,8 +232,12 @@ USBHUB_PdoHandleInternalDeviceControl(
|
||||||
DPRINT1("Length %x\n", Urb->UrbBulkOrInterruptTransfer.TransferBufferLength);
|
DPRINT1("Length %x\n", Urb->UrbBulkOrInterruptTransfer.TransferBufferLength);
|
||||||
DPRINT1("UrbLink %x\n", Urb->UrbBulkOrInterruptTransfer.UrbLink);
|
DPRINT1("UrbLink %x\n", Urb->UrbBulkOrInterruptTransfer.UrbLink);
|
||||||
DPRINT1("hca %x\n", Urb->UrbBulkOrInterruptTransfer.hca);
|
DPRINT1("hca %x\n", Urb->UrbBulkOrInterruptTransfer.hca);
|
||||||
|
if (Urb->UrbBulkOrInterruptTransfer.TransferFlags == USBD_SHORT_TRANSFER_OK)
|
||||||
|
{
|
||||||
|
}
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
case URB_FUNCTION_CLASS_INTERFACE:
|
case URB_FUNCTION_CLASS_INTERFACE:
|
||||||
DPRINT1("URB_FUNCTION_CLASS_INTERFACE\n");
|
DPRINT1("URB_FUNCTION_CLASS_INTERFACE\n");
|
||||||
|
@ -255,8 +262,39 @@ USBHUB_PdoHandleInternalDeviceControl(
|
||||||
DPRINT1("IOCTL_INTERNAL_USB_RESET_PORT\n");
|
DPRINT1("IOCTL_INTERNAL_USB_RESET_PORT\n");
|
||||||
break;
|
break;
|
||||||
case IOCTL_INTERNAL_USB_GET_PORT_STATUS:
|
case IOCTL_INTERNAL_USB_GET_PORT_STATUS:
|
||||||
|
{
|
||||||
|
PORT_STATUS_CHANGE PortStatus;
|
||||||
|
LONG PortId;
|
||||||
|
PUCHAR PortStatusBits;
|
||||||
|
|
||||||
|
PortStatusBits = (PUCHAR)Stack->Parameters.Others.Argument1;
|
||||||
|
//
|
||||||
|
// USBD_PORT_ENABLED (bit 0) or USBD_PORT_CONNECTED (bit 1)
|
||||||
|
//
|
||||||
DPRINT1("IOCTL_INTERNAL_USB_GET_PORT_STATUS\n");
|
DPRINT1("IOCTL_INTERNAL_USB_GET_PORT_STATUS\n");
|
||||||
|
DPRINT1("Arg1 %x\n", *PortStatusBits);
|
||||||
|
*PortStatusBits = 0;
|
||||||
|
if (Stack->Parameters.Others.Argument1)
|
||||||
|
{
|
||||||
|
for (PortId = 1; PortId <= HubDeviceExtension->UsbExtHubInfo.NumberOfPorts; PortId++)
|
||||||
|
{
|
||||||
|
Status = GetPortStatusAndChange(RootHubDeviceObject, PortId, &PortStatus);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Connect %x\n", ((PortStatus.Status & USB_PORT_STATUS_CONNECT) << 1) << ((PortId - 1) * 2));
|
||||||
|
DPRINT1("Enable %x\n", ((PortStatus.Status & USB_PORT_STATUS_ENABLE) >> 1) << ((PortId - 1) * 2));
|
||||||
|
*PortStatusBits +=
|
||||||
|
((PortStatus.Status & USB_PORT_STATUS_CONNECT) << 1) << ((PortId - 1) * 2) +
|
||||||
|
((PortStatus.Status & USB_PORT_STATUS_ENABLE) >> 1) << ((PortId - 1) * 2);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DPRINT1("Arg1 %x\n", *PortStatusBits);
|
||||||
|
Status = STATUS_SUCCESS;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case IOCTL_INTERNAL_USB_ENABLE_PORT:
|
case IOCTL_INTERNAL_USB_ENABLE_PORT:
|
||||||
DPRINT1("IOCTL_INTERNAL_USB_ENABLE_PORT\n");
|
DPRINT1("IOCTL_INTERNAL_USB_ENABLE_PORT\n");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
* Johannes Anderwald (johannes.anderwald@reactos.org)
|
* Johannes Anderwald (johannes.anderwald@reactos.org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
//#define NDEBUG
|
|
||||||
#include "usbhub.h"
|
#include "usbhub.h"
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
|
@ -61,7 +59,7 @@ USBHUB_AddDevice(
|
||||||
PDEVICE_OBJECT DeviceObject;
|
PDEVICE_OBJECT DeviceObject;
|
||||||
PHUB_DEVICE_EXTENSION HubDeviceExtension;
|
PHUB_DEVICE_EXTENSION HubDeviceExtension;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
DPRINT1("USBHUB: AddDevice\n");
|
||||||
//
|
//
|
||||||
// Create the Device Object
|
// Create the Device Object
|
||||||
//
|
//
|
||||||
|
|
|
@ -162,3 +162,9 @@ DumpConfigurationDescriptor(
|
||||||
VOID
|
VOID
|
||||||
DumpFullConfigurationDescriptor(
|
DumpFullConfigurationDescriptor(
|
||||||
PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor);
|
PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor);
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
GetPortStatusAndChange(
|
||||||
|
IN PDEVICE_OBJECT RootHubDeviceObject,
|
||||||
|
IN ULONG PortId,
|
||||||
|
OUT PPORT_STATUS_CHANGE StatusChange);
|
||||||
|
|
Loading…
Reference in a new issue