Description Usage Value Windows Linux and MacOS
This function lists all installed serial interfaces in a computer. Thereby Windows, Linux and MacOs behave different. Please ensure that you have the appropriate permissions to do a search in the registry or in the corresponding linux folders.
1 |
A character vector with the list of comports is returned.
In a Windows environment, this function tries to read out the registry keys located in:
"HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM"
This should be consistent with all installed hardware ports plus all virtual ports.
Here the situation is different, compared to Windows. All possible serial
devices are located in "/dev/tty[...]"
as a file connection. Still, all
virtual and closed dev's can be found here. This is confusing, because one will
find more devices in this folder than physically (virtual) present.
In addition to that, Ubuntu linux systems do list the plug and play devices
of interest in "/sys/devices/pnp0/...
" again. That is the reason why,
the function returns a subset of "/dev/tty[...]"
, which is also present in the
"../pnp0/.."
folder.
On MacOs the installed interfaces are marked by "tty.<name>
" or "cu.<name>
", with a unique
name after the dot, which makes it easier to search for installed devices.
Here a tty
device is a modem which waits for a DCD (Data Carrier Detect)
signal to receive data. The device is blocked as long such a signal is
not detected. The corresponding cu
device manages the out going communication
for historical reasons. However a cu
port is not blocked and should be used
in favour on MacOS.
Subsequently, the user must know which interface is present and which isn't. AND the user must have at least reading permissions in the corresponding folders. So in the end, this function is a best guess of what is installed.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.