I have successfully ported Rick Luddy's Linux
USB bootloader for the PIC FS USB demo board at
http://internetking.org/fsusb/ to Windows using
libusb-win32 and MingW.
With the source in the website, one should be able to
recompile the application in Windows.
I am still contacting the original author to see if he
can incorporate my changes. I am also trying to find
a place to post the compiled application.
Edit: add the email here
> -----Original Message-----
> From: KILLspampiclist-bouncesspamspamKILLspammit.edu
> [ EraseMEpiclist-bouncesTakeThisOuTspammit.edu] On Behalf Of Chen Xiao Fan
> Sent: 2005 Aug 04, Thu 06:12
> To: 'piclistspam.....mit.edu'
> Cc: '@spam@rluddyspam_OUTspam.....acm.org'
> Subject: Re: [PIC] Porting libusb application to Windows
> using libusb-win32
>
> With the help of the developer of libusb-win32 Stephan Meyer,
> I have my first success in the porting efforts. I have ported
> Rick Luddy's USB Linux bootloader for the PIC FS USB demo
> board to Windows.
>
> Since I do not have a web site, I will list the changes here.
>
> 1) solve the problem of getline with Mingw by downloading
> getline.c and getline.h from the internet and adds the header
> file to rjlhex.c. Add getline.o to the make file as well.
>
> 2) the other changes are all applied to fsusb.c
> a) remove call to geteuid. Windows does not have this.
> b) for (bus=usb_busses;bus!=NULL;bus=bus->next) {
> --> for (bus=usb_get_busses();bus!=NULL;bus=bus->next) {
> c) The main problem is the endpoint address. Linux libusb is
> not so strict as libusb-win32.
>
> c1) change "const static int fsusb_endpoint=1" to "const
> static int fsusb_endpoint_in=0x81" and const static int
> fsusb_endpoint_out=1".
>
> c2) change
> r=usb_bulk_read(d, fsusb_endpoint, dest, len, fsusb_timeout);
> to:
> r=usb_bulk_read(d, fsusb_endpoint_out, dest, len, fsusb_timeout);
>
> c3) change
> r=usb_bulk_write(d, fsusb_endpoint, "\0\0\0\0\0", 5, fsusb_timeout);
> to:
> r=usb_bulk_write(d, fsusb_endpoint_in, "\0\0\0\0\0", 5,
> fsusb_timeout);
>
> c4) change the rest of the usb_bulk_write() functions to use
> fsusb_endpoint_in.
>
> After these changes, the fsusb application works just like
> the Linux version. It seems that the Linux version of libusb
> is not so strict on the endpoint address. Despite the error
> message when flashing the HID demo hex file, the firmware
> seems to work properly. I have the same error message under
> Linux. So this is not the problem in the porting.
>
> If possible I would like to post the changed codes and the
> compiled application to a web site. The ported application is
> command line based and require the installation of the filter
> driver of libusb-win32 and the original Microchip drivers.
>
> My next step is the usb_pickit application.
>
> Regards,
> Xiaofan
>
<message edited by xiaofan on Monday, July 28, 2008 6:27 AM>