Getting a list of ports present on the system.
Getting a list of ports present on the system.
#include <stdio.h>
int main(int argc, char **argv)
{
printf("Getting port list.\n");
printf("sp_list_ports() failed!\n");
return -1;
}
int i;
for (i = 0; port_list[i] != NULL; i++) {
struct sp_port *port = port_list[i];
printf("Found port: %s\n", port_name);
}
printf("Found %d ports.\n", i);
printf("Freeing port list.\n");
return 0;
}
@ SP_OK
Operation completed successfully.
enum sp_return sp_list_ports(struct sp_port ***list_ptr)
List the serial ports available on the system.
void sp_free_port_list(struct sp_port **ports)
Free a port list obtained from sp_list_ports().
char * sp_get_port_name(const struct sp_port *port)
Get the name of a port.
An opaque structure representing a serial port.