X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=README;h=50cb7b2e730522f8f3ce0d62e8384328d3a6f0cc;hb=e3b2f7a4e3c1315d51d6a91eec7dde44ec0a623b;hp=e0ace9787d3077d168d0ccd12fbe698b1f355e45;hpb=e9a2f9c9d35624148b4715e80c2dc2ac0387ee6b;p=libserialport.git diff --git a/README b/README index e0ace97..50cb7b2 100644 --- a/README +++ b/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.