From: Jose M R. <rob...@gm...> - 2011-10-05 19:52:06
|
Well, after a lot of DebugView work, I detected where is the kernel thread hung: call_usbd_ex (invoked by usb_set_configuration to make the usbd_send_urb to SET_CONFIGURATION) NTSTATUS call_usbd_ex(libusb_device_t *dev, void *urb, ULONG control_code, int timeout, int max_timeout) { .... next_irp_stack = IoGetNextIrpStackLocation(irp); next_irp_stack->Parameters.Others.Argument1 = urb; next_irp_stack->Parameters.Others.Argument2 = NULL; IoSetCompletionRoutine(irp, on_usbd_complete, &event, TRUE, TRUE, TRUE); *status = IoCallDriver(dev->target_device, irp); <--- HANG!* if(status == STATUS_PENDING) { _timeout.QuadPart = -(timeout * 10000); Any idea? I attached DebugView output Thanks again! Appendix: DebugView Output 00000001 0.00000000 libusb0-sys:[DriverEntry] [loading-driver] v1.2.5.0 00000002 0.00094202 libusb0-sys:dbg [debug_show_devices] [AttachedDevice #0] \Driver\ACPI 00000003 0.00095291 libusb0-sys:dbg [debug_show_devices] [AttachedDevice #1] \Driver\hhdusbh32 00000004 0.00096185 libusb0-sys:dbg [debug_show_devices] [AttachedDevice #2] \Driver\usbccgp 00000005 0.00101465 libusb0-sys:[add_device] device #1 created for usb\vid_eb1a&pid_2571&rev_0624 00000006 0.00112724 libusb0-sys:[reg_get_properties] using default device interface guid. 00000007 0.00114987 libusb0-sys:dbg [reg_get_properties] reg-key-name=\REGISTRY\MACHINE\SYSTEM\ControlSet001\Enum\USB\Vid_eb1a&Pid_2571\5&95525e6&0&1\Device Parameters 00000008 0.00172843 libusb0-sys:[set_filter_interface_key] updated interface registry with LUsb0 direct-access symbolic link. id=1 00000009 0.00189326 libusb0-sys:[add_device] updated interface registry with LUsb0 direct-access symbolic link. id=0001 00000010 0.00191030 libusb0-sys:dbg [add_device] [filter-mode] id=#1 usb\vid_eb1a&pid_2571&rev_0624 00000011 0.00191812 libusb0-sys:[add_device] complete status=00000000 00000012 0.00276823 libusb0-sys:[dispatch_pnp] IRP_MN_START_DEVICE: is-filter=Y usb\vid_eb1a&pid_2571&rev_0624 00000013 0.13223161 libusb0-sys:dbg [on_start_complete] is-filter=Y usb\vid_eb1a&pid_2571&rev_0624 00000014 0.13355692 libusb0-sys:dbg [dispatch_pnp] IRP_MN_QUERY_CAPABILITIES: is-filter=Y usb\vid_eb1a&pid_2571&rev_0624 00000015 15.13555336 libusb0-sys:[release_all_interfaces] releasing all interfaces bound to file object 0x87499768 00000016 15.13560486 libusb0-sys:[release_all_interfaces] releasing all interfaces bound to file object 0x87499768 00000017 15.13577175 libusb0-sys:[get_descriptor] buffer size: 18 type: 0001 recipient: 0000 index: 0000 language id: 0000 timeout: 5000 00000018 15.13574696 [2796] libusb0-dll:[os_find_busses] found bus-0 00000019 15.13578033 libusb0-sys:[call_usbd_ex] ------ cp1 00000020 15.13578892 libusb0-sys:[call_usbd_ex] ------ cp2 00000021 15.13579559 libusb0-sys:[call_usbd_ex] ------ cp3 00000022 15.13580322 libusb0-sys:[call_usbd_ex] ------ cp4 00000023 15.13580894 libusb0-sys:[call_usbd_ex] ------ cp5 00000024 15.13581562 libusb0-sys:[call_usbd_ex] ------ cp6 00000025 15.13582230 libusb0-sys:[call_usbd_ex] ------ cp7 00000026 15.13590145 libusb0-sys:[call_usbd_ex] ------ cp8 00000027 15.13590813 libusb0-sys:[call_usbd_ex] ------ cp9 00000028 15.13616943 libusb0-sys:[call_usbd_ex] ------ cp11 00000029 15.13617992 libusb0-sys:[call_usbd_ex] ------ cp12 00000030 15.13619232 libusb0-sys:dbg [call_usbd_ex] status = 00000000h 00000031 15.13621998 libusb0-sys:[release_all_interfaces] releasing all interfaces bound to file object 0x87499768 00000032 15.13629913 [2796] libusb0-dll:[os_find_devices] found \\.\libusb0-0001--0xeb1a-0x2571 on bus-0 00000033 15.13808632 libusb0-sys:[get_descriptor] buffer size: 9 type: 0002 recipient: 0000 index: 0000 language id: 0000 timeout: 1000 00000034 15.13809395 libusb0-sys:[call_usbd_ex] ------ cp1 00000035 15.13810062 libusb0-sys:[call_usbd_ex] ------ cp2 00000036 15.13810730 libusb0-sys:[call_usbd_ex] ------ cp3 00000037 15.13811398 libusb0-sys:[call_usbd_ex] ------ cp4 00000038 15.13812065 libusb0-sys:[call_usbd_ex] ------ cp5 00000039 15.13812733 libusb0-sys:[call_usbd_ex] ------ cp6 00000040 15.13813400 libusb0-sys:[call_usbd_ex] ------ cp7 00000041 15.13819790 libusb0-sys:[call_usbd_ex] ------ cp8 00000042 15.13820457 libusb0-sys:[call_usbd_ex] ------ cp9 00000043 15.13841438 libusb0-sys:[call_usbd_ex] ------ cp11 00000044 15.13842201 libusb0-sys:[call_usbd_ex] ------ cp12 00000045 15.13843346 libusb0-sys:dbg [call_usbd_ex] status = 00000000h 00000046 15.13847065 libusb0-sys:[get_descriptor] buffer size: 547 type: 0002 recipient: 0000 index: 0000 language id: 0000 timeout: 1000 00000047 15.13847828 libusb0-sys:[call_usbd_ex] ------ cp1 00000048 15.13848495 libusb0-sys:[call_usbd_ex] ------ cp2 00000049 15.13849163 libusb0-sys:[call_usbd_ex] ------ cp3 00000050 15.13849831 libusb0-sys:[call_usbd_ex] ------ cp4 00000051 15.13850498 libusb0-sys:[call_usbd_ex] ------ cp5 00000052 15.13851070 libusb0-sys:[call_usbd_ex] ------ cp6 00000053 15.13851738 libusb0-sys:[call_usbd_ex] ------ cp7 00000054 15.13857841 libusb0-sys:[call_usbd_ex] ------ cp8 00000055 15.13858509 libusb0-sys:[call_usbd_ex] ------ cp9 00000056 15.13953304 libusb0-sys:[call_usbd_ex] ------ cp11 00000057 15.13954067 libusb0-sys:[call_usbd_ex] ------ cp12 00000058 15.13955116 libusb0-sys:dbg [call_usbd_ex] status = 00000000h 00000059 15.13959980 libusb0-sys:[release_all_interfaces] releasing all interfaces bound to file object 0x87499768 00000060 15.13980389 libusb0-sys:[set_configuration] setting configuration value 1 timeout=5000 00000061 15.13981724 libusb0-sys:[get_descriptor] buffer size: 18 type: 0001 recipient: 0000 index: 0000 language id: 0000 timeout: 5000 00000062 15.13983059 libusb0-sys:[get_descriptor] buffer size: 9 type: 0002 recipient: 0000 index: 0000 language id: 0000 timeout: 5000 00000063 15.13984394 libusb0-sys:[get_descriptor] buffer size: 547 type: 0002 recipient: 0000 index: 0000 language id: 0000 timeout: 5000 00000064 15.13985252 libusb0-sys:[set_configuration] found interface 0 00000065 15.13986015 libusb0-sys:[set_configuration] found interface 1 00000066 15.13987255 libusb0-sys:[set_configuration] #1 usb\vid_eb1a&pid_2571&rev_0624 passing configuration request to target-device. 00000067 15.13987923 libusb0-sys:[set_configuration] ------- cp 1 00000068 15.13988590 libusb0-sys:[call_usbd_ex] ------ cp1 00000069 15.13989258 libusb0-sys:[call_usbd_ex] ------ cp2 00000070 15.13989925 libusb0-sys:[call_usbd_ex] ------ cp3 00000071 15.13990593 libusb0-sys:[call_usbd_ex] ------ cp4 00000072 15.13991261 libusb0-sys:[call_usbd_ex] ------ cp5 00000073 15.13991928 libusb0-sys:[call_usbd_ex] ------ cp6 00000074 15.13992691 libusb0-sys:[call_usbd_ex] ------ cp7 2011/10/5 Jose M Robles <rob...@gm...> > But the hangs occurs before, in usb_claim_interface(). > > > 2011/10/5 Xiaofan Chen <xia...@gm...> > >> On Wed, Oct 5, 2011 at 10:00 PM, Jose M Robles <rob...@gm...> >> wrote: >> > // Hang... >> > usb_interrupt_read(dev, 0x81, buff, sizeof(buff),0); >> > ... >> >> Hmm, I think this is normal behavior. You have set the timeout to >> infinite (0 is infinite for libusb-win32 1.2.5.0 version to be consistent >> with libusb under Linux) and I believe the interrupt read will only >> return after you press a button. >> >> So I do not see any problems here. You can try to setup the >> time out to be other value and see if that returns or not. >> >> >> >> -- >> Xiaofan >> > > > > -- > Jose M. Robles Hermoso > > Google+: http://gplus.to/jmr > Twitter: twitter.com/jmrobles > Blog: http://www.robleshermoso.com > AboutMe: http://about.me/roblesjm > > > -- Jose M. Robles Hermoso Google+: http://gplus.to/jmr Twitter: twitter.com/jmrobles Blog: http://www.robleshermoso.com AboutMe: http://about.me/roblesjm |