sergev / pic32prog

Flash programming utility for Microchip PIC32 microcontrollers
GNU General Public License v2.0
111 stars 52 forks source link

Can MPSSE be re-written to use libusb-1.0 instead of libusb-0.1? #40

Open majenkotech opened 8 years ago

majenkotech commented 8 years ago

It is a bit of a library nightmare having to have both libusb-1.0 and libusb-0.1 installed. It seems a bit of a stupid state of affairs that pic32prog needs them both, when one (0.1) is only needed for mpsse support. Is there something specific that mpsse needs from libusb-0.1 that libusb-1.0 doesn't provide? Can mpsse be re-written to use libusb-1.0 instead, so that we can drop the requirement of libusb-0.1 entirely?

majenkotech commented 8 years ago

In answer: yes, it looks like it can - and it may end up cleaner because of it (better platform abstraction, better device probing, etc).

I have gone through and changed the libusb0 calls to libusb1 calls and made a number of other small changes (boards are now found in a LUT instead of hard coded in a list of ifs). It compiles. That's all I can say about it though since I have nothing to test it on.

I will drop it into a separate PR so you can try it out.

sergev commented 8 years ago

Great! I've also updated the Windows version. Still need to test it though.

sergev commented 8 years ago

Technically, it's possible to get rid of libusb-1.0 as well, and use direct udev or IOHID API. May be someday in distant future.

majenkotech commented 8 years ago

Well, since hidapi, which is used throughout the rest of the adapters, uses libusb-1.0, there's no point - we'll be linking it in anyway. So we may as well just stick with libusb-1.0... unless you want to drop hidapi too?

sergev commented 8 years ago

Hidapi uses libusb only in Linux. Neither Windows nor MacOSX need it. By itself, hidapi is a pretty thin layer of code. It should be easy to integrate into the project and reduce the external dependency.