]> sigrok.org Git - libserialport.git/blobdiff - serialport.h
Add sp_free_port() function.
[libserialport.git] / serialport.h
index dafe99bfbcf4eb447f9a3bb8c9851a929d15e43d..ac583e9431772094e928e29278ae8989f6b7c35d 100644 (file)
@@ -41,10 +41,12 @@ struct sp_port {
 enum {
        /* Operation completed successfully. */
        SP_OK = 0,
-       /* A system error occured while executing the operation. */
-       SP_ERR_FAIL = -1,
        /* Invalid arguments were passed to the function. */
-       SP_ERR_ARG = -2
+       SP_ERR_ARG = -1,
+       /* A system error occured while executing the operation. */
+       SP_ERR_FAIL = -2,
+       /* A memory allocation failed while executing the operation. */
+       SP_ERR_MEM = -3
 };
 
 /* Port access modes. */
@@ -77,9 +79,11 @@ enum {
        SP_FLOW_SOFTWARE = 2
 };
 
-char **sp_list_ports(void);
-void sp_free_port_list(char **ports);
-int sp_open(struct sp_port *port, char *portname, int flags);
+int sp_get_port_by_name(const char *portname, struct sp_port **port_ptr);
+void sp_free_port(struct sp_port *port);
+int sp_list_ports(struct sp_port ***list_ptr);
+void sp_free_port_list(struct sp_port **ports);
+int sp_open(struct sp_port *port, int flags);
 int sp_close(struct sp_port *port);
 int sp_flush(struct sp_port *port);
 int sp_write(struct sp_port *port, const void *buf, size_t count);