- How could i reset a USB device
- Posted by polybear on February 23rd, 2005
Sir.
USBDI internal function "IOCTL_INTERNAL_USB_CYCLE_PORT" can not use in
WIN2000 ME AND 98.
Is there any other function can be called in my client USB driver to reset
my device?
Thank you.
poly
- Posted by Leo Havmøller on February 23rd, 2005
Yes you can.
Leo Havmøller.
- Posted by polybear on February 24th, 2005
but low level driver reponse that
error code :"c000000d" invalid parameter
??
I use "IoBuildDeviceIoControlRequest to build my irp
,Should i locate urb and irp by myself ?
v
"Leo Havmøller" <rtxleh@nospam.nospam> ¼¶¼g©ó¶l¥ó·s»D
:efp5sMbGFHA.936@TK2MSFTNGP12.phx.gbl...
- Posted by Leo Havmøller on February 24th, 2005
Show your code.
Leo Havmøller.
- Posted by polybear on February 24th, 2005
NTSTATUS ntStatus, status = STATUS_SUCCESS;
PIRP irp;
KEVENT event;
IO_STATUS_BLOCK ioStatus;
PIO_STACK_LOCATION nextStack;
PDEVICE_EXTENSION deviceExtension;
BULKUSB_KdPrint( DBGLVL_DEFAULT,("enter BulkUsb_CyclePort\n"));
deviceExtension = DeviceObject->DeviceExtension;
KeInitializeEvent(&event, NotificationEvent, FALSE);
irp = IoBuildDeviceIoControlRequest(
IOCTL_INTERNAL_USB_CYCLE_PORT,
deviceExtension->TopOfStackDeviceObject,
NULL,
0,
NULL,
0,
TRUE, // internal ( use IRP_MJ_INTERNAL_DEVICE_CONTROL )
&event,
&ioStatus);
nextStack = IoGetNextIrpStackLocation(irp);
nextStack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
ntStatus = IoCallDriver(deviceExtension->TopOfStackDeviceObject,
irp);
please help me...
"Leo Havmøller" <rtxleh@nospam.nospam> ¼¶¼g©ó¶l¥ó·s»D
:OhwD2SjGFHA.544@TK2MSFTNGP12.phx.gbl...
- Posted by Leo Havmøller on February 24th, 2005
These are not needed.
What is the ntStatus returned?
Leo Havmøller.
- Posted by polybear on February 24th, 2005
When system resume from suspend power status, my device must be reset.
Since there are no IRP_MN_WAIT_WAKE .
(I guess that IRP_MN_WAIT_WAKE not been receipted because this device is not
a remote-wakeup supported device.)
I call this cycle port function when the system power chang to working power
status
(in IRP_MN_SET_POWER).
================================================== ========================
NTSTATUS ntStatus, status = STATUS_SUCCESS;
PIRP irp;
KEVENT event;
IO_STATUS_BLOCK ioStatus;
// PIO_STACK_LOCATION nextStack;
PDEVICE_EXTENSION deviceExtension;
BULKUSB_KdPrint( DBGLVL_DEFAULT,("enter BulkUsb_CyclePort\n"));
deviceExtension = DeviceObject->DeviceExtension;
KeInitializeEvent(&event, NotificationEvent, FALSE);
irp = IoBuildDeviceIoControlRequest(
IOCTL_INTERNAL_USB_CYCLE_PORT,
deviceExtension->TopOfStackDeviceObject,
NULL,
0,
NULL,
0,
TRUE, // internal ( use IRP_MJ_INTERNAL_DEVICE_CONTROL )
&event,
&ioStatus);
// nextStack = IoGetNextIrpStackLocation(irp);
// nextStack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
// nextStack->Parameters.DeviceIoControl.IoControlCode =
// IOCTL_INTERNAL_USB_CYCLE_PORT;
// BULKUSB_ASSERT(nextStack != NULL);
BULKUSB_KdPrint( DBGLVL_DEFAULT,("BulkUsb_CyclePort() calling USBD
reset port api\n"));
ntStatus = IoCallDriver(deviceExtension->TopOfStackDeviceObject,
irp);
BULKUSB_KdPrint( DBGLVL_DEFAULT,("BulkUsb_CyclePort() return from
IoCallDriver USBD %x\n", ntStatus));
if (ntStatus == STATUS_PENDING) {
BULKUSB_KdPrint( DBGLVL_DEFAULT,("BulkUsb_CyclePort() Wait for
single object\n"));
status = KeWaitForSingleObject(
&event,
Suspended,
KernelMode,
FALSE,
NULL);
BULKUSB_KdPrint( DBGLVL_DEFAULT,("BulkUsb_CyclePort() Wait for
single object, returned %x\n", status));
} else {
ioStatus.Status = ntStatus;
}
//
// USBD maps the error code for us
//
ntStatus = ioStatus.Status;
BULKUSB_KdPrint( DBGLVL_DEFAULT,("Exit BulkUsb_CyclePort (%x)\n",
ntStatus));
return ntStatus;
==Result========================================== ==========================
==============
enter BulkUsb_CyclePort
BulkUsb:
BulkUsb_CyclePort() calling USBD reset port api
BulkUsb:
BulkUsb_CyclePort() return from IoCallDriver USBD c000000d
BulkUsb:
Exit BulkUsb_CyclePort (c000000d)
"Leo Havmøller" <rtxleh@nospam.nospam> ¼¶¼g©ó¶l¥ó·s»D
:ODTpDqlGFHA.3912@TK2MSFTNGP10.phx.gbl...
- Posted by Alexander Grigoriev on February 25th, 2005
Windows usually reenumerates the bus after return from suspend. This should
involve a reset. Check it with USB analyzer.
"polybear" <polybear@no-sp> wrote in message
news:e8UWzUmGFHA.3912@TK2MSFTNGP10.phx.gbl...
- Posted by polybear on February 25th, 2005
I had chatched the record by CATC from system suspend. but i found that not
all of them involve reset device.
(ex. windows 2000 and intel 1.1 USB host )
there was a "resume" behind "suspend" on the bus , on any reset had been
record.
-:~
poly
"Alexander Grigoriev" <alegr@earthlink.net> ¼¶¼g©ó¶l¥ó·s»D
:eR7J6ouGFHA.3068@tk2msftngp13.phx.gbl...
- Posted by Doron Holan [MS] on February 25th, 2005
this cycle port IOCTL will actually cause your device to be surprise
removed. that means that if an app has a handle open to your device, it
will have to reopen the handle every time the machine comes back from low
power.
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.
"Alexander Grigoriev" <alegr@earthlink.net> wrote in message
news:eR7J6ouGFHA.3068@tk2msftngp13.phx.gbl...
- Posted by polybear on February 25th, 2005
I got you. the firmware should handle app restart the communication
protocal.
but i still want to know , if there is any way that client driver can reset
device?
"Doron Holan [MS]" <doronh@nospam.microsoft.com> ¼¶¼g©ó¶l¥ó·s»D
:uVgJrpvGFHA.3628@TK2MSFTNGP15.phx.gbl...