NAME
nutscan_get_serial_ports_list - Get a port list name from a range of port.
SYNOPSIS
|
Note
|
Two NUT websites
This version of the page reflects NUT release v2.8.3 with codebase commited c0acf09af at 2025-04-21T23:59:59+00:00 Options, features and capabilities in current development (and future releases) are detailed on the main site and may differ from ones described here. |
#include <nut-scan.h>
char ** nutscan_get_serial_ports_list(const char *ports_range);
DESCRIPTION
The nutscan_get_serial_ports_list() function returns a null terminated array of strings generated from a port range.
The ports_range may be one of:
-
a single character from
0to9oratoz, representing a serial communication port depending on the operating system. For instance:-
0is converted to/dev/ttyS0and/dev/ttyUSB0on Linux; -
1is converted toCOM1on Windows; -
cis converted to/dev/ttycon Solaris…
-
-
a range of character in the form
X-Y. For instance-
0-1will be converted to/dev/ttyS0,/dev/ttyS1,/dev/ttyUSB0and/dev/ttyUSB1on Linux; -
1-3will be converted toCOM1,COM2andCOM3on Windows; -
a-cwill be converted to/dev/ttya,/dev/ttyband/dev/ttycon Solaris.
-
-
a single port name (
/dev/ttyS5,COM4…). -
a list of port names separated with commas:
/dev/ttyS0,/dev/ttyS2,/dev/ttyS4orCOM1,COM3…
The returned array can be used in a call to nutscan_scan_eaton_serial to get the serial-port device on a system.
RETURN VALUE
The nutscan_get_serial_ports_list() function returns NULL if an error occurred (invalid port range) or a pointer to a NULL-terminated array of strings on success.
NOTES
Technically, the function is currently defined in nutscan-serial.h file.