win-pvdrivers

changeset 657:a8c1256971e4 0.10.0.104

updates to get 'usbview' showing content
author James Harper <james.harper@bendigoit.com.au>
date Mon Sep 14 00:07:53 2009 +1000 (2009-09-14)
parents 43a106f19847
children b2043e43b2bd
files xenusb/xenusb_fdo.c xenusb/xenusb_hub.c
line diff
     1.1 --- a/xenusb/xenusb_fdo.c	Sat Sep 12 13:44:42 2009 +1000
     1.2 +++ b/xenusb/xenusb_fdo.c	Mon Sep 14 00:07:53 2009 +1000
     1.3 @@ -723,6 +723,216 @@ XenUsb_EvtChildListScanForChildren(WDFCH
     1.4  }
     1.5  
     1.6  static VOID
     1.7 +XenUsb_EvtIoDeviceControl(
     1.8 +  WDFQUEUE queue,
     1.9 +  WDFREQUEST request,
    1.10 +  size_t output_buffer_length,
    1.11 +  size_t input_buffer_length,
    1.12 +  ULONG io_control_code)
    1.13 +{
    1.14 +  NTSTATUS status;
    1.15 +  WDFDEVICE device = WdfIoQueueGetDevice(queue);
    1.16 +  PXENUSB_DEVICE_DATA xudd = GetXudd(device);
    1.17 +  //WDF_REQUEST_PARAMETERS wrp;
    1.18 +  //PURB urb;
    1.19 +  //xenusb_device_t *usb_device;
    1.20 +
    1.21 +  UNREFERENCED_PARAMETER(queue);
    1.22 +  UNREFERENCED_PARAMETER(input_buffer_length);
    1.23 +  UNREFERENCED_PARAMETER(output_buffer_length);
    1.24 +
    1.25 +  FUNCTION_ENTER();
    1.26 +
    1.27 +  status = STATUS_UNSUCCESSFUL;
    1.28 +
    1.29 +  //WDF_REQUEST_PARAMETERS_INIT(&wrp);
    1.30 +  //WdfRequestGetParameters(request, &wrp);
    1.31 +
    1.32 +  // these are in api\usbioctl.h
    1.33 +  switch(io_control_code)
    1.34 +  {
    1.35 +#if 0
    1.36 +  case IOCTL_USB_GET_NODE_INFORMATION:
    1.37 +  {
    1.38 +    PUSB_NODE_INFORMATION uni;
    1.39 +    size_t length;
    1.40 +    
    1.41 +    KdPrint((__DRIVER_NAME "     IOCTL_USB_GET_NODE_INFORMATION\n"));
    1.42 +    KdPrint((__DRIVER_NAME "      output_buffer_length = %d\n", output_buffer_length));
    1.43 +    // make sure size is >= bDescriptorLength
    1.44 +    status = WdfRequestRetrieveOutputBuffer(request, output_buffer_length, (PVOID *)&uni, &length);
    1.45 +    if (NT_SUCCESS(status))
    1.46 +    {
    1.47 +      switch(uni->NodeType)
    1.48 +      {
    1.49 +      case UsbHub:
    1.50 +        KdPrint((__DRIVER_NAME "      NodeType = UsbHub\n"));
    1.51 +        uni->u.HubInformation.HubDescriptor.bDescriptorLength = FIELD_OFFSET(USB_HUB_DESCRIPTOR, bRemoveAndPowerMask) + 3;
    1.52 +        if (output_buffer_length >= FIELD_OFFSET(USB_NODE_INFORMATION, u.HubInformation.HubDescriptor.bRemoveAndPowerMask) + 3)
    1.53 +        {
    1.54 +          uni->u.HubInformation.HubDescriptor.bDescriptorType = 0x29;
    1.55 +          uni->u.HubInformation.HubDescriptor.bNumberOfPorts = 8;
    1.56 +          uni->u.HubInformation.HubDescriptor.wHubCharacteristics = 0x0012; // no power switching no overcurrent protection
    1.57 +          uni->u.HubInformation.HubDescriptor.bPowerOnToPowerGood = 1; // 2ms units
    1.58 +          uni->u.HubInformation.HubDescriptor.bHubControlCurrent = 0;
    1.59 +          // DeviceRemovable bits (includes an extra bit at the start)
    1.60 +          uni->u.HubInformation.HubDescriptor.bRemoveAndPowerMask[0] = 0;
    1.61 +          uni->u.HubInformation.HubDescriptor.bRemoveAndPowerMask[1] = 0;
    1.62 +          // PortPwrCtrlMask
    1.63 +          uni->u.HubInformation.HubDescriptor.bRemoveAndPowerMask[2] = 0xFF;
    1.64 +          uni->u.HubInformation.HubIsBusPowered = TRUE;
    1.65 +        }
    1.66 +        WdfRequestSetInformation(request, FIELD_OFFSET(USB_NODE_INFORMATION, u.HubInformation.HubDescriptor.bRemoveAndPowerMask) + 3);
    1.67 +        break;
    1.68 +      case UsbMIParent:
    1.69 +        KdPrint((__DRIVER_NAME "      NodeType = UsbMIParent\n"));
    1.70 +        status = STATUS_UNSUCCESSFUL;
    1.71 +        break;
    1.72 +      }
    1.73 +    }
    1.74 +    else
    1.75 +    {
    1.76 +      KdPrint((__DRIVER_NAME "     WdfRequestRetrieveOutputBuffer = %08x\n", status));
    1.77 +    }    
    1.78 +    break;
    1.79 +  }
    1.80 +#endif
    1.81 +  case IOCTL_USB_GET_NODE_CONNECTION_INFORMATION:
    1.82 +    KdPrint((__DRIVER_NAME "     IOCTL_USB_GET_NODE_CONNECTION_INFORMATION\n"));
    1.83 +    break;
    1.84 +  case IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION:
    1.85 +    KdPrint((__DRIVER_NAME "     IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION\n"));
    1.86 +    break;
    1.87 +  case IOCTL_USB_GET_NODE_CONNECTION_NAME:
    1.88 +    KdPrint((__DRIVER_NAME "     IOCTL_USB_GET_NODE_CONNECTION_NAME\n"));
    1.89 +    break;
    1.90 +  case IOCTL_USB_DIAG_IGNORE_HUBS_ON:
    1.91 +    KdPrint((__DRIVER_NAME "     IOCTL_USB_DIAG_IGNORE_HUBS_ON\n"));
    1.92 +    break;
    1.93 +  case IOCTL_USB_DIAG_IGNORE_HUBS_OFF:
    1.94 +    KdPrint((__DRIVER_NAME "     IOCTL_USB_DIAG_IGNORE_HUBS_OFF\n"));
    1.95 +    break;
    1.96 +  case IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME:
    1.97 +    KdPrint((__DRIVER_NAME "     IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME\n"));
    1.98 +    break;
    1.99 +  case IOCTL_USB_GET_HUB_CAPABILITIES:
   1.100 +    KdPrint((__DRIVER_NAME "     IOCTL_USB_GET_HUB_CAPABILITIES\n"));
   1.101 +    break;
   1.102 +  case IOCTL_USB_HUB_CYCLE_PORT:
   1.103 +    KdPrint((__DRIVER_NAME "     IOCTL_USB_HUB_CYCLE_PORT\n"));
   1.104 +    break;
   1.105 +  case IOCTL_USB_GET_NODE_CONNECTION_ATTRIBUTES:
   1.106 +    KdPrint((__DRIVER_NAME "     IOCTL_USB_GET_NODE_CONNECTION_ATTRIBUTES\n"));
   1.107 +    break;
   1.108 +  case IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX:
   1.109 +    KdPrint((__DRIVER_NAME "     IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX\n"));
   1.110 +    break;
   1.111 +  case IOCTL_USB_GET_ROOT_HUB_NAME:
   1.112 +  {
   1.113 +    PUSB_HCD_DRIVERKEY_NAME uhdn;
   1.114 +    size_t length;
   1.115 +    
   1.116 +    KdPrint((__DRIVER_NAME "     IOCTL_USB_GET_ROOT_HUB_NAME\n"));
   1.117 +    KdPrint((__DRIVER_NAME "      output_buffer_length = %d\n", output_buffer_length));
   1.118 +      
   1.119 +    if (output_buffer_length < sizeof(USB_HCD_DRIVERKEY_NAME))
   1.120 +      status = STATUS_INSUFFICIENT_RESOURCES;
   1.121 +    else
   1.122 +    {
   1.123 +      status = WdfRequestRetrieveOutputBuffer(request, output_buffer_length, (PVOID *)&uhdn, &length);
   1.124 +      if (NT_SUCCESS(status))
   1.125 +      {
   1.126 +        WDFSTRING symbolic_link_wdfstring;
   1.127 +        UNICODE_STRING symbolic_link;
   1.128 +        
   1.129 +        uhdn->DriverKeyName[0] = 0;
   1.130 +        status = WdfStringCreate(NULL, WDF_NO_OBJECT_ATTRIBUTES, &symbolic_link_wdfstring);
   1.131 +        status = WdfDeviceRetrieveDeviceInterfaceString(xudd->root_hub_device, &GUID_DEVINTERFACE_USB_HUB, NULL, symbolic_link_wdfstring);
   1.132 +        if (NT_SUCCESS(status))
   1.133 +        {
   1.134 +          WdfStringGetUnicodeString(symbolic_link_wdfstring, &symbolic_link);
   1.135 +          /* remove leading \??\ from name */
   1.136 +          symbolic_link.Buffer += 4;
   1.137 +          symbolic_link.Length -= 4 * sizeof(WCHAR);
   1.138 +          uhdn->ActualLength = FIELD_OFFSET(USB_HCD_DRIVERKEY_NAME, DriverKeyName) + symbolic_link.Length + sizeof(WCHAR);
   1.139 +          if (output_buffer_length >= uhdn->ActualLength)
   1.140 +          {
   1.141 +            memcpy(uhdn->DriverKeyName, symbolic_link.Buffer, symbolic_link.Length);
   1.142 +            uhdn->DriverKeyName[symbolic_link.Length / 2] = 0;
   1.143 +          }
   1.144 +        }
   1.145 +        else
   1.146 +        {
   1.147 +          KdPrint((__DRIVER_NAME "     WdfDeviceRetrieveDeviceInterfaceString = %08x\n", status));
   1.148 +          status = STATUS_INVALID_PARAMETER;
   1.149 +        }
   1.150 +      }
   1.151 +      else
   1.152 +      {
   1.153 +        KdPrint((__DRIVER_NAME "     WdfRequestRetrieveOutputBuffer = %08x\n", status));
   1.154 +      }
   1.155 +      KdPrint((__DRIVER_NAME "      uhdn->ActualLength = %d\n", uhdn->ActualLength));
   1.156 +      KdPrint((__DRIVER_NAME "      uhdn->DriverKeyName = %S\n", uhdn->DriverKeyName));
   1.157 +      WdfRequestSetInformation(request, uhdn->ActualLength);
   1.158 +    }
   1.159 +    break;
   1.160 +  }
   1.161 +  case IOCTL_GET_HCD_DRIVERKEY_NAME:
   1.162 +  {
   1.163 +    PUSB_HCD_DRIVERKEY_NAME uhdn;
   1.164 +    size_t length;
   1.165 +    
   1.166 +    KdPrint((__DRIVER_NAME "     IOCTL_GET_HCD_DRIVERKEY_NAME\n"));
   1.167 +    KdPrint((__DRIVER_NAME "      output_buffer_length = %d\n", output_buffer_length));
   1.168 +      
   1.169 +    if (output_buffer_length < sizeof(USB_HCD_DRIVERKEY_NAME))
   1.170 +      status = STATUS_INSUFFICIENT_RESOURCES;
   1.171 +    else
   1.172 +    {
   1.173 +      status = WdfRequestRetrieveOutputBuffer(request, output_buffer_length, (PVOID *)&uhdn, &length);
   1.174 +      if (NT_SUCCESS(status))
   1.175 +      {
   1.176 +        ULONG key_length;
   1.177 +        status = WdfDeviceQueryProperty(device, DevicePropertyDriverKeyName, 0, NULL, &key_length);
   1.178 +        status = STATUS_SUCCESS;
   1.179 +        uhdn->ActualLength = FIELD_OFFSET(USB_HCD_DRIVERKEY_NAME, DriverKeyName) + key_length;
   1.180 +        if (output_buffer_length >= uhdn->ActualLength)
   1.181 +        {
   1.182 +          status = WdfDeviceQueryProperty(device, DevicePropertyDriverKeyName, 
   1.183 +            uhdn->ActualLength - FIELD_OFFSET(USB_HCD_DRIVERKEY_NAME, DriverKeyName), uhdn->DriverKeyName,
   1.184 +            &key_length);
   1.185 +        }
   1.186 +        else
   1.187 +        {
   1.188 +          uhdn->DriverKeyName[0] = 0;
   1.189 +        }
   1.190 +      }
   1.191 +      else
   1.192 +      {
   1.193 +        KdPrint((__DRIVER_NAME "     WdfRequestRetrieveOutputBuffer = %08x\n", status));
   1.194 +      }
   1.195 +      KdPrint((__DRIVER_NAME "      uhdn->ActualLength = %d\n", uhdn->ActualLength));
   1.196 +      KdPrint((__DRIVER_NAME "      uhdn->DriverKeyName = %S\n", uhdn->DriverKeyName));
   1.197 +      WdfRequestSetInformation(request, uhdn->ActualLength);
   1.198 +    }
   1.199 +    break;
   1.200 +  }
   1.201 +#if 0
   1.202 +  case IOCTL_USB_RESET_HUB:
   1.203 +    KdPrint((__DRIVER_NAME "     IOCTL_USB_RESET_HUB\n"));
   1.204 +    break;
   1.205 +#endif
   1.206 +  default:
   1.207 +    KdPrint((__DRIVER_NAME "     Unknown IOCTL %08x\n", io_control_code));
   1.208 +    break;
   1.209 +  }
   1.210 +  KdPrint((__DRIVER_NAME "     Calling WdfRequestComplete with status = %08x\n", status));
   1.211 +  WdfRequestComplete(request, status);
   1.212 +
   1.213 +  FUNCTION_EXIT();
   1.214 +}
   1.215 +
   1.216 +static VOID
   1.217  XenUsb_EvtIoInternalDeviceControl(
   1.218    WDFQUEUE queue,
   1.219    WDFREQUEST request,
   1.220 @@ -756,6 +966,53 @@ XenUsb_EvtIoInternalDeviceControl(
   1.221    FUNCTION_EXIT();
   1.222  }
   1.223  
   1.224 +static VOID
   1.225 +XenUsb_EvtIoDefault(
   1.226 +  WDFQUEUE queue,
   1.227 +  WDFREQUEST request)
   1.228 +{
   1.229 +  NTSTATUS status;
   1.230 +  WDF_REQUEST_PARAMETERS parameters;
   1.231 +
   1.232 +  FUNCTION_ENTER();
   1.233 +
   1.234 +  UNREFERENCED_PARAMETER(queue);
   1.235 +
   1.236 +  status = STATUS_UNSUCCESSFUL;
   1.237 +
   1.238 +  WDF_REQUEST_PARAMETERS_INIT(&parameters);
   1.239 +  WdfRequestGetParameters(request, &parameters);
   1.240 +
   1.241 +  switch (parameters.Type)
   1.242 +  {
   1.243 +  case WdfRequestTypeCreate:
   1.244 +    KdPrint((__DRIVER_NAME "     WdfRequestTypeCreate\n"));
   1.245 +    break;
   1.246 +  case WdfRequestTypeClose:
   1.247 +    KdPrint((__DRIVER_NAME "     WdfRequestTypeClose\n"));
   1.248 +    break;
   1.249 +  case WdfRequestTypeRead:
   1.250 +    KdPrint((__DRIVER_NAME "     WdfRequestTypeRead\n"));
   1.251 +    break;
   1.252 +  case WdfRequestTypeWrite:
   1.253 +    KdPrint((__DRIVER_NAME "     WdfRequestTypeWrite\n"));
   1.254 +    break;
   1.255 +  case WdfRequestTypeDeviceControl:
   1.256 +    KdPrint((__DRIVER_NAME "     WdfRequestTypeDeviceControl\n"));
   1.257 +    
   1.258 +    break;
   1.259 +  case WdfRequestTypeDeviceControlInternal:
   1.260 +    KdPrint((__DRIVER_NAME "     WdfRequestTypeDeviceControlInternal\n"));
   1.261 +    break;
   1.262 +  default:
   1.263 +    KdPrint((__DRIVER_NAME "     Unknown type %x\n", parameters.Type));
   1.264 +    break;
   1.265 +  }
   1.266 +  WdfRequestComplete(request, status);  
   1.267 +
   1.268 +  FUNCTION_EXIT();
   1.269 +}
   1.270 +
   1.271  NTSTATUS
   1.272  XenUsb_EvtDriverDeviceAdd(WDFDRIVER driver, PWDFDEVICE_INIT device_init)
   1.273  {
   1.274 @@ -829,7 +1086,9 @@ XenUsb_EvtDriverDeviceAdd(WDFDRIVER driv
   1.275    }
   1.276  
   1.277    WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&queue_config, WdfIoQueueDispatchParallel);
   1.278 +  queue_config.EvtIoDeviceControl = XenUsb_EvtIoDeviceControl;
   1.279    queue_config.EvtIoInternalDeviceControl = XenUsb_EvtIoInternalDeviceControl;
   1.280 +  queue_config.EvtIoDefault = XenUsb_EvtIoDefault;
   1.281    status = WdfIoQueueCreate(device, &queue_config, WDF_NO_OBJECT_ATTRIBUTES, &xudd->io_queue);
   1.282    if (!NT_SUCCESS(status)) {
   1.283        KdPrint((__DRIVER_NAME "     Error creating io_queue 0x%x\n", status));
   1.284 @@ -857,6 +1116,12 @@ XenUsb_EvtDriverDeviceAdd(WDFDRIVER driv
   1.285    pbi.BusNumber = 0;
   1.286    WdfDeviceSetBusInformationForChildren(device, &pbi);
   1.287  
   1.288 +  status = WdfDeviceCreateDeviceInterface(device, &GUID_DEVINTERFACE_USB_HOST_CONTROLLER, NULL);
   1.289 +  if (!NT_SUCCESS(status))
   1.290 +    return status;
   1.291 +
   1.292 +  //status = WdfDeviceOpenRegistryKey(device, 
   1.293 +  
   1.294    FUNCTION_EXIT();
   1.295    return status;
   1.296  }
     2.1 --- a/xenusb/xenusb_hub.c	Sat Sep 12 13:44:42 2009 +1000
     2.2 +++ b/xenusb/xenusb_hub.c	Mon Sep 14 00:07:53 2009 +1000
     2.3 @@ -55,6 +55,7 @@ XenUsbHub_EvtIoDefault(
     2.4      break;
     2.5    case WdfRequestTypeDeviceControl:
     2.6      KdPrint((__DRIVER_NAME "     WdfRequestTypeDeviceControl\n"));
     2.7 +    
     2.8      break;
     2.9    case WdfRequestTypeDeviceControlInternal:
    2.10      KdPrint((__DRIVER_NAME "     WdfRequestTypeDeviceControlInternal\n"));
    2.11 @@ -68,7 +69,6 @@ XenUsbHub_EvtIoDefault(
    2.12    FUNCTION_EXIT();
    2.13  }
    2.14  
    2.15 -
    2.16  static NTSTATUS
    2.17  XenUsbHub_BusIrpCompletionRoutine(
    2.18    PDEVICE_OBJECT device_object,
    2.19 @@ -90,6 +90,81 @@ XenUsbHub_BusIrpCompletionRoutine(
    2.20  }
    2.21  
    2.22  static VOID
    2.23 +XenUsbHub_EvtIoDeviceControl(
    2.24 +  WDFQUEUE queue,
    2.25 +  WDFREQUEST request,
    2.26 +  size_t output_buffer_length,
    2.27 +  size_t input_buffer_length,
    2.28 +  ULONG io_control_code)
    2.29 +{
    2.30 +  NTSTATUS status;
    2.31 +  //WDFDEVICE device = WdfIoQueueGetDevice(queue);
    2.32 +  //PXENUSB_PDO_DEVICE_DATA xupdd = GetXupdd(device);
    2.33 +  //WDF_REQUEST_PARAMETERS wrp;
    2.34 +  //PURB urb;
    2.35 +  //xenusb_device_t *usb_device;
    2.36 +
    2.37 +  UNREFERENCED_PARAMETER(queue);
    2.38 +  UNREFERENCED_PARAMETER(input_buffer_length);
    2.39 +  UNREFERENCED_PARAMETER(output_buffer_length);
    2.40 +
    2.41 +  FUNCTION_ENTER();
    2.42 +
    2.43 +  status = STATUS_UNSUCCESSFUL;
    2.44 +
    2.45 +  //WDF_REQUEST_PARAMETERS_INIT(&wrp);
    2.46 +  //WdfRequestGetParameters(request, &wrp);
    2.47 +
    2.48 +  // these are in api\usbioctl.h
    2.49 +  switch(io_control_code)
    2.50 +  {
    2.51 +  case IOCTL_USB_GET_NODE_INFORMATION:
    2.52 +    KdPrint((__DRIVER_NAME "     IOCTL_USB_GET_NODE_INFORMATION\n"));
    2.53 +    break;
    2.54 +  case IOCTL_USB_GET_NODE_CONNECTION_INFORMATION:
    2.55 +    KdPrint((__DRIVER_NAME "     IOCTL_USB_GET_NODE_CONNECTION_INFORMATION\n"));
    2.56 +    break;
    2.57 +  case IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION:
    2.58 +    KdPrint((__DRIVER_NAME "     IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION\n"));
    2.59 +    break;
    2.60 +  case IOCTL_USB_GET_NODE_CONNECTION_NAME:
    2.61 +    KdPrint((__DRIVER_NAME "     IOCTL_USB_GET_NODE_CONNECTION_NAME\n"));
    2.62 +    break;
    2.63 +  case IOCTL_USB_DIAG_IGNORE_HUBS_ON:
    2.64 +    KdPrint((__DRIVER_NAME "     IOCTL_USB_DIAG_IGNORE_HUBS_ON\n"));
    2.65 +    break;
    2.66 +  case IOCTL_USB_DIAG_IGNORE_HUBS_OFF:
    2.67 +    KdPrint((__DRIVER_NAME "     IOCTL_USB_DIAG_IGNORE_HUBS_OFF\n"));
    2.68 +    break;
    2.69 +  case IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME:
    2.70 +    KdPrint((__DRIVER_NAME "     IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME\n"));
    2.71 +    break;
    2.72 +  case IOCTL_USB_GET_HUB_CAPABILITIES:
    2.73 +    KdPrint((__DRIVER_NAME "     IOCTL_USB_GET_HUB_CAPABILITIES\n"));
    2.74 +    break;
    2.75 +  case IOCTL_USB_HUB_CYCLE_PORT:
    2.76 +    KdPrint((__DRIVER_NAME "     IOCTL_USB_HUB_CYCLE_PORT\n"));
    2.77 +    break;
    2.78 +  case IOCTL_USB_GET_NODE_CONNECTION_ATTRIBUTES:
    2.79 +    KdPrint((__DRIVER_NAME "     IOCTL_USB_GET_NODE_CONNECTION_ATTRIBUTES\n"));
    2.80 +    break;
    2.81 +  case IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX:
    2.82 +    KdPrint((__DRIVER_NAME "     IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX\n"));
    2.83 +    break;
    2.84 +  case IOCTL_GET_HCD_DRIVERKEY_NAME:
    2.85 +    KdPrint((__DRIVER_NAME "     IOCTL_GET_HCD_DRIVERKEY_NAME\n"));
    2.86 +    break;
    2.87 +  default:
    2.88 +    KdPrint((__DRIVER_NAME "     Unknown IOCTL %08x\n", io_control_code));
    2.89 +    break;
    2.90 +  }
    2.91 +  KdPrint((__DRIVER_NAME "     Calling WdfRequestComplete with status = %08x\n", status));
    2.92 +  WdfRequestComplete(request, status);
    2.93 +
    2.94 +  FUNCTION_EXIT();
    2.95 +}
    2.96 +
    2.97 +static VOID
    2.98  XenUsbHub_EvtIoInternalDeviceControl(
    2.99    WDFQUEUE queue,
   2.100    WDFREQUEST request,
   2.101 @@ -570,27 +645,6 @@ XenPciPdo_UBIH_InitializeUsbDevice(
   2.102      }
   2.103    }
   2.104  
   2.105 -#if 0
   2.106 -  WdfSpinLockCreate(WDF_NO_OBJECT_ATTRIBUTES, &usb_device->configs[0]->interfaces[0]->endpoints[0]->interrupt_lock);
   2.107 -  WDF_TIMER_CONFIG_INIT(&timer_config, XenUsbHub_HubInterruptTimer);  
   2.108 -  WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&timer_attributes, pxenusb_endpoint_t);
   2.109 -  timer_attributes.ParentObject = child_device;
   2.110 -  status = WdfTimerCreate(&timer_config, &timer_attributes, &usb_device->configs[0]->interfaces[0]->endpoints[0]->interrupt_timer);
   2.111 -  if (!NT_SUCCESS(status)) {
   2.112 -      KdPrint((__DRIVER_NAME "     Error creating timer 0x%x\n", status));
   2.113 -      return status;
   2.114 -  }
   2.115 -  *GetEndpoint(usb_device->configs[0]->interfaces[0]->endpoints[0]->interrupt_timer) = usb_device->configs[0]->interfaces[0]->endpoints[0];
   2.116 -  WDF_IO_QUEUE_CONFIG_INIT(&queue_config, WdfIoQueueDispatchManual);
   2.117 -  //queue_config.PowerManaged = TRUE;
   2.118 -  status = WdfIoQueueCreate(child_device, &queue_config, WDF_NO_OBJECT_ATTRIBUTES,
   2.119 -    &usb_device->configs[0]->interfaces[0]->endpoints[0]->interrupt_queue);
   2.120 -  if (!NT_SUCCESS(status)) {
   2.121 -      KdPrint((__DRIVER_NAME "     Error creating timer io_queue 0x%x\n", status));
   2.122 -      return status;
   2.123 -  }
   2.124 -#endif
   2.125 -  
   2.126    WDF_IO_QUEUE_CONFIG_INIT(&queue_config, WdfIoQueueDispatchParallel);
   2.127    queue_config.EvtIoInternalDeviceControl = XenUsb_EvtIoInternalDeviceControl_DEVICE_SUBMIT_URB;
   2.128    queue_config.PowerManaged = TRUE; /* power managed queue for SUBMIT_URB */
   2.129 @@ -1350,6 +1404,7 @@ XenUsb_EvtChildListCreateDevice(WDFCHILD
   2.130  
   2.131    WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&queue_config, WdfIoQueueDispatchParallel);
   2.132    queue_config.EvtIoInternalDeviceControl = XenUsbHub_EvtIoInternalDeviceControl;
   2.133 +  queue_config.EvtIoDeviceControl = XenUsbHub_EvtIoDeviceControl;
   2.134    queue_config.EvtIoDefault = XenUsbHub_EvtIoDefault;
   2.135    /* can't be power managed or deadlocks occur */
   2.136    queue_config.PowerManaged = FALSE;
   2.137 @@ -1427,7 +1482,11 @@ XenUsb_EvtChildListCreateDevice(WDFCHILD
   2.138    status = WdfDeviceAddQueryInterface(child_device, &interface_config);
   2.139    if (!NT_SUCCESS(status))
   2.140      return status;
   2.141 -    
   2.142 +  
   2.143 +  status = WdfDeviceCreateDeviceInterface(child_device, &GUID_DEVINTERFACE_USB_HUB, NULL);
   2.144 +  if (!NT_SUCCESS(status))
   2.145 +    return status;
   2.146 +
   2.147    FUNCTION_EXIT();
   2.148    
   2.149    return status;