Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Oct 2007 07:36:21 +0800
From:      "Xiaofan Chen" <xiaofanc@gmail.com>
To:        "Hans Petter Selasky" <hselasky@c2i.net>
Cc:        freebsd-usb@freebsd.org
Subject:   Re: PICkit 2 again with HPS stack
Message-ID:  <a276da400710161636q492cd6d5sc28677765a7b6c9a@mail.gmail.com>
In-Reply-To: <200710161844.20468.hselasky@c2i.net>
References:  <a276da400710120332h5f780ee8g9a12d5fb5548f8da@mail.gmail.com> <200710152303.29294.hselasky@c2i.net> <a276da400710160542q71bb4983jf27b59cb0e5ee104@mail.gmail.com> <200710161844.20468.hselasky@c2i.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On 10/17/07, Hans Petter Selasky <hselasky@c2i.net> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a276da400710161636q492cd6d5sc28677765a7b6c9a>