From: Stanislav Petrenko on 5 Feb 2007 11:25 Hi All. I am using wdf to make a usb dfu driver. Trying to reset USB device through the call of WdfUsbTargetDeviceResetPortSynchronously or WdfUsbTargetDeviceCyclePortSynchronously I see in the trace that both of them reset device twice. That behavior prevents dfu from proper work. Is it made intentionally? Or am I wrong? How to reset device just single time using wdf? -- Thanks, Stanislav.
From: Doron Holan [MS] on 5 Feb 2007 22:25 If a reset is being sent twice, it has nothing to do with KMDF. It would have to be in the usb core. WdfUsbTargetDeviceResetPortSynchronously just sends a IOCTL_INTERNAL_USB_RESET_PORT, WdfUsbTargetDeviceCyclePortSynchronously just sends a IOCTL_INTERNAL_USB_CYCLE_PORT. Both of these functions just send the IRP once. What OS and what host controller are you seeing this on? Are you sure that you are not calling WdfUsbTargetDeviceResetPort/CyclePortSynchronously twice in 2 different threads? In which callback(s) are you making the call to these DDIs? d -- Please do not send e-mail directly to this alias. this alias is for newsgroup purposes only. This posting is provided "AS IS" with no warranties, and confers no rights. "Stanislav Petrenko" <StanislavPetrenko(a)discussions.microsoft.com> wrote in message news:9410B811-AFAE-4EEB-A772-92F68CC0C300(a)microsoft.com... > Hi All. > > I am using wdf to make a usb dfu driver. Trying to reset USB device > through > the call of WdfUsbTargetDeviceResetPortSynchronously or > WdfUsbTargetDeviceCyclePortSynchronously I see in the trace that both of > them > reset device twice. That behavior prevents dfu from proper work. > > Is it made intentionally? Or am I wrong? How to reset device just single > time using wdf? > > -- > Thanks, Stanislav.
From: Stanislav Petrenko on 6 Feb 2007 09:05 Hi Doron, Thanks for reply. The behavior is observed on the Windows XP SP1. I see it on both USB 1.1 and 2.0. In the USB trace I see Suspend Reset Get Descriptor Reset Set Address Get Descriptor Get Descriptor and so on... The time between two reset packets is small, less than 100 milliseconds. So if DFU DETACH request is accepted and DFU mode is activated, the second reset puts device back into Run-Time mode. --- The code for device reset is actually very simple and I am sure it is called just once. VOID EventIoDeviceControl( IN WDFQUEUE Queue, IN WDFREQUEST Request, IN size_t OutputBufferLength, IN size_t InputBufferLength, IN ULONG IoControlCode ) { WDFDEVICE device = WdfIoQueueGetDevice(Queue); PDEVICE_CONTEXT pDeviceContext = GetDeviceContext(device); size_t bytesTransferred = 0; NTSTATUS status; WDF_USB_CONTROL_SETUP_PACKET controlSetupPacket; UNREFERENCED_PARAMETER(InputBufferLength); UNREFERENCED_PARAMETER(OutputBufferLength); switch(IoControlCode) { case IOCTL_USBXDFU_RESET: { KdPrint(("IOCTL_USBXDFU_RESET\n")); status = WdfUsbTargetDeviceCyclePortSynchronously( pDeviceContext->UsbDevice ); if (!NT_SUCCESS(status)) { KdPrint(("RESET failed.\n")); break; } } break; default: status = STATUS_INVALID_DEVICE_REQUEST; break; } WdfRequestCompleteWithInformation( Request, status, bytesTransferred ); } -- Thanks, Stanislav. "Doron Holan [MS]" wrote: > If a reset is being sent twice, it has nothing to do with KMDF. It would > have > to be in the usb core. WdfUsbTargetDeviceResetPortSynchronously just sends > a > IOCTL_INTERNAL_USB_RESET_PORT, WdfUsbTargetDeviceCyclePortSynchronously > just > sends a IOCTL_INTERNAL_USB_CYCLE_PORT. Both of these functions just send > the > IRP once. > > What OS and what host controller are you seeing this on? Are you sure that > you > are not calling WdfUsbTargetDeviceResetPort/CyclePortSynchronously twice in > 2 > different threads? In which callback(s) are you making the call to these > DDIs? > > d > > -- > Please do not send e-mail directly to this alias. this alias is for > newsgroup purposes only. > This posting is provided "AS IS" with no warranties, and confers no rights. > > > "Stanislav Petrenko" <StanislavPetrenko(a)discussions.microsoft.com> wrote in > message news:9410B811-AFAE-4EEB-A772-92F68CC0C300(a)microsoft.com... > > Hi All. > > > > I am using wdf to make a usb dfu driver. Trying to reset USB device > > through > > the call of WdfUsbTargetDeviceResetPortSynchronously or > > WdfUsbTargetDeviceCyclePortSynchronously I see in the trace that both of > > them > > reset device twice. That behavior prevents dfu from proper work. > > > > Is it made intentionally? Or am I wrong? How to reset device just single > > time using wdf? > > > > -- > > Thanks, Stanislav. > > >
From: Stanislav Petrenko on 6 Feb 2007 12:06 The issue is solved. Thanks a lot. :-) -- Thanks, Stanislav. "Stanislav Petrenko" wrote: > Hi Doron, > > Thanks for reply. > > The behavior is observed on the Windows XP SP1. I see it on both USB 1.1 and > 2.0. > In the USB trace I see > Suspend > Reset > Get Descriptor > Reset > Set Address > Get Descriptor > Get Descriptor > and so on... > > The time between two reset packets is small, less than 100 milliseconds. So > if DFU DETACH request is accepted and DFU mode is activated, the second reset > puts device back into Run-Time mode. > > --- > > The code for device reset is actually very simple and I am sure it is called > just once. > > VOID > EventIoDeviceControl( > IN WDFQUEUE Queue, > IN WDFREQUEST Request, > IN size_t OutputBufferLength, > IN size_t InputBufferLength, > IN ULONG IoControlCode > ) > { > WDFDEVICE device = WdfIoQueueGetDevice(Queue); > PDEVICE_CONTEXT pDeviceContext = GetDeviceContext(device); > size_t bytesTransferred = 0; > NTSTATUS status; > WDF_USB_CONTROL_SETUP_PACKET controlSetupPacket; > > UNREFERENCED_PARAMETER(InputBufferLength); > UNREFERENCED_PARAMETER(OutputBufferLength); > > switch(IoControlCode) > { > case IOCTL_USBXDFU_RESET: > { > KdPrint(("IOCTL_USBXDFU_RESET\n")); > > status = WdfUsbTargetDeviceCyclePortSynchronously( > pDeviceContext->UsbDevice > ); > if (!NT_SUCCESS(status)) > { > KdPrint(("RESET failed.\n")); > break; > } > } > break; > default: > status = STATUS_INVALID_DEVICE_REQUEST; > break; > } > > WdfRequestCompleteWithInformation( > Request, > status, > bytesTransferred > ); > } > > -- > Thanks, Stanislav. > > > > > "Doron Holan [MS]" wrote: > > > If a reset is being sent twice, it has nothing to do with KMDF. It would > > have > > to be in the usb core. WdfUsbTargetDeviceResetPortSynchronously just sends > > a > > IOCTL_INTERNAL_USB_RESET_PORT, WdfUsbTargetDeviceCyclePortSynchronously > > just > > sends a IOCTL_INTERNAL_USB_CYCLE_PORT. Both of these functions just send > > the > > IRP once. > > > > What OS and what host controller are you seeing this on? Are you sure that > > you > > are not calling WdfUsbTargetDeviceResetPort/CyclePortSynchronously twice in > > 2 > > different threads? In which callback(s) are you making the call to these > > DDIs? > > > > d > > > > -- > > Please do not send e-mail directly to this alias. this alias is for > > newsgroup purposes only. > > This posting is provided "AS IS" with no warranties, and confers no rights. > > > > > > "Stanislav Petrenko" <StanislavPetrenko(a)discussions.microsoft.com> wrote in > > message news:9410B811-AFAE-4EEB-A772-92F68CC0C300(a)microsoft.com... > > > Hi All. > > > > > > I am using wdf to make a usb dfu driver. Trying to reset USB device > > > through > > > the call of WdfUsbTargetDeviceResetPortSynchronously or > > > WdfUsbTargetDeviceCyclePortSynchronously I see in the trace that both of > > > them > > > reset device twice. That behavior prevents dfu from proper work. > > > > > > Is it made intentionally? Or am I wrong? How to reset device just single > > > time using wdf? > > > > > > -- > > > Thanks, Stanislav. > > > > > >
From: Doron Holan [MS] on 6 Feb 2007 22:26 what was the problem? -- Please do not send e-mail directly to this alias. this alias is for newsgroup purposes only. This posting is provided "AS IS" with no warranties, and confers no rights. "Stanislav Petrenko" <StanislavPetrenko(a)discussions.microsoft.com> wrote in message news:5D002FE2-D10F-43D3-9A47-4A1732684D67(a)microsoft.com... > The issue is solved. Thanks a lot. > > :-) > > -- > Thanks, Stanislav. > > > "Stanislav Petrenko" wrote: > >> Hi Doron, >> >> Thanks for reply. >> >> The behavior is observed on the Windows XP SP1. I see it on both USB 1.1 >> and >> 2.0. >> In the USB trace I see >> Suspend >> Reset >> Get Descriptor >> Reset >> Set Address >> Get Descriptor >> Get Descriptor >> and so on... >> >> The time between two reset packets is small, less than 100 milliseconds. >> So >> if DFU DETACH request is accepted and DFU mode is activated, the second >> reset >> puts device back into Run-Time mode. >> >> --- >> >> The code for device reset is actually very simple and I am sure it is >> called >> just once. >> >> VOID >> EventIoDeviceControl( >> IN WDFQUEUE Queue, >> IN WDFREQUEST Request, >> IN size_t OutputBufferLength, >> IN size_t InputBufferLength, >> IN ULONG IoControlCode >> ) >> { >> WDFDEVICE device = WdfIoQueueGetDevice(Queue); >> PDEVICE_CONTEXT pDeviceContext = GetDeviceContext(device); >> size_t bytesTransferred = 0; >> NTSTATUS status; >> WDF_USB_CONTROL_SETUP_PACKET controlSetupPacket; >> >> UNREFERENCED_PARAMETER(InputBufferLength); >> UNREFERENCED_PARAMETER(OutputBufferLength); >> >> switch(IoControlCode) >> { >> case IOCTL_USBXDFU_RESET: >> { >> KdPrint(("IOCTL_USBXDFU_RESET\n")); >> >> status = WdfUsbTargetDeviceCyclePortSynchronously( >> pDeviceContext->UsbDevice >> ); >> if (!NT_SUCCESS(status)) >> { >> KdPrint(("RESET failed.\n")); >> break; >> } >> } >> break; >> default: >> status = STATUS_INVALID_DEVICE_REQUEST; >> break; >> } >> >> WdfRequestCompleteWithInformation( >> Request, >> status, >> bytesTransferred >> ); >> } >> >> -- >> Thanks, Stanislav. >> >> >> >> >> "Doron Holan [MS]" wrote: >> >> > If a reset is being sent twice, it has nothing to do with KMDF. It >> > would >> > have >> > to be in the usb core. WdfUsbTargetDeviceResetPortSynchronously just >> > sends >> > a >> > IOCTL_INTERNAL_USB_RESET_PORT, WdfUsbTargetDeviceCyclePortSynchronously >> > just >> > sends a IOCTL_INTERNAL_USB_CYCLE_PORT. Both of these functions just >> > send >> > the >> > IRP once. >> > >> > What OS and what host controller are you seeing this on? Are you sure >> > that >> > you >> > are not calling WdfUsbTargetDeviceResetPort/CyclePortSynchronously >> > twice in >> > 2 >> > different threads? In which callback(s) are you making the call to >> > these >> > DDIs? >> > >> > d >> > >> > -- >> > Please do not send e-mail directly to this alias. this alias is for >> > newsgroup purposes only. >> > This posting is provided "AS IS" with no warranties, and confers no >> > rights. >> > >> > >> > "Stanislav Petrenko" <StanislavPetrenko(a)discussions.microsoft.com> >> > wrote in >> > message news:9410B811-AFAE-4EEB-A772-92F68CC0C300(a)microsoft.com... >> > > Hi All. >> > > >> > > I am using wdf to make a usb dfu driver. Trying to reset USB device >> > > through >> > > the call of WdfUsbTargetDeviceResetPortSynchronously or >> > > WdfUsbTargetDeviceCyclePortSynchronously I see in the trace that both >> > > of >> > > them >> > > reset device twice. That behavior prevents dfu from proper work. >> > > >> > > Is it made intentionally? Or am I wrong? How to reset device just >> > > single >> > > time using wdf? >> > > >> > > -- >> > > Thanks, Stanislav. >> > >> > >> >
|
Next
|
Last
Pages: 1 2 Prev: Widcomm bluetooth drivers Next: ScsiPort miniport driver to StorPort miniport driver porting |