Re: WDF supplied functions send reset packet twice through USB



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@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:5D002FE2-D10F-43D3-9A47-4A1732684D67@xxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote in
message news:9410B811-AFAE-4EEB-A772-92F68CC0C300@xxxxxxxxxxxxxxxx
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.





.



Relevant Pages

  • Re: WDF supplied functions send reset packet twice through USB
    ... Due to USB DFU spec the second reset should not ... bring device back into Run-Time mode. ... So now I just ignore that two reset packets are actually ...
    (microsoft.public.development.device.drivers)
  • Re: WDF supplied functions send reset packet twice through USB
    ... In the USB trace I see ... The time between two reset packets is small, ... if DFU DETACH request is accepted and DFU mode is activated, ... I am using wdf to make a usb dfu driver. ...
    (microsoft.public.development.device.drivers)
  • Re: WDF supplied functions send reset packet twice through USB
    ... In the USB trace I see ... Get Descriptor ... The time between two reset packets is small, ... if DFU DETACH request is accepted and DFU mode is activated, ...
    (microsoft.public.development.device.drivers)
  • Re: Help regarding DFU.
    ... 2.Create a KMDF driver object using wdfDriverCreatefn. ... will I detach the device.It is said that while enumerating as a DFU ... a reset is given using the WdfUsbTargetDeviceCyclePortSynchronously fn ... 4.Do I need to configure any USB pipes or USB Interfaces.Since it is ...
    (microsoft.public.windowsxp.device_driver.dev)
  • next-20081125: crypto hard disk gets unaccessable
    ... ACPI: Local APIC address 0xfee00000 ... Generic Bluetooth USB driver ver 0.3 ... root hub lost power or was reset ...
    (Linux-Kernel)