Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Apr 2008 11:50:18 +0800
From:      "Xiaofan Chen" <xiaofanc@gmail.com>
To:        "Hans Petter Selasky" <hselasky@c2i.net>
Cc:        freebsd-usb@freebsd.org
Subject:   Re: PICDEM FS USB Bootloader under FreeBSD
Message-ID:  <a276da400804252050y1059ccf0k511251242d21d2d5@mail.gmail.com>
In-Reply-To: <200804251849.11283.hselasky@c2i.net>
References:  <a276da400710120806k636347eew876ee0fb3fc17ab3@mail.gmail.com> <a276da400804241956r3a7759bp298c76ccdaf8eb76@mail.gmail.com> <a276da400804250659t7b413c60ib9974d2c19c1d3e4@mail.gmail.com> <200804251849.11283.hselasky@c2i.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Apr 26, 2008 at 12:49 AM, Hans Petter Selasky <hselasky@c2i.net> wrote:
> Hi,
>
>  1) Try to get debugging from USB instead of OHCI.
>
>  sysctl hw.usb.ohci.debug=0
>
> sysctl hw.usb.debug=15
>
>  Retry.

[mcuee@freebsd7 /usr/home/mcuee/Desktop/build/fsusb/fsusb-0.1.11-2]$
sudo sysctl hw.usb.debug=15
Password:
hw.usb.debug: 0 -> 15

[mcuee@freebsd7 /usr/home/mcuee/Desktop/build/fsusb/fsusb-0.1.11-2]$ sudo usbdev
s
addr 1: OHCI root HUB, nVidia
 addr 2: PICkit 2 Microcontroller Programmer, Microchip Technology Inc.
addr 1: OHCI root HUB, nVidia
 addr 2: product 0x000b, I-Tuner Networks
addr 1: EHCI root HUB, nVidia
 addr 2: Mass Storage, USB
[mcuee@freebsd7 /usr/home/mcuee/Desktop/build/fsusb/fsusb-0.1.11-2]$ ./fsusb
fsusb: Software for "PICDEM Full Speed USB" demo board
fsusb <file>             program board with <file> and verify
fsusb --program <file>   program board with <file> and verify
fsusb --verify <file>    verify board against <file>
fsusb --read <file>      read board, saving result in <file>
[mcuee@freebsd7 /usr/home/mcuee/Desktop/build/fsusb/fsusb-0.1.11-2]$ ./fsusb --v
erify demo.hex
Locating USB Microchip(tm) PICDEM-FS USB(tm) (vendor 0x04d8/product 0x000b)
Found USB PICDEM-FS USB as device '/dev/ugen1' on USB bus /dev/usb1
Communication established.  Onboard firmware version is 1.0
^C after I went out for shoping for 30 minutes and came back ;-)

[mcuee@freebsd7 /usr/home/mcuee/Desktop/build/fsusb/fsusb-0.1.11-2]$ dmesg
...
ugen1: <I-Tuner Networks product 0x000b, class 0/0, rev 2.00/0.00,
addr 2> on usb1
ugenopen: flag=1, mode=8192
ugenioctl: cmd=40125569
ugenclose: flag=1, mode=8192
ugenopen: flag=3, mode=8192
ugenioctl: cmd=80045572
ugenioctl: cmd=c018556f
usbd_do_request_flags: udev=0xc40bc800 bmRequestType=0x80
bRequest=0x06 wValue=0x0200 wIndex=0x0000 wLength=0x0008
usbd_callback_wrapper: case 1
usbd_start_hardware: xfer=0xc4272070, pipe=0xc40bc9b0, nframes=2, dir=read
usbd_dump_pipe: pipe=0xc40bc9b0 edesc=0xc40bcc7d isoc_next=0
toggle_next=0 bEndpointAddress=0x00
usbd_dump_queue: pipe=0xc40bc9b0
usbd_transfer_dequeue: xfer=0xc4272070 pipe=0xc40bc9b0 sts=0 alen=16,
slen=16, afrm=2, nfrm=2
usbd_callback_wrapper: case 5
usbd_callback_wrapper: case 4
ugenioctl: cmd=80045572
ugenioctl: cmd=c018556f
usbd_do_request_flags: udev=0xc40bc800 bmRequestType=0x80
bRequest=0x06 wValue=0x0200 wIndex=0x0000 wLength=0x0029
usbd_callback_wrapper: case 1
usbd_start_hardware: xfer=0xc4272070, pipe=0xc40bc9b0, nframes=2, dir=read
usbd_dump_pipe: pipe=0xc40bc9b0 edesc=0xc40bcc7d isoc_next=0
toggle_next=0 bEndpointAddress=0x00
usbd_dump_queue: pipe=0xc40bc9b0
usbd_transfer_dequeue: xfer=0xc4272070 pipe=0xc40bc9b0 sts=0 alen=49,
slen=49, afrm=2, nfrm=2
usbd_callback_wrapper: case 5
usbd_callback_wrapper: case 4
ugenioctl: cmd=80045572
ugenioctl: cmd=c018556f
usbd_do_request_flags: udev=0xc40bc800 bmRequestType=0x80
bRequest=0x06 wValue=0x0201 wIndex=0x0000 wLength=0x0008
usbd_callback_wrapper: case 1
usbd_start_hardware: xfer=0xc4272070, pipe=0xc40bc9b0, nframes=2, dir=read
usbd_dump_pipe: pipe=0xc40bc9b0 edesc=0xc40bcc7d isoc_next=0
toggle_next=0 bEndpointAddress=0x00
usbd_dump_queue: pipe=0xc40bc9b0
usbd_transfer_dequeue: xfer=0xc4272070 pipe=0xc40bc9b0 sts=0 alen=16,
slen=16, afrm=2, nfrm=2
usbd_callback_wrapper: case 5
usbd_callback_wrapper: case 4
ugenioctl: cmd=80045572
ugenioctl: cmd=c018556f
usbd_do_request_flags: udev=0xc40bc800 bmRequestType=0x80
bRequest=0x06 wValue=0x0201 wIndex=0x0000 wLength=0x0020
usbd_callback_wrapper: case 1
usbd_start_hardware: xfer=0xc4272070, pipe=0xc40bc9b0, nframes=2, dir=read
usbd_dump_pipe: pipe=0xc40bc9b0 edesc=0xc40bcc7d isoc_next=0
toggle_next=0 bEndpointAddress=0x00
usbd_dump_queue: pipe=0xc40bc9b0
usbd_transfer_dequeue: xfer=0xc4272070 pipe=0xc40bc9b0 sts=0 alen=40,
slen=40, afrm=2, nfrm=2
usbd_callback_wrapper: case 5
usbd_callback_wrapper: case 4
ugenclose: flag=3, mode=8192
ugenopen: flag=1, mode=8192
ugenioctl: cmd=40125569
ugenclose: flag=1, mode=8192
ugenopen: flag=3, mode=8192
ugenioctl: cmd=80045572
ugenioctl: cmd=c018556f
usbd_do_request_flags: udev=0xc4c6c800 bmRequestType=0x80
bRequest=0x06 wValue=0x0200 wIndex=0x0000 wLength=0x0008
usbd_callback_wrapper: case 1
usbd_start_hardware: xfer=0xc46d8070, pipe=0xc4c6c9b0, nframes=2, dir=read
usbd_dump_pipe: pipe=0xc4c6c9b0 edesc=0xc4c6cc7d isoc_next=0
toggle_next=0 bEndpointAddress=0x00
usbd_dump_queue: pipe=0xc4c6c9b0
usbd_transfer_dequeue: xfer=0xc46d8070 pipe=0xc4c6c9b0 sts=0 alen=16,
slen=16, afrm=2, nfrm=2
usbd_callback_wrapper: case 5
usbd_callback_wrapper: case 4
ugenioctl: cmd=80045572
ugenioctl: cmd=c018556f
usbd_do_request_flags: udev=0xc4c6c800 bmRequestType=0x80
bRequest=0x06 wValue=0x0200 wIndex=0x0000 wLength=0x0020
usbd_callback_wrapper: case 1
usbd_start_hardware: xfer=0xc46d8070, pipe=0xc4c6c9b0, nframes=2, dir=read
usbd_dump_pipe: pipe=0xc4c6c9b0 edesc=0xc4c6cc7d isoc_next=0
toggle_next=0 bEndpointAddress=0x00
usbd_dump_queue: pipe=0xc4c6c9b0
usbd_transfer_dequeue: xfer=0xc46d8070 pipe=0xc4c6c9b0 sts=0 alen=40,
slen=40, afrm=2, nfrm=2
usbd_callback_wrapper: case 5
usbd_callback_wrapper: case 4
ugenclose: flag=3, mode=8192
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
ugenopen: flag=1, mode=8192
ugenioctl: cmd=40125569
ugenclose: flag=1, mode=8192
ugenopen: flag=3, mode=8192
ugenioctl: cmd=80045572
ugenioctl: cmd=c018556f
usbd_do_request_flags: udev=0xc40bc800 bmRequestType=0x80
bRequest=0x06 wValue=0x0200 wIndex=0x0000 wLength=0x0008
usbd_callback_wrapper: case 1
usbd_start_hardware: xfer=0xc4272070, pipe=0xc40bc9b0, nframes=2, dir=read
usbd_dump_pipe: pipe=0xc40bc9b0 edesc=0xc40bcc7d isoc_next=0
toggle_next=0 bEndpointAddress=0x00
usbd_dump_queue: pipe=0xc40bc9b0
usbd_transfer_dequeue: xfer=0xc4272070 pipe=0xc40bc9b0 sts=0 alen=16,
slen=16, afrm=2, nfrm=2
usbd_callback_wrapper: case 5
usbd_callback_wrapper: case 4
ugenioctl: cmd=80045572
ugenioctl: cmd=c018556f
usbd_do_request_flags: udev=0xc40bc800 bmRequestType=0x80
bRequest=0x06 wValue=0x0200 wIndex=0x0000 wLength=0x0029
usbd_callback_wrapper: case 1
usbd_start_hardware: xfer=0xc4272070, pipe=0xc40bc9b0, nframes=2, dir=read
usbd_dump_pipe: pipe=0xc40bc9b0 edesc=0xc40bcc7d isoc_next=0
toggle_next=0 bEndpointAddress=0x00
usbd_dump_queue: pipe=0xc40bc9b0
usbd_transfer_dequeue: xfer=0xc4272070 pipe=0xc40bc9b0 sts=0 alen=49,
slen=49, afrm=2, nfrm=2
usbd_callback_wrapper: case 5
usbd_callback_wrapper: case 4
ugenioctl: cmd=80045572
ugenioctl: cmd=c018556f
usbd_do_request_flags: udev=0xc40bc800 bmRequestType=0x80
bRequest=0x06 wValue=0x0201 wIndex=0x0000 wLength=0x0008
usbd_callback_wrapper: case 1
usbd_start_hardware: xfer=0xc4272070, pipe=0xc40bc9b0, nframes=2, dir=read
usbd_dump_pipe: pipe=0xc40bc9b0 edesc=0xc40bcc7d isoc_next=0
toggle_next=0 bEndpointAddress=0x00
usbd_dump_queue: pipe=0xc40bc9b0
usbd_transfer_dequeue: xfer=0xc4272070 pipe=0xc40bc9b0 sts=0 alen=16,
slen=16, afrm=2, nfrm=2
usbd_callback_wrapper: case 5
usbd_callback_wrapper: case 4
ugenioctl: cmd=80045572
ugenioctl: cmd=c018556f
usbd_do_request_flags: udev=0xc40bc800 bmRequestType=0x80
bRequest=0x06 wValue=0x0201 wIndex=0x0000 wLength=0x0020
usbd_callback_wrapper: case 1
usbd_start_hardware: xfer=0xc4272070, pipe=0xc40bc9b0, nframes=2, dir=read
usbd_dump_pipe: pipe=0xc40bc9b0 edesc=0xc40bcc7d isoc_next=0
toggle_next=0 bEndpointAddress=0x00
usbd_dump_queue: pipe=0xc40bc9b0
usbd_transfer_dequeue: xfer=0xc4272070 pipe=0xc40bc9b0 sts=0 alen=40,
slen=40, afrm=2, nfrm=2
usbd_callback_wrapper: case 5
usbd_callback_wrapper: case 4
ugenclose: flag=3, mode=8192
ugenopen: flag=1, mode=8192
ugenioctl: cmd=40125569
ugenclose: flag=1, mode=8192
ugenopen: flag=3, mode=8192
ugenioctl: cmd=80045572
ugenioctl: cmd=c018556f
usbd_do_request_flags: udev=0xc4c6c800 bmRequestType=0x80
bRequest=0x06 wValue=0x0200 wIndex=0x0000 wLength=0x0008
usbd_callback_wrapper: case 1
usbd_start_hardware: xfer=0xc46d8070, pipe=0xc4c6c9b0, nframes=2, dir=read
usbd_dump_pipe: pipe=0xc4c6c9b0 edesc=0xc4c6cc7d isoc_next=0
toggle_next=0 bEndpointAddress=0x00
usbd_dump_queue: pipe=0xc4c6c9b0
usbd_transfer_dequeue: xfer=0xc46d8070 pipe=0xc4c6c9b0 sts=0 alen=16,
slen=16, afrm=2, nfrm=2
usbd_callback_wrapper: case 5
usbd_callback_wrapper: case 4
ugenioctl: cmd=80045572
ugenioctl: cmd=c018556f
usbd_do_request_flags: udev=0xc4c6c800 bmRequestType=0x80
bRequest=0x06 wValue=0x0200 wIndex=0x0000 wLength=0x0020
usbd_callback_wrapper: case 1
usbd_start_hardware: xfer=0xc46d8070, pipe=0xc4c6c9b0, nframes=2, dir=read
usbd_dump_pipe: pipe=0xc4c6c9b0 edesc=0xc4c6cc7d isoc_next=0
toggle_next=0 bEndpointAddress=0x00
usbd_dump_queue: pipe=0xc4c6c9b0
usbd_transfer_dequeue: xfer=0xc46d8070 pipe=0xc4c6c9b0 sts=0 alen=40,
slen=40, afrm=2, nfrm=2
usbd_callback_wrapper: case 5
usbd_callback_wrapper: case 4
ugenclose: flag=3, mode=8192
ugenopen: flag=3, mode=8192
ugenioctl: cmd=80045565
ugen_set_config: configno 1, sc=0xc4e74000
ugenclose: flag=0, mode=0
ugenopen: flag=3, mode=8192
ugenioctl: cmd=80045572
ugenwrite:
usbd_get_pipe: udev=0xc4c6c800 iface_index=0 address=0x1 type=0x2
dir=0x0 index=0
usbd_get_pipe: udev=0xc4c6c800 iface_index=0 address=0x0 type=0x0
dir=0xff index=0
usbd_get_pipe: udev=0xc4c6c800 iface_index=0 address=0x1 type=0x2
dir=0x0 index=0
usbd_get_pipe: udev=0xc4c6c800 iface_index=0 address=0x0 type=0x0
dir=0xff index=0
ugenwrite: transferred 5 bytes
usbd_callback_wrapper: case 1
usbd_callback_wrapper: case 1
usbd_clear_data_toggle: udev=0xc4c6c800 pipe=0xc4c6c9c4
usbd_start_hardware: xfer=0xc5bb7140, pipe=0xc4c6c9b0, nframes=1, dir=write
usbd_dump_pipe: pipe=0xc4c6c9b0 edesc=0xc4c6cc7d isoc_next=0
toggle_next=0 bEndpointAddress=0x00
usbd_dump_queue: pipe=0xc4c6c9b0
usbd_transfer_dequeue: xfer=0xc5bb7140 pipe=0xc4c6c9b0 sts=22 alen=8,
slen=8, afrm=1, nfrm=1
usbd_callback_wrapper: case 5
usbd_callback_wrapper: case 4
ugen_write_clear_stall_callback: sce=0xc4e74084: stall cleared
usbd_callback_wrapper: case 1
usbd_start_hardware: xfer=0xc5ba7070, pipe=0xc4c6c9c4, nframes=1, dir=write
usbd_dump_pipe: pipe=0xc4c6c9c4 edesc=0xc4294792 isoc_next=0
toggle_next=0 bEndpointAddress=0x01
usbd_dump_queue: pipe=0xc4c6c9c4
usbd_transfer_dequeue: xfer=0xc5ba7070 pipe=0xc4c6c9c4 sts=0 alen=5,
slen=5, afrm=1, nfrm=1
usbd_callback_wrapper: case 5
usbd_callback_wrapper: case 4
ugen_default_write_callback: waking 0xc4e74084
ugenioctl: cmd=80045572
ugenioctl: cmd=80045571
ugenread:
usbd_get_pipe: udev=0xc4c6c800 iface_index=0 address=0x1 type=0x2
dir=0x80 index=0
usbd_get_pipe: udev=0xc4c6c800 iface_index=0 address=0x0 type=0x0
dir=0xff index=0
usbd_get_pipe: udev=0xc4c6c800 iface_index=0 address=0x1 type=0x2
dir=0x80 index=0
usbd_get_pipe: udev=0xc4c6c800 iface_index=0 address=0x0 type=0x0
dir=0xff index=0
usbd_callback_wrapper: case 1
usbd_callback_wrapper: case 1
usbd_clear_data_toggle: udev=0xc4c6c800 pipe=0xc4c6c9d8
usbd_start_hardware: xfer=0xc5bc8140, pipe=0xc4c6c9b0, nframes=1, dir=write
usbd_dump_pipe: pipe=0xc4c6c9b0 edesc=0xc4c6cc7d isoc_next=0
toggle_next=1 bEndpointAddress=0x00
usbd_dump_queue: pipe=0xc4c6c9b0
usbd_transfer_dequeue: xfer=0xc5bc8140 pipe=0xc4c6c9b0 sts=22 alen=8,
slen=8, afrm=1, nfrm=1
usbd_callback_wrapper: case 5
usbd_callback_wrapper: case 4
ugen_read_clear_stall_callback: sce=0xc4e74084: stall cleared
usbd_callback_wrapper: case 1
usbd_start_hardware: xfer=0xc5bb8070, pipe=0xc4c6c9d8, nframes=1, dir=read
usbd_dump_pipe: pipe=0xc4c6c9d8 edesc=0xc4294799 isoc_next=0
toggle_next=0 bEndpointAddress=0x81
usbd_dump_queue: pipe=0xc4c6c9d8
usbd_transfer_dequeue: xfer=0xc5bb8070 pipe=0xc4c6c9d8 sts=0 alen=4,
slen=4, afrm=1, nfrm=1
usbd_callback_wrapper: case 5
usbd_callback_wrapper: case 4
ugen_default_read_callback: waking 0xc4e74084
ugenread: got 4 of 4 bytes
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
usb_event_thread: woken up
ugenclose: flag=3, mode=8192
ugenclose: flag=3, mode=8192
usbd_transfer_dequeue: xfer=0xc5bb8070 pipe=0xc4c6c9d8 sts=5 alen=4,
slen=4, afrm=1, nfrm=1
usbd_transfer_dequeue: xfer=0xc5bc8140 pipe=0xc4c6c9b0 sts=5 alen=8,
slen=8, afrm=1, nfrm=1
usbd_transfer_dequeue: xfer=0xc5ba7070 pipe=0xc4c6c9c4 sts=5 alen=5,
slen=5, afrm=1, nfrm=1
usbd_transfer_dequeue: xfer=0xc5bb7140 pipe=0xc4c6c9b0 sts=5 alen=8,
slen=8, afrm=1, nfrm=1


By the way, lsusb can read the VID/PID correctly but usbdevs does not do
it correctly. There is no string descriptor for the bootloader device since
it has limited storage (0x800 Bytes only).

ugen1: <I-Tuner Networks product 0x000b, class 0/0, rev 2.00/0.00,
addr 2> on usb1
[mcuee@freebsd7 /usr/home/mcuee/Desktop/build/fsusb/fsusb-0.1.11-2]$ lsusb
Bus /dev/usb0 Device /dev/ugen0: ID 04d8:0033 Microchip Technology, Inc.
Bus /dev/usb1 Device /dev/ugen1: ID 04d8:000b Microchip Technology, Inc.

[mcuee@freebsd7 /usr/home/mcuee/Desktop/build/fsusb/fsusb-0.1.11-2]$
sudo usbdevs
addr 1: OHCI root HUB, nVidia
 addr 2: PICkit 2 Microcontroller Programmer, Microchip Technology Inc.
addr 1: OHCI root HUB, nVidia
 addr 2: product 0x000b, I-Tuner Networks
addr 1: EHCI root HUB, nVidia
 addr 2: Mass Storage, USB


>  2) Patch /sys/dev/usb/ugen.c
>
>  Change all lines looking like the following, that are not in a function
>  named "xxx_callback":
>
>  sce->read_stall = 1;
>  sce->write_stall = 1;
>
>  Into:
>
>  sce->read_stall = 0;
>  sce->write_stall = 0;
>
>  Recompile ugen an try again.

Maybe this is a stupid question but how do I compile ugen only and not
the whole kernel?

Normally I will use the following command with this modifications.
[root@freebsd7 /usr/src]# make buildkernel installkernel
KERNCONF=custom -DNOCLEAN -DNO_CLEAN -DNO_KERNELDEPEND

But with major updates I will just use
make buildkernel installkernel KERNCONF=custom

I will try this out and report back.

Xiaofan



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