阅读:1525回复:3
endpoint的状态。
可以获取一个endpoint的当前状态(idle,busy,stalled)吗?
如果可以 ,怎么获得? 最好举个例子! 大侠们,帮帮忙呀! 很急。 |
|
沙发#
发布于:2002-06-07 09:19
斑竹,点拨一下啊。
我一直以为,halted 和stalled是同样的意思,难道他们不同啊? 怎么要不同的请求处理呢? |
|
板凳#
发布于:2002-04-24 17:31
//得到状态
NTSTATUS UsbDriverGetPortStatus( IN PDEVICE_OBJECT DeviceObject, IN PULONG PortStatus ) /*++ Routine Description: returns the port status for our device Arguments: Return Value: STATUS_SUCCESS if successful, STATUS_UNSUCCESSFUL otherwise --*/ { NTSTATUS ntStatus, status = STATUS_SUCCESS; PIRP irp; KEVENT event; IO_STATUS_BLOCK ioStatus; PIO_STACK_LOCATION nextStack; PUSBDRIVER_DEVICE_EXTENSION deviceExtension; deviceExtension = (PUSBDRIVER_DEVICE_EXTENSION) DeviceObject->DeviceExtension; *PortStatus = 0; // // issue a synchronous request // KeInitializeEvent(&event, NotificationEvent, FALSE); // IoBuildDeviceIoControlRequest allocates and sets up an IRP for a device control request irp = IoBuildDeviceIoControlRequest( IOCTL_INTERNAL_USB_GET_PORT_STATUS, deviceExtension->TopOfStackDeviceObject, //next-lower driver\'s device object, representing the target device. NULL, // no input or output buffers 0, NULL, 0, TRUE, // internal ( use IRP_MJ_INTERNAL_DEVICE_CONTROL ) &event, // event to be signalled on completion ( we wait for it below ) &ioStatus); // // Call the class driver to perform the operation. If the returned status // is PENDING, wait for the request to complete. // // IoGetNextIrpStackLocation gives a higher level driver access to the next-lower // driver\'s I/O stack location in an IRP so the caller can set it up for the lower driver. nextStack = IoGetNextIrpStackLocation(irp); ASSERT(nextStack != NULL); nextStack->Parameters.Others.Argument1 = PortStatus; ntStatus = IoCallDriver(deviceExtension->TopOfStackDeviceObject, irp); DebugPrint(\"IsoUsbGetPortStatus() return from IoCallDriver USBD %x\\n\", ntStatus); if (ntStatus == STATUS_PENDING) { DebugPrint(\"Wait for single object\\n\"); status = KeWaitForSingleObject( &event, Suspended, KernelMode, FALSE, NULL); } else { ioStatus.Status = ntStatus; } // // USBD maps the error code for us // ntStatus = ioStatus.Status; return ntStatus; } //清除halted用IOCTL_INTERNAL_USB_RESET_PORT //清除STALL用USB_REQUEST_CLEAR_FEATURE |
|
|
地板#
发布于:2002-04-24 16:11
补充:
如果已知一个端点处于halted状态,是不是需要我的的device driver 来清除,还是usb bus driver 自己清除的呢? |
|