From owner-freebsd-usb@FreeBSD.ORG Tue Apr 3 23:55:25 2007 Return-Path: X-Original-To: freebsd-usb@freebsd.org Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 764EC16A404 for ; Tue, 3 Apr 2007 23:55:25 +0000 (UTC) (envelope-from xiaofanc@gmail.com) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.251]) by mx1.freebsd.org (Postfix) with ESMTP id 331F413C45B for ; Tue, 3 Apr 2007 23:55:25 +0000 (UTC) (envelope-from xiaofanc@gmail.com) Received: by an-out-0708.google.com with SMTP id c24so23328ana for ; Tue, 03 Apr 2007 16:55:24 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=HMw3Hf6uevYfe62DBhRb+YOlF95RinDyeeq/ncWQ1q1t910588DgkzOHuUytmQCcgVOl+iYtohupEY2INlEe/QikhtEWCYWLpdgTqHCw5cFwA2Ad1lj+JtSgEG01N8Vr2iikK3On0BBsBrFTLqOvxIPw6RFJVVGePp9oGO8FR8s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Nrqywb1DJcPIyObTkFlF/2ZiCcEuyPV7kuhb6lzwm3VY0udt3L95KCzAHZXM+RtEe3qLHlLBNLNe/ULF1eFyr+5wuuA64BBXhVTakIaZJANswUJ7UuwBvIg0nCNGYJqeNpZVIePAp3JtiS3+C8k23m9LUgRh0ZIROs0R19usb0w= Received: by 10.115.92.2 with SMTP id u2mr2463456wal.1175644523858; Tue, 03 Apr 2007 16:55:23 -0700 (PDT) Received: by 10.114.176.8 with HTTP; Tue, 3 Apr 2007 16:55:23 -0700 (PDT) Message-ID: Date: Wed, 4 Apr 2007 07:55:23 +0800 From: "Xiaofan Chen" To: "Hans Petter Selasky" In-Reply-To: <200704031642.26519.hselasky@c2i.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200704031426.38277.hselasky@c2i.net> <200704031642.26519.hselasky@c2i.net> Cc: freebsd-usb@freebsd.org Subject: Re: libusb usb_interrupt_read hangs under FreeBSD 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: Tue, 03 Apr 2007 23:55:25 -0000 On 4/3/07, Hans Petter Selasky wrote: > Hi, > > I think that your device is broken, and goes bad when it receives a > clear-stall request for the interrupt pipe. That is not very uncommon. Could you be more clearer? I'd like to communicate this problem to the firmware developer of PICKit 2 inside Microchip. Thanks. > Could you try the attached patch. Just apply the patch by hand if "patch" > won't take it. > > The file in question is /sys/dev/usb/ugen.c . > > After that, compile a new ugen module or kernel. > > If you are using the "ugen" module, then you can simply do like this after > that you have re-installed it: > > kldunload ugen > kldload ugen > > --HPS The patch works! Thanks a lot. ===[mcuee] ~/Desktop/build/mypk2 # sudo python testpk2.py Password: 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: Found /dev/usb2 usb_os_find_devices: Found /dev/ugen0 on /dev/usb1 usb_control_msg: 128 6 512 0 0xbfbfe2e8 8 1000 usb_control_msg: 128 6 512 0 0x81222c0 41 1000 skipped 1 class/vendor specific interface descriptors usb_control_msg: 128 6 513 0 0xbfbfe2e8 8 1000 usb_control_msg: 128 6 513 0 0x8116900 32 1000 setConfiguration params: configuration: 1 set Configuration 1 claimInterface params: interfaceNumber: 0 claim Interface 0 Turing power on by USB interrupt write interruptWrite params: endpoint: 1 timeout: 1000 interruptWrite buffer param: 56 31 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a Sending version command by USB interrupt write interruptWrite params: endpoint: 1 timeout: 1000 interruptWrite buffer param: 76 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a Getting version command by USB interrupt read interruptRead params: endpoint: 1 size: 64 timeout: 1000 (2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) usb_os_close: closing endpoint 4 Thanks again. Now I also get the real pk2 application works for PICkit 2. ===[mcuee] ~/Desktop/build/pk2-2.04 # sudo ./pk2 -device PK2 version 2.04 - 2006/12/17 ./pk2 -device usb_set_debug: Setting debugging level to 255 (on) Locating USB Microchip PICkit2 (vendor 0x04d8/product 0x0033) usb_os_find_busses: Found /dev/usb0 usb_os_find_busses: Found /dev/usb1 usb_os_find_busses: Found /dev/usb2 usb_os_find_devices: Found /dev/ugen0 on /dev/usb1 usb_control_msg: 128 6 512 0 0xbfbfe7a8 8 1000 usb_control_msg: 128 6 512 0 0x806b080 41 1000 skipped 1 class/vendor specific interface descriptors usb_control_msg: 128 6 513 0 0xbfbfe7a8 8 1000 usb_control_msg: 128 6 513 0 0x8066100 32 1000 Found USB PICkit as device '/dev/ugen0' on USB bus /dev/usb1 Setting USB configuration is okay. Claiming USB interface is okay. Sending GETVERSION command using interrupt transfer. USB> 76 Receiving PICkit VERSION information using interrupt transfer. Communication established. PICkit2 firmware version is 1.21.0 USB> 56 00 USB> 56 00 USB> 4d USB> 73 00 1d 40 3d 82 2d USB> 4d USB> 4d USB> 4d USB> 90 80 02 fe ff 3f 91 USB> 56 00 USB> 4d USB> 73 80 2a 40 df bd a6 USB> 4d USB> 4d USB> 50 43 52 70 USB> 4f 43 52 70 USB> 50 80 02 fe ff 3f 70 Device ID 0x0c80 PIC18F2620 Rev 3 found USB> 56 00 USB> 4d USB> 73 80 2a 40 df bd a6 USB> 4d Family: PIC18F Program size: 0x8000 (32768) words, width 0xffff Eeprom size: 0x400 (1024) bytes ID location: 0x0 ID size: 0x4 (4) bytes Device ID 0x0c80 Write burst 16 Program command P Program mode G Program timing N Data timing D Erase mode CP mask 0xc00f Bandgap mask 0x0000 0x0000 Config mask 0xcf00 0x1f1f 0x8700 0x00c5 0xc00f 0xe00f 0x400f Save osccal 0 Save bandgap 0 Command table 63 00 02 03 04 05 06 08 18 0a 09 0b ff ff ff ff Regards, Xiaofan