From owner-freebsd-usb@FreeBSD.ORG Tue Oct 16 23:36:22 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 DAFF516A419 for ; Tue, 16 Oct 2007 23:36:22 +0000 (UTC) (envelope-from xiaofanc@gmail.com) Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.181]) by mx1.freebsd.org (Postfix) with ESMTP id B703313C442 for ; Tue, 16 Oct 2007 23:36:22 +0000 (UTC) (envelope-from xiaofanc@gmail.com) Received: by wa-out-1112.google.com with SMTP id k17so2607606waf for ; Tue, 16 Oct 2007 16:36:21 -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:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=LpOQq+HXOUKAGW3w5LO38lmKMP2FiAq5K4XeB5OTtSg=; b=CjiyI+hg4qxjqGxEQF7hJJCV+50TF2pYhNuiEIlWMHhSa4zCxm7zGBgpRi6X+1JRBzWKmq5lMK+oK+VVS0qxeuCqZKxvLybRiMsSNvqw7YsVOWovkfgXANiQL78rfMXzIbiDa9DZatChW8UeSeRHaHQS25HwZU/F0ryfGuV7wmI= 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=WhvmfZHQDhYEyqjMzXoY0s49koKoLCD5NWSHVZveeJozCndIHWMzm95vdLkylhSI4AphdBF1418je8ppXa34KWHcPfYytyMIw9Ue4gQ/6OUgQj1J9RJGaDSSRYIiia9RNAohxfnJXCROMhY1ZD+JFSHYjV+Vkaq+yF4HuCB39wk= Received: by 10.115.75.1 with SMTP id c1mr9074817wal.1192577781472; Tue, 16 Oct 2007 16:36:21 -0700 (PDT) Received: by 10.114.176.17 with HTTP; Tue, 16 Oct 2007 16:36:21 -0700 (PDT) Message-ID: Date: Wed, 17 Oct 2007 07:36:21 +0800 From: "Xiaofan Chen" To: "Hans Petter Selasky" In-Reply-To: <200710161844.20468.hselasky@c2i.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200710152303.29294.hselasky@c2i.net> <200710161844.20468.hselasky@c2i.net> Cc: freebsd-usb@freebsd.org Subject: Re: PICkit 2 again with HPS stack 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, 16 Oct 2007 23:36:22 -0000 On 10/17/07, Hans Petter Selasky wrote: > > Thanks a lot. So it seems there is still a bug in the firmware. Maybe two. > > The first one caused the stall (why?). The second one is still related to > > dealing with clear stall feature reques > > I think that the clear-stall command will flush the FIFO of the interrupt > endpoint. > > Is it possible that you can open the interrupt endpoint which is a > file, /dev/ugenX.X, before sending the version command ? So that we > don't end up clearing the stall after sending the command, but before. > PICkit 2 applications I am testing now are all using libusb. I have not really looked into the libusb FreeBSD codes (I am not good at programming) but I will try. I have the following codes from a FreeBSD user. He is trying not to use libusb. I will try to add his codes to see if it helps. static void check_device_id(void) { usb_device_descriptor_t udd; ioctl(fdpk2, USB_GET_DEVICE_DESC, &udd); if (udd.idVendor != vidMicrochip || udd.idProduct != pidPICkit2) die("device isn't a PICkit2"); } void pk2open(char *devname) { printf("pk2open =>\n"); fdpk2 = open(devname, O_RDWR); if (fdpk2 < 0) die_errno("open failed"); check_device_id(); printf("pk2open <=\n"); } static char *pk2dev = "/dev/ugen0.1"; int main(int argc, char **argv) { pk2open(pk2dev); ... } Regards, Xiaofan