stepsger.blogg.se

Getf vid
Getf vid













getf vid

String pattern = String.Format( " ^VID_", VID, PID)ĭim _rx As Regex = New Regex(pattern, RegexOptions.IgnoreCase)ĭim s3 As String For Each s3 In rk2.GetSubKeyNames() / /// /// /// List ComPortNames( String VID, String PID) / /// Compile an array of COM port names associated with given VID and PID That will be a problem if you have more than 1 device from the same manufacturer in use at the same time. This method returns a list of ALL serial devices with that VID/PID combination currently plugged in. Regular Expressions makes the comparison much simpler and reliable. By examining the registry via RegEdit you'll see uppercase, lowercase or a mixture of both. I am looking for a key in the format VID_XXXXPID_XXXX, where XXXX are 4 hex digits and is (any) single character. That's because Registry key formats are inconsistent. The function below drills down though the relevant part of the registry and filters out values with the desired VID and PID values. NET solution, but will work for the vast majority of My initial attempt used WMI and Win32 classes, but I was not able to find the information needed. Make a note of the 4 digit numbers of interest, in this case VID is 0403, PID is 6001. A dialog box pops up, select the Details tab and Hardware ID's property. Select the port of interest, in this case COM8, right click and select Properties. Here's what I see on my machine when the Arduino board is plugged in.

getf vid

Open the device manager and expand the list of COM ports. Note that the device must be plugged in to make it visible. The information you need is located in the Device Manager, sometimes in more than one place. The intersection of the 2 lists is the COM port desired. My approach is to compile an array of all COM port numbers that were historically allocated to a particular VID/PID combination.įrom there it is simple to compare the list of COM ports open now to the list of comports that were allocated to the VID/PID. Most USB serial port devices have unique hardware ID's, so as you plug in more serial devices, each device is then allocated a unique COM port number. The lazy way is to display a list of all knownĬomports and get the user to select the correct one. I needed to write an application that interacted with an Arduino board via its COM port.















Getf vid