From: polybear on 25 Feb 2005 01:10 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(a)nospam.microsoft.com> ýýýgýýlýýsýD :uVgJrpvGFHA.3628(a)TK2MSFTNGP15.phx.gbl... > 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(a)earthlink.net> wrote in message > news:eR7J6ouGFHA.3068(a)tk2msftngp13.phx.gbl... > > Windows usually reenumerates the bus after return from suspend. This > > should involve a reset. Check it with USB analyzer. > > > > "polybear" <polybear(a)no-sp> wrote in message > > news:e8UWzUmGFHA.3912(a)TK2MSFTNGP10.phx.gbl... > >> > >> 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(a)nospam.nospam> ýýýgýýlýýsýD > >> :ODTpDqlGFHA.3912(a)TK2MSFTNGP10.phx.gbl... > >>> > nextStack = IoGetNextIrpStackLocation(irp); > >>> > nextStack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; > >>> > >>> These are not needed. > >>> > >>> > ntStatus = > >>> > IoCallDriver(deviceExtension->TopOfStackDeviceObject, > >>> > irp); > >>> > >>> What is the ntStatus returned? > >>> > >>> Leo Havmýller. > >>> > >>> > >> > >> > > > > > >
First
|
Prev
|
Pages: 1 2 3 Prev: WDM Screen Capture Driver Next: [USB]Problem about IOCTL_INTERNAL_USB_CYCLE_PORT |