-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[all] Serialport.list Information Wrong/Missing #1220
Comments
It's been a long time since I've fully explored the apis involved but you can find the code responsible for returning the information here; https://github.com/EmergingTechnologyAdvisors/node-serialport/blob/master/src/serialport_win.cpp#L525-L573 Long story short, we ask the system for the info with
So it's probably down to the drivers your using to load the FTDI device. Maybe FTDI has newer ones or will take a bug report? For the serial number, I don't see that as a thing we can read from the pnp subsystem but I might be overlooking it. I do see we read some values out of the registry with Happy to add it if you can figure it out. Also happy to be shown references to how other serial port libraries (eg pyserial) if they include the missing info, so we can copy them. |
Ok so i searched through the windows registry after taking a look at : On Windows 10 the USB registry files are located under: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB This is what I see on windows: Note that I have highlighted one of the folders A51MAMME. This name of the folder is the serial number for this device. If I go to the Device Parameters folder I see the following: Note the SymbolicName REG_SZ : It contains the VID (0403), PID (6001), and the serialnumber (A51MAMME). So it looks like the serial number is available in the registry :) So maybe we can retrieve it with RegQueryValueEx? |
So I installed pyserial on windows and ran their equivalent command line list and got the following: COM23 So I dug into their code and it looks like they are retrieving the information from the registry using regular expressions, shown in the highlighted lines in the link below: |
I'm confused. We have quite a few results.
Is |
Ok sorry for the confusion, I switched devices midway through, which was definitely confusing. I have gone back through my posts and fixed them so that the sole device discussed is the one with the serial number A51MAMME. A51MAMME is the expected value in all cases. linux node-serialport: MLI_scale_A51MAMME registry: A51MAMME pyserial: A51MAMMEA So I didn't notice this before, but it looks like windows node-serialport is picking up the serial number in the pnpID. For reference here is the windows node-serialport -f -jsonline printout for the A51MAMME device: {"comName":"COM23","manufacturer":"FTDI","pnpId":"FTDIBUS\VID_0403+PID_6001+A51MAMMEA\0000","vendorId":"0403","productId":"6001"} Note the pnpID contains "A51MAMMEA", I am not sure why we are getting an extra "A" character at the end. It would probably be easy enough to extract the serialNumber from windows registry or pnpID, and then return a "serialNumber" entry in the serialport-list json object. If we wanted the linux "serialNumber" and windows "serialNumber" entries to match, it would probably be best to remove the extra information stored in the linux entry (aka manufacturer, which already exists as a separate entry, and the manufacturer description (perhaps a new entry could be added for this information?)). |
I only have an arduino uno to test with linux {
"comName":"/dev/ttyACM0",
"pnpId":"usb-Arduino__www.arduino.cc__0043_752303138333518011C1-if00",
"productId":"0x0043",
"serialNumber":"Arduino__www.arduino.cc__0043_752303138333518011C1",
"manufacturer":"Arduino__www.arduino.cc_",
"vendorId":"0x2341"
} osx {
"comName":"/dev/tty.usbmodem1431",
"manufacturer":"Arduino (www.arduino.cc)",
"serialNumber":"752303138333518011C1",
"locationId":"0x14300000",
"vendorId":"0x2341",
"productId":"0x0043"
} windows {
"comName":"COM3",
"manufacturer":"Microsoft",
"pnpId":"USB\\VID_2341&PID_0043\\752303138333518011C1",
"locationId":"Port_#0003.Hub_#0001",
"vendorId":"2341",
"productId":"0043"
} Ideal {
"manufacturer":"Arduino (www.arduino.cc)",
"serialNumber":"752303138333518011C1",
"vendorId":"2341",
"productId":"0043"
} The locationId and pnpId are not consistant, I don't know what they should be. osx {
"locationId":"14300000",
"pnpId": undefined
} windows {
"locationId":"Port_#0003.Hub_#0001",
"pnpId":"USB\\VID_2341&PID_0043\\752303138333518011C1",
} linux {
"locationId": undefined,
"pnpId":"usb-Arduino__www.arduino.cc__0043_752303138333518011C1-if00"
} Does the ideal look correct to you? Do you have thoughts on the locationId and pnpId? |
To fuel the discussion, I am also using a FTDI chip, and facing this problem. Here is the value of the serialport object on windows:
Here is the equivalent on Linux:
The expected serial number here for me is Pyserial seems to face the same difficulties pyserial/pyserial#61. But today I faced a new behavior, while I was testing on Windows, some ports identified this way:
So here the regexp is pretty useless. |
@reconbot The ideal looks correct to me. It appears that windows and linux have unique pnpID formats (Ref. https://www.netiq.com/documentation/platespin-migrate-12-2/migrate-user/data/t40xx337skwt.html). I am not sure what the locationID. @thiago-sylvain what version of Windows are you using? |
Windows 10, x64. |
I spent a few hours on this today. It looks like on windows usb connected serialports the serial number is in the last bit of the pnp id. @thiago-sylvain that means your device drivers are reporting a serial number of |
@reconbot the A\0000 could be some kind of internal address it looks like that maybe windows uses some kind of internal addresses was facing that with cctalk devices also |
- [osx] remove the 0x from productID and locationId and vendorId - [linux] remove the starting 0x from any values, small refactor - [linux] Fixup output using the hex encoded fields - [windows] Grab the serial number from the pnp id - Isolate list functions to their own platform files (c++) - Better ensure our serialports fields are present closes #1220
Fixed serial numbers on linux and usb connected windows devices. Manufacturers are reported by windows drivers, but seem to be equal on osx and linux. Since I now pull serialnumbers from the pnpid, I think maybe it will still be different @McClellandLaboratories Can you run a test of master with your device? |
OK, so I tested four different devices: Arduino Mega Atlas Scientific EZO-RGB Probe Gearmo FTDI2-LED USB RS-232 Serial Adapter Arducam Nano V3.0 (Arduino Nano with FTDI) LinuxArduino Mega This one is perfect, all of the information is reporting to the correct fields. Atlas Scientific EZO-RGB Sensor The only thing wrong here is the productId, which should be 6015. RGB is the product description. Gearmo FTDI2-LED USB RS-232 Serial Adapter The only thing wrong here is the productId, which should be 6001. MVP4 is the product description. Arducam Nano V3.0 (Arduino Nano with FTDI) The only thing wrong here is the productId, which should be 6001. scale is the product description. Windows 10Arduino Mega This one is perfect, all of the information is reporting to the correct fields. Atlas Scientific EZO-RGB Sensor No serialNumber field is reported. The serial number for this device is DJ1XJE67. Gearmo FTDI2-LED USB RS-232 Serial Adapter No serialNumber field is reported. The serial number for this device is AL1WHZWF. Arducam Nano V3.0 (Arduino Nano with FTDI) No serialNumber field is reported. The serial number for this device is A51MAMME. Results SummaryThe Arduino Mega data is reported correctly for Linux and Windows. The FTDI devices had some issues. In Linux, the productID was reporting the product description instead of the PID numbers. In Windows, no serialNumber field was reported. However, the serialNumber is present in the pnpID. Notice the difference in formatting when comparing the Windows 10 pnpIDs: Arduino Mega Atlas Scientific EZO-RGB Sensor Gearmo FTDI2-LED USB RS-232 Serial Adapter Arducam Nano V3.0 (Arduino Nano with FTDI) The Arduino Mega is not a FTDI device, which is shown first by the 'USB\\'. The VID and PID are seperated by an '&', and the serial number is separated from the serialNumber by '\\'. In comparison, the FTDI devices are reported with a 'FTDIBUS\\'. The VID, PID, and serialNumber are seperated by '+', an 'A' is tacked on to the end of the serial number and \\0000 is added at the end. Maybe the FTDI device information on Windows would be easiest to extract from the pnpID using a regular expression that can catch both results from normal USB devices (like the Arduino Mega) and FTDI devices. |
node-serialport v5.0.0 and FTDI 230XLinux
In the Windows 10
So nothing new since beta8. Concerning the bug I reported above, still no hint on how to reproduce. |
The productId on linux issue has been fixed in #1279 The windows serialnumber... I wish I could easily test this... I guess we'll have to break it out into a testable function. Collecting all your test data; FTDI Device Arduino Mega Atlas Scientific EZO-RGB Sensor Gearmo FTDI2-LED USB RS-232 Serial Adapter Arducam Nano V3.0 (Arduino Nano with FTDI) |
This should give us more serial numbers on windows. fixes #1220
Well FTDIBUS was pretty easy to sus out, the latest master is available for you perusal. If you have any other kind of devices now's the time to break them out. =) |
### Bug Fixes * **linux:** The productID should be a number not a description string ([#1279](#1279)) ([bf46f68](bf46f68)) * **tests:** fixup for [#1279](#1279) ([#1285](#1285)) ([56074f6](56074f6)) * **windows:** Add option to disable RTS ([#1277](#1277)) ([5b8d163](5b8d163)) * **windows:** Parse more types of pnpIds ([#1288](#1288)) ([0b554d7](0b554d7)), closes [#1220](#1220) ### Chores * **binaries:** Lets switch to prebuild! ([#1282](#1282)) ([8c36e99](8c36e99)) ### Features * **test:** tone down codecov comments ([#1289](#1289)) ([749ffac](749ffac)) ### BREAKING CHANGES * **binaries:** I'm considering the switch to `prebuild` a breaking change because it's substantially changes our install processes. It's also possible the install flags to ensure downloading or building from source has changed slightly. That's not our api per say, but it's enough. * **windows:** We previously hard coded to have RTS on for windows at all times it now default to off.
Awesome job on the update! I have tried all of the devices I have, and everything looks great. Both Linux and Windows report the same "serialNumber". One question somewhat unrelated to this issue, but why does the serialport-list in Linux show a bunch of blank com ports (as shown below): {"manufacturer":"Arduino (www.arduino.cc)","serialNumber":"9563533373035191F0D2","pnpId":"usb-Arduino__www.arduino.cc__0042_9563533373035191F0D2-if00","vendorId":"2341","productId":"0042","comName":"/dev/ttyACM0"} |
Yay! Because linux doesn't differentiate between tty's and serialports in general. Do you know a way? |
I wonder if filtering just based on the presence of a VID or product PID would work. Note in the above list the: {"vendorId":"8086","productId":"a127","comName":"/dev/ttyS4"} represents a USB hub I suppose another option would be to add a flag to serialport-list like -vidReq. Command: Output: Anyways these are just thoughts. |
I'm not sure how to confirm this will always be the case but I'm up for filtering it in our api. I wonder what python or tcl does... |
- [osx] remove the 0x from productID and locationId and vendorId - [linux] remove the starting 0x from any values, small refactor - [linux] Fixup output using the hex encoded fields - [windows] Grab the serial number from the pnp id - Isolate list functions to their own platform files (c++) - Better ensure our serialports fields are present closes #1220
This should give us more serial numbers on windows. fixes #1220
SerialPort Version: 4.07
NodeJS Version: 7.1
Operating System and Hardware Platform: Windows 10 and Ubuntu 16.04
Have you checked the right version of the api docs?: Yes
Are you having trouble installing and you checked the Installation Special Cases docs? No
Are you using Electron and have you checked the Electron Docs?: No
Summary of Problem
FTDI device serial numbers are missing and manufacturers are incorrect on Windows 10.
Steps and Code to Reproduce the Issue
Using Windows 10, plug in a FTDI USB device. Next, assign it a unique USB device descriptor using FT_Prog. After programming the FTDI device with the new USB device descriptors, run serialport-list -f jsonline, resulting in output similar to the following:
Using Ubuntu 16.04, plug in the same FTDI devices. Run serialport-list -f jsonline, resulting in output similar to the following:
Why are the manufacturers listed differently between the two operating systems. Why doesn't windows see the serialNumber? Is there any way to fix this.
The text was updated successfully, but these errors were encountered: