I've had nothing but trouble trying to use the d2xx api's to detect new devices plugged in. slow and buggy. devices in use return a blank serial number, making you guess at things. newly plugged in devices sometimes give the same error and blank serial number.
so I'm looking for an alternative method to detect arduino's. I eventually found this:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\FTDIBUS
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\FTSER2K
has anyone done anything like this before or have any useful information for me on the method? I haven't seen any faults or foreseen problems yet. see anything that could go wrong?
If you can better explain what you're trying to do, I may be able to help.
here's my old code using the api's to list devices
Public Sub Scan()
Dim Result As Long
Dim FT_STATUS As Long
' get count
FT_STATUS = FT_ListDevices(VarPtr(Result), 0, FT_LIST_NUMBER_ONLY)
If FT_STATUS = FT_OK Then numDevices = Result Else numDevices = 0
' get list
If numDevices = 0 Then
ReDim Serials(0)
Else
ReDim Serials(0 To numDevices - 1)
Dim Buffer(16) As Byte, a As String
Dim t As Integer, B As Byte
For t = 0 To numDevices - 1
FT_STATUS = FT_ListDevices(t, VarPtr(Buffer(0)), FT_LIST_BY_INDEX Or FT_OPEN_BY_SERIAL_NUMBER)
If FT_STATUS = FT_OK Then
a = ""
For B = 0 To 15: If Buffer(B) = 0 Then Exit For
a = a & Chr$(Buffer(B))
Next B
Serials(t) = a
Else
Serials(t) = ""
End If
Next t
End If
End Sub
I'm running into some big issues scanning for devices. first off, if the arduino is connected to, the api returns the same error as if something worse went wrong. this can be worked around, but there's more. when a new device is connected, I've tried up to a 5 second delay rescanning, but it's very buggy returning the same error a few times before successfully returning the arduino's serial number. it works, just not very well at all.
if you plug in an arduino and check the registry paths I posted above, everything you need to know about the device is in there. the keys fill in when the arduino is plugged in, and can be read immediately, no errors. you can even find the com port associated with each serial number, then connect to the arduino with either method, d2xx with a serial number, or virtual com.
I'm still researching this, I'm wondering if anyone on here knows anything about it. if not, I'll continue my own research and post what I find here. I'll post my code too.
I'm running into some big issues scanning for devices. first off, if the arduino is connected to, the api returns the same error as if something worse went wrong
Which call to FT_ListDevices? The first one?
if you plug in an arduino and check the registry paths I posted above, everything you need to know about the device is in there. the keys fill in when the arduino is plugged in, and can be read immediately, no errors
You're using an Administrator account?
I'm still researching this, I'm wondering if anyone on here knows anything about it
I've written code that enumerates USB devices but not using the FTDI API.
do you think it wont have access under a user account? I'll give it a try on windows 7, hope it works.