How to find out what instruments is behind a FTDI adapter on Windows?

泪湿孤枕 提交于 2021-01-28 23:55:31

问题


I am currently developing a Python tool for Windows that is able to lookup all devices connected to a windows pc. It already supports ethernet devices and by now I'm trying to add support for USB and serial devices. For those devices I want to read out their vendor id, product id, serial number and of course the address/port which is needed to connect to the device.

Simple USB devices can be easily detected with PyUSB or PyWin32. Unfortunately, many devices say that its vendor is FTDI, which is not the case. As far as I know, FTDI just provides the USB adapter/converter.

So, how can I lookup the device behind the FTDI adapter? I already tried PyUSB, PyWin32 and PySerial, but all of them just say, that there is a FTDI-device connected; but I want to know the actual device behind the FTDI adapter... Is there a way to find that out?

I hope that you can help me... Thank you for that in advance.

Update

Since there seems to be no universal solution, is there at least a way to uniquely identify one of those FTDI devices? Some of them provide serial numbers, but unfortunately not all of them. For example there are devices, with a device id like "USB\VID_0403&PID_FAF0\7&5E2426C&0&2", where "7&5E2426C&0&2" should be the serial number. But these serial numbers with ampersands in it are not the real serial numbers (maybe it is something from Windows or so). PySerial even recognizes this serial number only as "7".

If I had at least the possibility to get the real serial number of that device, this would be very helpful. So I could uniquely identify that device, even if it got a new port or device id after disconnecting and reconnecting. Or are those ampersand-serials always the same for one device?


回答1:


When a FTDI Serial to USB converter is used you usually get a virtual com port that is recognized as PlugAndPlay device by windows. A small internal electronic circuit board is placed in the USB-Plug of an FTDI cable which performs the conversion from serial UART interface to USB.

When you now request the information about the connected device you get the information of the connected PlugAndPlay device, the FTDI cable board, not the information of the device behind this cable. E.g. when a Card Reader is connected using such a cable you get the serial number of the FTDI Cable board not the serial number of the Card Reader.

But it is possible that usefull information can be retrieved. There is a program from FTDI, called FT_Prog, which allows to programm the EEPROM board in the cable. Using this tool it is possible to change some of the information you can retrieve from the FTDI cable as shown in the image below.

This is sometimes done but not mandatory for device manufacturers. And when it is done there is no standardized scheme of what to put into these fields. You would need your own dictionary of known device identifiers to handle that.

Another way is to get information directly from the device behind the cable. But in this case you need to know the communication protocol to be able to talk to the device. If proprietary protocols are used, your only chance is to use sniffer hardware to reverse engineer the protocol but that may be a bit to extreme^^




回答2:


Af far as company using FTDI is not interested in buying own vendor ID you are out of luck. There is no standard protocol behind FTDI so no universal way to detect device behind it.




回答3:


USB specification allows (not requires) device to provide string descriptor containing serial number - or better it could be any string.

Fortunately FTDIs provides unique serial numbers. See this thread Get Serial Number of USB device with Python 3




回答4:


FTDI is typically allow the use of an EEPROM (actually it is in most cases a simple flash memory) to store specific information about the product in it. E.g. one can assign a specific vendorID, ProductID, SerialNo, Manufacturer Desc., Product Desc. BUT it is only optional (For details search for FT_Prog). So every product designer has the freedom, but does not need to fill in whatever he/she wants. If you have a set of devices you want to support you could check if the either support a SCPI compliant interface. In this case you can ask them using *IDN? about their identity. If not you can hope that the product has properly written ROM to supply further information. In any other case you can only guess.



来源:https://stackoverflow.com/questions/61245593/how-to-find-out-what-instruments-is-behind-a-ftdi-adapter-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!