adafruit / Adafruit_Windows_Drivers

All in one Windows driver installer for Adafruit's boards.
MIT License
88 stars 28 forks source link

Add WinUSB driver for USBtinyISP programmers. #23

Closed Amavect closed 4 years ago

Amavect commented 4 years ago

The WinAVR version of avrdude uses the old libusb-win32, circa 2010. Libusb-win32 was a port of the old libusb before it had a redesign. Libusb-win32 uses their libusb0.sys windows kernel driver. Since libusb's update, libusb doesn't appear to recognize libusb-win32 device setup classes. So, new avrdude builds do not recognize the usbtinyisp programmer. Replacing the kernel driver with the WinUSB driver will work. WinUSB is preinstalled with all Windows systems since Windows Vista.

However, this breaks compatibility with WinAVR avrdude.

Added a new inf file with the WinUSB device interface class. The NSIS script is modified to add the new driver, and to make the two drivers mutually exclusive. A message box should be sufficient to inform users about the alt driver.

Closes #22

ladyada commented 4 years ago

thanks - we'll check this out later, and its great to have this PR :)

dhalbert commented 4 years ago

@ladyada Shall I merge this before the next release? I'm not sure I can test this properly.

ladyada commented 4 years ago

yeah i think its ok!

Amavect commented 4 years ago

Oh wow, I was wondering about this recently!

For this pull request to really be finished, you guys need to sign the driver with a file named usbtiny_winusb.cat I'm not sure how that's done. I'm willing to test this on my Windows 10 machine. Should I open another issue for this?

@dhalbert Here's some info if you want to test this. Probably do this in a VM. Or not. :P

  1. Install the driver. (Requires signing the driver in Win10. Only you guys can do that. I use Win7, so that's not necessary.)
  2. Install MSYS2 https://www.msys2.org/
  3. Run MSYS2's 32-bit MinGW environment, mingw32.exe
  4. Install avrdude with MSYS2's package manager.
  5. Ping the usbtiny programmer.

Steps 3 and 4 look like the following:

pacman -S mingw32/mingw-w64-i686-avrdude
avrdude -c usbtiny -p t85
dhalbert commented 4 years ago

Our signing certificate has expired, and we are not going to renew it, because Windows 7 is already EOL. Are you willing to install an unsigned driver? That's certainly possible on Win7 with a warning. I don't know about Win10.

Amavect commented 4 years ago

Win10 requires a signed driver, unless a user goes through a few cryptic steps to disable the check. I'm fine with an unsigned driver. I think it's safe to ignore it until some user really wants it.