mirror of
git://sigrok.org/libserialport
synced 2023-08-10 21:13:24 +03:00
Identify ports by sp_port structure, not name.
This commit is contained in:
18
README
18
README
@ -61,9 +61,8 @@ API
|
||||
The API is simple, and designed to be a minimal wrapper around the serial port
|
||||
support in each OS.
|
||||
|
||||
Most functions take a pointer to a struct sp_port, which represents an open
|
||||
port. This structure should be allocated by the user and is populated by
|
||||
sp_open(). It can be freed safely after sp_close().
|
||||
Most functions take a pointer to a struct sp_port, which represents an serial
|
||||
port. This structure is obtained from the array returned by sp_list_ports().
|
||||
|
||||
All functions can return only three possible error values. SP_ERR_ARG indicates
|
||||
the function was called with invalid arguments. SP_ERR_FAIL indicates that the
|
||||
@ -83,27 +82,26 @@ The available functions are as follows:
|
||||
Enumeration
|
||||
-----------
|
||||
|
||||
char **sp_list_ports();
|
||||
struct sp_port **sp_list_ports();
|
||||
|
||||
Lists the serial ports available on the system. The value returned is an array
|
||||
of port names as C strings, terminated by a NULL. It should be freed after use
|
||||
by calling sp_free_port_list().
|
||||
of pointers to sp_port structures, terminated by a NULL. It should be freed after
|
||||
use by calling sp_free_port_list().
|
||||
|
||||
void sp_free_port_list(char **list);
|
||||
void sp_free_port_list(struct sp_port **list);
|
||||
|
||||
Frees the data structure returned by sp_list_ports().
|
||||
|
||||
Opening and closing ports
|
||||
-------------------------
|
||||
|
||||
int sp_open(struct sp_port *port, char *portname, int flags);
|
||||
int sp_open(struct sp_port *port, int flags);
|
||||
|
||||
Opens the specified serial port.
|
||||
|
||||
Parameters:
|
||||
|
||||
port: Pointer to empty port structure, allocated by caller.
|
||||
portname: Name of port to open.
|
||||
port: Pointer to port structure.
|
||||
flags: Flags to use when opening the serial port. Possible
|
||||
flags are: SP_MODE_RDWR, SP_MODE_RDONLY, and SP_MODE_NONBLOCK.
|
||||
|
||||
|
Reference in New Issue
Block a user