3

I'm working with a GPS sports logger for which Windows 10 default installs the usbser.sys driver. This standard driver does not support the WebUSB API. For that reason, on my local Windows 10 machine, I successfully use Zadig (v2.4) to install the libusbK driver.

Because I've open sourced the WebUsb-mtk code specific to this GPS sports logger (and other loggers with the MTK 3329 GPS module), I'd like to also distribute this signed driver to other Windows 10 users of similar hardware.

What are the steps to generate an installation package that correctly disables (?) the existing driver and installs the libusbK driver for my hardware? (LibUSBK is already signed, so I think the signature is not relevant.)


p.s. With Mac OS X, WebUSB for this hardware works out of the box.

philshem
  • 33
  • 9

1 Answers1

3

According to libusbK - Creating Client Installers With InfWizard, the installer does basically all its operations by using the Driver Package Installer (DPInst), which is a standard feature in Windows.

According to Using DPInst to Uninstall Driver Packages, the syntax to uninstall a driver is:

DPInst.exe /u path-to-inf-file

The driver for usbser.sys I found in the folder C:\Windows\WinSxS\amd64_dual_usbser.inf_31bf3856ad364e35_10.0.17134.1_none_8281fb62ec80df7e, so uninstalling it could be by using a command such as:

DPInst.exe /u C:\Windows\WinSxS\amd64_dual_usbser.inf_31bf3856ad364e35_10.0.17134.1_none_8281fb62ec80df7e

It would of course be better if your installer could verify first that this file exists, and if not then search for it.

The next step would be to install libusbK using the command:

DPInst.exe libusbK.inf

Since you have installed libusbK, you should have the .sys and the .inf files that belong to it. You need to have them both in one folder, then invoke DPInst on the .inf file.

(As I don't have these files, this answer is mostly theory.)

harrymc
  • 455,459
  • 31
  • 526
  • 924
  • thanks! so the installer is actually just a dos script? Can I uninstall usbser.sys for just this device, and not for potentially all devices? – philshem Nov 15 '18 at 15:18
  • It was probably done in the installer via a program, rather than a script, but might be possible from a script. From `usbser.inf` I gather that this is a generic driver that is associated with USB devices in general and doesn't specify device-ids. I don't have the files for libusbK so can't examine them. – harrymc Nov 15 '18 at 15:31
  • I read a bit more. It seems one way is to use Visual Studio to create a driver package https://docs.microsoft.com/en-us/windows-hardware/drivers/develop/creating-a-driver-package Also it seems DPInst is now DIFX – philshem Nov 15 '18 at 18:21
  • Also it seems that Zadig.exe can create the files necessary to share as a driver install package. I'll keep trying, but many thanks for a push in the right direction. – philshem Nov 15 '18 at 18:24
  • DPInst is still there and is used by the libusbK installers, so it still works as well as ever. If made available libusbK.inf/sys I'll compare with usbser.inf. – harrymc Nov 15 '18 at 20:18
  • [Here is the .inf file](https://pastebin.com/raw/KrA8WEBh). Is that enough to compare? – philshem Nov 19 '18 at 07:35
  • Comparing the two files, `usbser.inf` is a modern driver handling the class of USB devices. `libusbK.inf` is an older format from before Windows 8, defining its own device class rather than using newer standards. This is discussed in [one post](https://sourceforge.net/p/libusb/mailman/message/34481429/) from 2015 that advises moving to the new standard, but may hint that Zadig may do additional changes to the registry to make it work. The only way is to test DPInst, and if problems, to capture the registry changes done by Zadig (there are products for that). Better use a VM for testing. – harrymc Nov 19 '18 at 09:27
  • Any way to get `usbser.inf` to work with [WebUSB](https://github.com/WICG/webusb)? _Or is that another question?_ – philshem Nov 19 '18 at 10:46
  • I don't know the internals of `usbser` that well, so don't know if that's possible, but I doubt that these two different frameworks can be made to work together. If that was easy, libusbK would have been written that way. – harrymc Nov 19 '18 at 11:53
  • Yeah, I'm in over my head with this driver thing ;) - check out this reply to my comment on the Github issue regarding windows https://github.com/WICG/webusb/issues/143#issuecomment-440348384 – philshem Nov 21 '18 at 07:57
  • Good, they are on the right track now. – harrymc Nov 21 '18 at 08:33