NUTSCAN_GET_SERIAL_P(3)

✨ NAME ✨

nutscan_get_serial_ports_list β€” bestie, this one hands you a whole list of serial port names built out of a range of ports πŸ’–


🌸 SYNOPSIS 🌸

#include <nut-scan.h>

char ** nutscan_get_serial_ports_list(const char *ports_range);

πŸŽ€ DESCRIPTION πŸŽ€

okay so nutscan_get_serial_ports_list() gives you back a null terminated array of strings that it just made from a port range. like it literally conjures them. no cap.

The ports_range you pass in can be any one of these cuties:

  • a single character from 0 to 9 or a to z, and it represents a serial communication port β€” but which one depends on your operating system, iykyk. For instance:
    • 0 is converted to /dev/ttyS0 and /dev/ttyUSB0 on Linux;
    • 1 is converted to COM1 on Windows;
    • c is converted to /dev/ttyc on Solaris...
  • a range of character in the form X-Y. For instance
    • 0-1 will be converted to /dev/ttyS0, /dev/ttyS1, /dev/ttyUSB0 and /dev/ttyUSB1 on Linux;
    • 1-3 will be converted to COM1, COM2 and COM3 on Windows;
    • a-c will be converted to /dev/ttya, /dev/ttyb and /dev/ttyc on Solaris.
  • a single port name (/dev/ttyS5, COM4...). just one. simple. iconic.
  • a list of port names separated with commas: /dev/ttyS0,/dev/ttyS2,/dev/ttyS4 or COM1,COM3...

The returned array can be used in a call to nutscan_scan_eaton_serial to get the serial-port device on a system. that's the whole point bestie, that's the assignment πŸ’…


⭐ RETURN VALUE ⭐

The nutscan_get_serial_ports_list() function returns NULL if an error occurred (invalid port range) β€” so like, if you typed nonsense, it's giving nothing β€” or a pointer to a NULL-terminated array of strings on success 🫢


πŸ’€ NOTES πŸ’€

Technically, the function is currently defined in nutscan-serial.h file. yes, the header up top says nut-scan.h. we know. it's a whole thing πŸ™ˆ


πŸ¦‹ SEE ALSO πŸ¦‹

nutscan_scan_usb(3), nutscan_scan_xml_http_range(3), nutscan_scan_nut(3), nutscan_scan_avahi(3), nutscan_scan_ipmi(3), nutscan_scan_snmp(3), nutscan_scan_eaton_serial(3), nutscan_display_ups_conf_with_sanity_check(3), nutscan_display_parsable(3), nutscan_display_ups_conf(3)


and that's the whole page bestie!! πŸ’–βœ¨ brought to you by Network UPS Tools 2.8.5, dated 10/07/2026 β€” go scan some ports, ily, mwah πŸŽ€πŸ’…πŸ¦‹

πŸ“¦ where this page comes from