From owner-freebsd-usb@FreeBSD.ORG Sun Nov 4 05:34:37 2007 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD33816A418 for ; Sun, 4 Nov 2007 05:34:37 +0000 (UTC) (envelope-from xiaofanc@gmail.com) Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.179]) by mx1.freebsd.org (Postfix) with ESMTP id B7D7013C4B2 for ; Sun, 4 Nov 2007 05:34:37 +0000 (UTC) (envelope-from xiaofanc@gmail.com) Received: by wa-out-1112.google.com with SMTP id k17so1606209waf for ; Sat, 03 Nov 2007 22:34:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=hrwttsHgskZjK8pT/FWBkh+OhgfrYKL7bvRwAQn2GEg=; b=hC12IxhU/Ox/nSW0kohaHkjuARrKqFGH8/6qZ4NB9Fs1tSWRScxihLPJy6A97eCciZr9X9HAm5aMNjvV6924EFhWvjJ+Lk9U4a+tQm2h6KcjMpOzlc+LrhHgM/R87AzKg4UhVFbZ+lZNjV7vG0swZUwolHODwiFI4J7a0nq3XDo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=OTyRqbISPsStr0QCRoKnyUu8JdtzPE+KbK59zFmgHlKwi4YzASPFbNJuupr+P7i8oG5x4wrW5hUpht6Nk3uxMtqxElwdZAq/jd2pAigrjPveKaoTkiX+AmzVOKhdEhSfn1GOpD4R18lv4607tFfmoFvYQs9J5UmY0MRjH3FGesk= Received: by 10.115.32.1 with SMTP id k1mr3712001waj.1194152847297; Sat, 03 Nov 2007 22:07:27 -0700 (PDT) Received: by 10.114.176.17 with HTTP; Sat, 3 Nov 2007 22:07:27 -0700 (PDT) Message-ID: Date: Sun, 4 Nov 2007 13:07:27 +0800 From: "Xiaofan Chen" To: freebsd-usb@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: libusb_interrupt_write hangs with FreeBSD 7 X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Nov 2007 05:34:37 -0000 I've tried to test PICKit 2 under the latest FreeBSD 7 Snapshots. However, libusb_interrupt_write hangs. The same error happened to FreeBSD 6.2 Stable last time I tried it. With the alternative HPS stack, the program works. I have also got PICkit 2 console program Linux port to fully work under FreeBSD with HPS stack. Reference: http://groups.google.com/group/pickit-devel/browse_thread/thread/61627bd8345759b3 ===[mcuee] ~/Desktop/build/mypk2 # uname -a FreeBSD FreeBsd.Mshome 7.0-BETA2 FreeBSD 7.0-BETA2 #3: Fri Nov 2 20:33:40 SGT 2007 root@FreeBsd.Mshome:/home/obj/home/src/sys/USBDEBUG i386 ===[mcuee] ~/Desktop/build/mypk2 # cat testpk2.py #!/usr/local/bin/python -i import usb def opendevice(idVendor, idProduct): devices=[] for b in usb.busses(): for d in b.devices: if d.idVendor==idVendor and d.idProduct==idProduct: devices.append(d) if len(devices)==1: device=devices[0] return device elif not devices: raise "Device not found" else: raise "More than one device found" if __name__=="__main__": device=opendevice(0x04d8, 0x0033) packet_len=64 dh=device.open() dh.setConfiguration(1) print "set Configuration 1" dh.claimInterface(0) print "claim Interface 0" #dh.setAltInterface(0) # First test, turn power on print "Turning power on by USB interrupt write" dh.interruptWrite(1,"V1"+(packet_len-2)*"Z",10000) # Second test, get version number print "Sending version command by USB interrupt write" dh.interruptWrite(1,"v"+(packet_len-1)*"Z",10000) print "Getting version command by USB interrupt read" #r=dh.interruptRead(0x81,64,10000) r=dh.interruptRead(1,64,10000) print r ===[mcuee] ~/Desktop/build/mypk2 # sudo sysctl hw.usb.debug=15 Password: hw.usb.debug: 0 -> 15 ===[mcuee] ~/Desktop/build/mypk2 # python testpk2.py usb_set_debug: Setting debugging level to 255 (on) usb_os_find_busses: Found /dev/usb0 usb_os_find_busses: Found /dev/usb1 usb_os_find_busses: can't open /dev/usb2: Permission denied usb_os_find_devices: Found /dev/ugen0 on /dev/usb1 usb_os_find_devices: Found /dev/ugen1 on /dev/usb1 usb_control_msg: 128 6 512 0 0xbfbfe444 8 1000 usb_control_msg: 128 6 512 0 0x283050a0 41 1000 skipped 1 class/vendor specific interface descriptors usb_control_msg: 128 6 513 0 0xbfbfe444 8 1000 usb_control_msg: 128 6 513 0 0x28361100 32 1000 usb_control_msg: 128 6 512 0 0xbfbfe444 8 1000 usb_control_msg: 128 6 512 0 0x28361140 32 1000 set Configuration 1 claim Interface 0 Turning power on by USB interrupt write ^C (Note by Xiaofan: Program hangs) Traceback (most recent call last): File "testpk2.py", line 37, in dh.interruptWrite(1,"V1"+(packet_len-2)*"Z",10000) KeyboardInterrupt usb_os_close: closing endpoint 4 ===[mcuee] ~/Desktop/build/mypk2 # dmesg ugen1: on uhub1 usb_event_thread: woke up usb_discover usbd_alloc_xfer() = 0xc406e400 usbd_transfer: xfer=0xc406e400, flags=6, pipe=0xc4053d00, running=0 usbd_dump_queue: pipe=0xc4053d00 usb_insert_transfer: pipe=0xc4053d00 running=0 timeout=5000 usb_transfer_complete: pipe=0xc4053d00 xfer=0xc406e400 status=0 actlen=2 usb_transfer_complete: repeat=0 new head=0 usbd_start_next: pipe=0xc4053d00, xfer=0 usbd_free_xfer: 0xc406e400 usbd_alloc_xfer() = 0xc406e400 usbd_transfer: xfer=0xc406e400, flags=6, pipe=0xc4053d00, running=0 usbd_dump_queue: pipe=0xc4053d00 usb_insert_transfer: pipe=0xc4053d00 running=0 timeout=5000 usb_transfer_complete: pipe=0xc4053d00 xfer=0xc406e400 status=0 actlen=14 usb_transfer_complete: repeat=0 new head=0 usbd_start_next: pipe=0xc4053d00, xfer=0 usbd_free_xfer: 0xc406e400 usbd_alloc_xfer() = 0xc406e400 usbd_transfer: xfer=0xc406e400, flags=6, pipe=0xc4053d00, running=0 usbd_dump_queue: pipe=0xc4053d00 usb_insert_transfer: pipe=0xc4053d00 running=0 timeout=5000 usb_transfer_complete: pipe=0xc4053d00 xfer=0xc406e400 status=0 actlen=2 usb_transfer_complete: repeat=0 new head=0 usbd_start_next: pipe=0xc4053d00, xfer=0 usbd_free_xfer: 0xc406e400 usbd_alloc_xfer() = 0xc406e400 usbd_transfer: xfer=0xc406e400, flags=6, pipe=0xc4053d00, running=0 usbd_dump_queue: pipe=0xc4053d00 usb_insert_transfer: pipe=0xc4053d00 running=0 timeout=5000 usb_transfer_complete: pipe=0xc4053d00 xfer=0xc406e400 status=0 actlen=28 usb_transfer_complete: repeat=0 new head=0 usbd_start_next: pipe=0xc4053d00, xfer=0 usbd_free_xfer: 0xc406e400 usbd_alloc_xfer() = 0xc5494400 usbd_transfer: xfer=0xc5494400, flags=6, pipe=0xc4069b00, running=0 usbd_dump_queue: pipe=0xc4069b00 usb_insert_transfer: pipe=0xc4069b00 running=0 timeout=5000 usb_transfer_complete: pipe=0xc4069b00 xfer=0xc5494400 status=0 actlen=2 usb_transfer_complete: repeat=0 new head=0 usbd_start_next: pipe=0xc4069b00, xfer=0 usbd_free_xfer: 0xc5494400 usbd_alloc_xfer() = 0xc5494400 usbd_transfer: xfer=0xc5494400, flags=6, pipe=0xc4069b00, running=0 usbd_dump_queue: pipe=0xc4069b00 usb_insert_transfer: pipe=0xc4069b00 running=0 timeout=5000 usb_transfer_complete: pipe=0xc4069b00 xfer=0xc5494400 status=0 actlen=14 usb_transfer_complete: repeat=0 new head=0 usbd_start_next: pipe=0xc4069b00, xfer=0 usbd_free_xfer: 0xc5494400 usbd_alloc_xfer() = 0xc5494400 usbd_transfer: xfer=0xc5494400, flags=6, pipe=0xc4069b00, running=0 usbd_dump_queue: pipe=0xc4069b00 usb_insert_transfer: pipe=0xc4069b00 running=0 timeout=5000 usb_transfer_complete: pipe=0xc4069b00 xfer=0xc5494400 status=0 actlen=2 usb_transfer_complete: repeat=0 new head=0 usbd_start_next: pipe=0xc4069b00, xfer=0 usbd_free_xfer: 0xc5494400 usbd_alloc_xfer() = 0xc5494400 usbd_transfer: xfer=0xc5494400, flags=6, pipe=0xc4069b00, running=0 usbd_dump_queue: pipe=0xc4069b00 usb_insert_transfer: pipe=0xc4069b00 running=0 timeout=5000 usb_transfer_complete: pipe=0xc4069b00 xfer=0xc5494400 status=0 actlen=28 usb_transfer_complete: repeat=0 new head=0 usbd_start_next: pipe=0xc4069b00, xfer=0 usbd_free_xfer: 0xc5494400 usbd_alloc_xfer() = 0xc5494400 usbd_transfer: xfer=0xc5494400, flags=6, pipe=0xc40eca80, running=0 usbd_dump_queue: pipe=0xc40eca80 usb_insert_transfer: pipe=0xc40eca80 running=0 timeout=5000 usb_schedsoftintr: polling=0 usb_transfer_complete: pipe=0xc40eca80 xfer=0xc5494400 status=0 actlen=2 usb_transfer_complete: repeat=0 new head=0 usbd_start_next: pipe=0xc40eca80, xfer=0 usbd_free_xfer: 0xc5494400 usbd_alloc_xfer() = 0xc5494400 usbd_transfer: xfer=0xc5494400, flags=6, pipe=0xc40eca80, running=0 usbd_dump_queue: pipe=0xc40eca80 usb_insert_transfer: pipe=0xc40eca80 running=0 timeout=5000 usb_schedsoftintr: polling=0 usb_transfer_complete: pipe=0xc40eca80 xfer=0xc5494400 status=0 actlen=10 usb_transfer_complete: repeat=0 new head=0 usbd_start_next: pipe=0xc40eca80, xfer=0 usbd_free_xfer: 0xc5494400 usbd_alloc_xfer() = 0xc5494400 usbd_transfer: xfer=0xc5494400, flags=6, pipe=0xc40eca80, running=0 usbd_dump_queue: pipe=0xc40eca80 usb_insert_transfer: pipe=0xc40eca80 running=0 timeout=5000 usb_schedsoftintr: polling=0 usb_transfer_complete: pipe=0xc40eca80 xfer=0xc5494400 status=0 actlen=2 usb_transfer_complete: repeat=0 new head=0 usbd_start_next: pipe=0xc40eca80, xfer=0 usbd_free_xfer: 0xc5494400 usbd_alloc_xfer() = 0xc5494400 usbd_transfer: xfer=0xc5494400, flags=6, pipe=0xc40eca80, running=0 usbd_dump_queue: pipe=0xc40eca80 usb_insert_transfer: pipe=0xc40eca80 running=0 timeout=5000 usb_schedsoftintr: polling=0 usb_transfer_complete: pipe=0xc40eca80 xfer=0xc5494400 status=0 actlen=42 usb_transfer_complete: repeat=0 new head=0 usbd_start_next: pipe=0xc40eca80, xfer=0 usbd_free_xfer: 0xc5494400 usbd_alloc_xfer() = 0xc5494400 usbd_transfer: xfer=0xc5494400, flags=6, pipe=0xc4356800, running=0 usbd_dump_queue: pipe=0xc4356800 usb_insert_transfer: pipe=0xc4356800 running=0 timeout=5000 usb_schedsoftintr: polling=0 usb_transfer_complete: pipe=0xc4356800 xfer=0xc5494400 status=0 actlen=2 usb_transfer_complete: repeat=0 new head=0 usbd_start_next: pipe=0xc4356800, xfer=0 usbd_free_xfer: 0xc5494400 usbd_alloc_xfer() = 0xc5494400 usbd_transfer: xfer=0xc5494400, flags=6, pipe=0xc4356800, running=0 usbd_dump_queue: pipe=0xc4356800 usb_insert_transfer: pipe=0xc4356800 running=0 timeout=5000 usb_schedsoftintr: polling=0 usb_transfer_complete: pipe=0xc4356800 xfer=0xc5494400 status=0 actlen=52 usb_transfer_complete: repeat=0 new head=0 usbd_start_next: pipe=0xc4356800, xfer=0 usbd_free_xfer: 0xc5494400 usbd_alloc_xfer() = 0xc5494400 usbd_transfer: xfer=0xc5494400, flags=6, pipe=0xc4356800, running=0 usbd_dump_queue: pipe=0xc4356800 usb_insert_transfer: pipe=0xc4356800 running=0 timeout=5000 usb_schedsoftintr: polling=0 usb_transfer_complete: pipe=0xc4356800 xfer=0xc5494400 status=0 actlen=2 usb_transfer_complete: repeat=0 new head=0 usbd_start_next: pipe=0xc4356800, xfer=0 usbd_free_xfer: 0xc5494400 usbd_alloc_xfer() = 0xc5494400 usbd_transfer: xfer=0xc5494400, flags=6, pipe=0xc4356800, running=0 usbd_dump_queue: pipe=0xc4356800 usb_insert_transfer: pipe=0xc4356800 running=0 timeout=5000 usb_schedsoftintr: polling=0 usb_transfer_complete: pipe=0xc4356800 xfer=0xc5494400 status=0 actlen=72 usb_transfer_complete: repeat=0 new head=0 usbd_start_next: pipe=0xc4356800, xfer=0 usbd_free_xfer: 0xc5494400 usbd_alloc_xfer() = 0xc5494400 usbd_transfer: xfer=0xc5494400, flags=6, pipe=0xc4356800, running=0 usbd_dump_queue: pipe=0xc4356800 usb_insert_transfer: pipe=0xc4356800 running=0 timeout=1000 usb_schedsoftintr: polling=0 usb_transfer_complete: pipe=0xc4356800 xfer=0xc5494400 status=0 actlen=8 usb_transfer_complete: repeat=0 new head=0 usbd_start_next: pipe=0xc4356800, xfer=0 usbd_free_xfer: 0xc5494400 usbd_alloc_xfer() = 0xc5494400 usbd_transfer: xfer=0xc5494400, flags=6, pipe=0xc4356800, running=0 usbd_dump_queue: pipe=0xc4356800 usb_insert_transfer: pipe=0xc4356800 running=0 timeout=1000 usb_schedsoftintr: polling=0 usb_transfer_complete: pipe=0xc4356800 xfer=0xc5494400 status=0 actlen=41 usb_transfer_complete: repeat=0 new head=0 usbd_start_next: pipe=0xc4356800, xfer=0 usbd_free_xfer: 0xc5494400 usbd_alloc_xfer() = 0xc5494400 usbd_transfer: xfer=0xc5494400, flags=6, pipe=0xc4356800, running=0 usbd_dump_queue: pipe=0xc4356800 usb_insert_transfer: pipe=0xc4356800 running=0 timeout=1000 usb_schedsoftintr: polling=0 usb_transfer_complete: pipe=0xc4356800 xfer=0xc5494400 status=0 actlen=8 usb_transfer_complete: repeat=0 new head=0 usbd_start_next: pipe=0xc4356800, xfer=0 usbd_free_xfer: 0xc5494400 usbd_alloc_xfer() = 0xc5494400 usbd_transfer: xfer=0xc5494400, flags=6, pipe=0xc4356800, running=0 usbd_dump_queue: pipe=0xc4356800 usb_insert_transfer: pipe=0xc4356800 running=0 timeout=1000 usb_schedsoftintr: polling=0 usb_transfer_complete: pipe=0xc4356800 xfer=0xc5494400 status=0 actlen=32 usb_transfer_complete: repeat=0 new head=0 usbd_start_next: pipe=0xc4356800, xfer=0 usbd_free_xfer: 0xc5494400 usbd_alloc_xfer() = 0xc5494400 usbd_transfer: xfer=0xc5494400, flags=6, pipe=0xc40eca80, running=0 usbd_dump_queue: pipe=0xc40eca80 usb_insert_transfer: pipe=0xc40eca80 running=0 timeout=1000 usb_schedsoftintr: polling=0 usb_transfer_complete: pipe=0xc40eca80 xfer=0xc5494400 status=0 actlen=8 usb_transfer_complete: repeat=0 new head=0 usbd_start_next: pipe=0xc40eca80, xfer=0 usbd_free_xfer: 0xc5494400 usbd_alloc_xfer() = 0xc5494400 usbd_transfer: xfer=0xc5494400, flags=6, pipe=0xc40eca80, running=0 usbd_dump_queue: pipe=0xc40eca80 usb_insert_transfer: pipe=0xc40eca80 running=0 timeout=1000 usb_schedsoftintr: polling=0 usb_transfer_complete: pipe=0xc40eca80 xfer=0xc5494400 status=0 actlen=32 usb_transfer_complete: repeat=0 new head=0 usbd_start_next: pipe=0xc40eca80, xfer=0 usbd_free_xfer: 0xc5494400 usbd_open_pipe: iface=0xc42616e0 address=0x1 flags=0x0 usbd_setup_pipe: dev=0xc4357880 iface=0xc42616e0 ep=0xc426184c pipe=0xe6c8a968 usbd_open_pipe_intr: address=0x81 flags=0x4 len=64 usbd_open_pipe: iface=0xc42616e0 address=0x81 flags=0x1 usbd_setup_pipe: dev=0xc4357880 iface=0xc42616e0 ep=0xc4261840 pipe=0xe6c8a93c usbd_alloc_xfer() = 0xc5494400 usbd_transfer: xfer=0xc5494400, flags=4, pipe=0xc56aca80, running=0 usbd_dump_queue: pipe=0xc56aca80 usb_insert_transfer: pipe=0xc56aca80 running=0 timeout=0 usbd_alloc_xfer() = 0xc525fe00 usbd_intr_transfer: start transfer 64 bytes usbd_transfer: xfer=0xc525fe00, flags=0, pipe=0xc55a6080, running=0 usbd_dump_queue: pipe=0xc55a6080 usb_insert_transfer: pipe=0xc55a6080 running=0 timeout=10000 usb_event_thread: woke up usb_discover usb_event_thread: woke up usb_discover usbd_intr_transfer: tsleep=4 usbd_ar_pipe: pipe=0xc55a6080 usbd_dump_queue: pipe=0xc55a6080 xfer=0xc525fe00 usbd_ar_pipe: pipe=0xc55a6080 xfer=0xc525fe00 (methods=0xc0b447e4) usb_schedsoftintr: polling=0 usb_transfer_complete: pipe=0xc55a6080 xfer=0xc525fe00 status=6 actlen=0 usb_transfer_complete: repeat=0 new head=0 usbd_free_xfer: 0xc525fe00 usbd_ar_pipe: pipe=0xc55a6080 usbd_dump_queue: pipe=0xc55a6080 usbd_ar_pipe: pipe=0xc56aca80 usbd_dump_queue: pipe=0xc56aca80 xfer=0xc5494400 usbd_ar_pipe: pipe=0xc56aca80 xfer=0xc5494400 (methods=0xc0b447e4) usb_schedsoftintr: polling=0 usb_transfer_complete: pipe=0xc56aca80 xfer=0xc5494400 status=6 actlen=0 usb_transfer_complete: repeat=0 new head=0 usb_event_thread: woke up usb_discover usb_event_thread: woke up usb_discover usb_event_thread: woke up usb_discover