Feature #26
list available com ports
| Status: | New | Start: | 2008-04-20 | |
| Priority: | Normal | Due date: | ||
| Assigned to: | - | % Done: | 0% |
|
| Category: | - | |||
| Target version: | 0.3 | |||
Description
it should be possible to request a list of available serial ports, including some current status for each one
History
2008-04-21 19:52 - Hamish Coleman
Look at http://msdn2.microsoft.com/en-us/library/ms535797.aspx
also, this example code: http://www.lookrs232.com/com_port_programming/api_enumports.htm
2008-04-23 16:53 - Hamish Coleman
I have done some research and this appears to be more difficult than it should be.
* PORT_INFO_2 doesn't provide much information (http://msdn2.microsoft.com/en-us/library/ms535509(VS.85).aspx)nrports=12 Port Monitor Desc Type Reserved Microsoft Document Imaging Writer Port: Local Monitor Local Port 1 0 COM1: Local Monitor Local Port 1 0 COM2: Local Monitor Local Port 1 0 COM3: Local Monitor Local Port 1 0 COM4: Local Monitor Local Port 1 0 FILE: Local Monitor Local Port 1 0 LPT1: Local Monitor Local Port 1 0 LPT2: Local Monitor Local Port 1 0 LPT3: Local Monitor Local Port 1 0 COM5: Local Monitor Local Port 1 0 COM6: Local Monitor Local Port 1 0 IcePortER: Ice Monitor E Black Ice Port 1 0* SetupDiEnumDeviceInterfaces (http://forum.sysinternals.com/forum_posts.asp?TID=4544 and http://msdn2.microsoft.com/en-us/library/ms793116.aspx) doesnt find enough interfaces:
DevicePath=\\?\acpi#pnp0501!#1#{4d36e978-e325-11ce-bfc1-08002be10318}
DevicePath=\\?\acpi#pnp0501!#2#{4d36e978-e325-11ce-bfc1-08002be10318}
* There is an entire library for doing this (http://www.naughter.com/enumser.html) that checks seven different methods for com ports, but its licence may be incompatible with GPL