Skip to content

Add Win FTDI driver detection #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
PropGit opened this issue Feb 9, 2017 · 4 comments
Closed

Add Win FTDI driver detection #37

PropGit opened this issue Feb 9, 2017 · 4 comments
Assignees

Comments

@PropGit
Copy link

PropGit commented Feb 9, 2017

Add support for Windows FTDI driver detection.

This should be used for logging as well as an error check before downloading to prompt the user that there's a specific roadblock in their way. Ideally, it will provide instruction and a link/button to get the necessary drivers installed.

This relates partially to Issue #35.

@PropGit PropGit added this to the February Enhancements milestone Feb 9, 2017
@PropGit PropGit self-assigned this Feb 9, 2017
@PropGit
Copy link
Author

PropGit commented Feb 14, 2017

While exploring the Win API for the necessary calls (something I remember seeing in the past while building the Parallax USB Driver Installer), I came across information that there's already an existing command-line tool included in Windows that may give us the info we need: driverquery.exe.

https://technet.microsoft.com/en-us/library/bb490896.aspx

Below, I'm running it through my Bash console just so I can use grep to find only what I'm after and stretch out the width of the window. It returns info about every driver installed, so we'll want to parse the output somehow.

The driver name to look for is "FTDIBUS" and "FTSER2K"... both are always installed by our driver installer and the latter is the Virtual COM port driver component.

I'm using the /V option in this case (//V in bash shell) and I've put the legend at the top just so you can see what the results mean.

Here's with the drivers installed but no Parallax board connected to the computer:

$ driverquery //V | grep FT

Module Name  Display Name           Description            Driver Type   Start Mode State      Status     Accept Stop Accept Pause Paged Pool Code(bytes BSS(by Link Date              Path                                             Init(bytes
============ ====================== ====================== ============= ========== ========== ========== =========== ============ ========== ========== ====== ====================== ================================================ ==========
FTDIBUS      USB Serial Converter D USB Serial Converter D Kernel        Manual     Stopped    OK         FALSE       FALSE        12,288     77,824     0      10/3/2016 6:33:48 AM   C:\Windows\system32\drivers\ftdibus.sys          4,096
FTSER2K      USB Serial Port Driver USB Serial Port Driver Kernel        Manual     Stopped    OK         FALSE       FALSE        32,768     28,672     0      10/3/2016 6:34:44 AM   C:\Windows\system32\drivers\ftser2k.sys          4,096

...and here's with a Parallax board connected to the computer:

$ driverquery //V | grep FT

Module Name  Display Name           Description            Driver Type   Start Mode State      Status     Accept Stop Accept Pause Paged Pool Code(bytes BSS(by Link Date              Path                                             Init(bytes
============ ====================== ====================== ============= ========== ========== ========== =========== ============ ========== ========== ====== ====================== ================================================ ==========
FTDIBUS      USB Serial Converter D USB Serial Converter D Kernel        Manual     Running    OK         TRUE        FALSE        12,288     77,824     0      10/3/2016 6:33:48 AM   C:\Windows\system32\drivers\ftdibus.sys          4,096
FTSER2K      USB Serial Port Driver USB Serial Port Driver Kernel        Manual     Running    OK         TRUE        FALSE        32,768     28,672     0      10/3/2016 6:34:44 AM   C:\Windows\system32\drivers\ftser2k.sys          4,096

One thing I wish it'd do is tell us the driver version number, but it doesn't seem to have an option for that.

Can we make Python call driverquery and parse the results to get the info we need?

One thing that may be a concern is that it might not work for us when run under a user's account that is restricted. We'll have to test it and see. Also, I can't find any info saying what versions of Windows includes this tool, but I believe it's Win Vista and above.

@PropGit
Copy link
Author

PropGit commented Feb 15, 2017

The Windows built-in driverquery.exe is best for our current needs.

For future reference, there's also the devcon.exe (in both 32-bit and 64-bit versions), attached, that is not included with Windows but is available in the WDK. It has many more options but isn't as easy to get the info we need. It also seems to rely on a hardware device being attached in order to see the driver details... not exactly what we want.

As a final note, the Windows SetupAPI includes calls to gather this information if we need to programmatically explore more at a later time.

WDK Tools (2017-02-14).zip

@PropGit
Copy link
Author

PropGit commented Feb 16, 2017

In PR #51, @zfi mentioned that the driverquery.exe doesn't list FTDI driver information unless a qualified USB device is attached. I didn't witness that happen the first time I tested it; however, now I can confirm that it appears driverquery.exe doesn't list FTDI driver information unless a qualified USB device has been connected at least once during that computer's current session; otherwise, it gives no information about the driver's even being installed. This is very unfortunately. Looks like we're stuck with it for now and perhaps I can create a SetupAPI-based exe that can overcome this problem. We'll see. For now, we'll just accept it as it is.

@PropGit
Copy link
Author

PropGit commented Feb 16, 2017

Created Issue #47 to attempt to improve this detection on Windows. This current issue is complete.

@PropGit PropGit closed this as completed Feb 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant