Space is always available at piclist.com --- James. > -----Original Message----- > From: piclist-bounces@mit.edu > [mailto:piclist-bounces@mit.edu] On Behalf Of Chen Xiao Fan > Sent: 2005 Aug 04, Thu 06:12 > To: 'piclist@mit.edu' > Cc: 'rluddy@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 > > -------------- > Sample session using MSYS: > > Test@PCAMD64 /e/Coding/fsusb0111 > $ fsusb picdemfsusb.hex 1>picfsusbmsg.txt 2>&1 > > Test@PCAMD64 /e/Coding/fsusb0111 > $ less picfsusbmsg.txt > Locating USB Microchip(tm) PICDEM-FS USB(tm) (vendor > 0x04d8/product 0x000b) found 3 busses Found USB PICDEM-FS USB > as device '\\.\libusb0-0003--0x04d8-0x000b' on USB bus bus-1 > Communication established. Onboard firmware version is 1.0 > Writing program memory successful Program memory validated > > Test@PCAMD64 /e/Coding/fsusb0111 > $ fsusb hid.hex 1>hid.txt 2>&1 > > Test@PCAMD64 /e/Coding/fsusb0111 > $ less hid.txt > Locating USB Microchip(tm) PICDEM-FS USB(tm) (vendor > 0x04d8/product 0x000b) found 3 busses Found USB PICDEM-FS USB > as device '\\.\libusb0-0003--0x04d8-0x000b' on USB bus bus-1 > Communication established. Onboard firmware version is 1.0 > Writing program memory successful mismatch in 32-byte chunk > at 0x00000000: > File: > 95ef0af01200#################################################### > Device:e3ef03f01200ffff04ef04f01200ffffffffffffffffffff0cef04f > 01200ffff > Program memory contains errors! > > > ----- Original Message ----- > From: "Chen Xiao Fan" > Newsgroups: gmane.comp.hardware.microcontrollers.pic > Sent: Monday, July 25, 2005 11:13 AM > Subject: [PIC] Porting libusb application to Windows using > libusb-win32 > > > > Over the weekend I was trying to port two Linux applications > > to Windows using libusb-win32 and MingW. > > > > One application is Mark Rages' PICkit 1 application used > > to be at http://mlug.missouri.edu/~markrages/software/usb_pickit/. > > It seems to me that the web site is down now. > > > > The other is Rick Luddy's USB bootloader for the PIC FS USB > > demo board at http://internetking.org/fsusb/. > > > > Both are based on Orion Sky Lawlor's original work for PICkit 1 > > at the following URL: > > > http://lawlor.cs.uaf.edu/~olawlor/projects/2003/microchip/index.html. > > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist