[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Improving Windows support for AVRDUDE

From: Xiaofan Chen
Subject: Re: Improving Windows support for AVRDUDE
Date: Wed, 1 Dec 2021 11:10:31 +0800

On Wed, Dec 1, 2021 at 2:28 AM Marius Greuel <greuelm@mgtek.com> wrote:
> I would like to make a few proposals for improving the Windows version of
> avrdude.
> IMHO, the biggest issue with avrdude on Windows is the lack of native driver
> support, which is due the dependency on libusb and libftdi. Both
> implementations are based on the Windows port libusb-win32, which includes
> its own kernel driver libusb0.sys. While libusb-win32 does provide the
> functionality, it has its own set of problems. Most importantly, libusb it
> is not the way to go on Windows: The proper way to access USB devices is to
> either use the vendor stock drivers or system supplies drivers, for instance
> the Atmel or FTDI supplies drivers. Windows users of avrdude are well aware
> of the required workarounds to get libusb installed, such as using Zadig. It
> really becomes a nightmare when you use other applications in parallel,
> where one application, such Atmel Studio, requires the vendor drivers and
> avrdude requires libusb.
> Now, for Windows users, it would be nice if avrdude just "works out of the
> box", as it does on Linux. One of the key points is to move away from the
> libusb0.sys driver to the WinUSB driver. WinUSB is the Windows equivalent of
> libusb, which is what people use (including Atmel) when you do not want to
> cook up your own USB driver. Some choose to use the HID stack, which works
> equally well.
> As a first step, I hacked up a libusb compatible library for avrdude, that
> adds support for both libusb(K) and WinUSB. Having WinUSB support enables
> Windows users to move away from libusb, while providing backwards
> compatibility. All in all, my patches seem to work for the devices I own,
> such as AVRISP MKII, but there are probably issues that need to be fixed.
> My avrdude repo with the patched libraries in the 'external' folder can be
> viewed here:
> https://github.com/mariusgreuel/avrdude

Yes it is a good move to move away from libusb-0.1 API to libusb-1.0 API
now that libusb-1.0 API is available in the majority of the OS out there,
including Windows, Linux, macOS, BSDs, Solaris and others. Just take
note FreeBSD has its own implementation of the libusb-1.0 API.

libusb wiki: https://github.com/libusb/libusb/wiki
libusb-win32 wiki: https://github.com/mcuee/libusb-win32/wiki

You can see that we at libusb-win32 project actually recommend
people to migrate to libusb-1.0 API when even possible, even though
we still improve libusb-win32 in terms of bug fixes.

On the libusb project side, we recommend people to use WinUSB
driver. Take note we recommend HID devices to use HIDAPI.

There is a middle ground for people who want to use WinUSB
driver with libusb-0.1 API though, that is libusb-compat-0.1.

Xiaofan (non developer admin of the libusb and libusb-win32 project)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]