]> sigrok.org Git - libserialport.git/blobdiff - libserialport.h.in
Fix a potential segfault in sp_get_port_handle().
[libserialport.git] / libserialport.h.in
index 49697a941cdb1f19298c8c8cdd0094180974786a..c37c1cacc24d8e8f9735367b12c7da7665cf7f8e 100644 (file)
@@ -415,7 +415,7 @@ char *sp_get_port_name(const struct sp_port *port);
  *
  * @since 0.1.1
  */
-char *sp_get_port_description(struct sp_port *port);
+char *sp_get_port_description(const struct sp_port *port);
 
 /**
  * Get the transport type used by a port.
@@ -426,7 +426,7 @@ char *sp_get_port_description(struct sp_port *port);
  *
  * @since 0.1.1
  */
-enum sp_transport sp_get_port_transport(struct sp_port *port);
+enum sp_transport sp_get_port_transport(const struct sp_port *port);
 
 /**
  * Get the USB bus number and address on bus of a USB serial adapter port.
@@ -446,8 +446,10 @@ enum sp_return sp_get_port_usb_bus_address(const struct sp_port *port,
  * Get the USB Vendor ID and Product ID of a USB serial adapter port.
  *
  * @param[in] port Pointer to a port structure. Must not be NULL.
- * @param[out] usb_vid Pointer to a variable to store the USB VID. Must not be NULL.
- * @param[out] usb_pid Pointer to a variable to store the USB PID. Must not be NULL.
+ * @param[out] usb_vid Pointer to a variable to store the USB VID.
+ *                     Can be NULL (in that case it will be ignored).
+ * @param[out] usb_pid Pointer to a variable to store the USB PID.
+ *                     Can be NULL (in that case it will be ignored).
  *
  * @return SP_OK upon success, a negative error code otherwise.
  *
@@ -1026,7 +1028,7 @@ enum sp_return sp_set_flowcontrol(struct sp_port *port, enum sp_flowcontrol flow
  * @param[in] port Pointer to a port structure. Must not be NULL.
  * @param[out] buf Buffer in which to store the bytes read. Must not be NULL.
  * @param[in] count Requested number of bytes to read.
- * @param[in] timeout Timeout in milliseconds, or zero to wait indefinitely.
+ * @param[in] timeout_ms Timeout in milliseconds, or zero to wait indefinitely.
  *
  * @return The number of bytes read on success, or a negative error code. If
  *         the number of bytes returned is less than that requested, the
@@ -1036,7 +1038,7 @@ enum sp_return sp_set_flowcontrol(struct sp_port *port, enum sp_flowcontrol flow
  *
  * @since 0.1.0
  */
-enum sp_return sp_blocking_read(struct sp_port *port, void *buf, size_t count, unsigned int timeout);
+enum sp_return sp_blocking_read(struct sp_port *port, void *buf, size_t count, unsigned int timeout_ms);
 
 /**
  * Read bytes from the specified serial port, without blocking.
@@ -1075,7 +1077,7 @@ enum sp_return sp_nonblocking_read(struct sp_port *port, void *buf, size_t count
  * @param[in] port Pointer to a port structure. Must not be NULL.
  * @param[in] buf Buffer containing the bytes to write. Must not be NULL.
  * @param[in] count Requested number of bytes to write.
- * @param[in] timeout Timeout in milliseconds, or zero to wait indefinitely.
+ * @param[in] timeout_ms Timeout in milliseconds, or zero to wait indefinitely.
  *
  * @return The number of bytes written on success, or a negative error code.
  *         If the number of bytes returned is less than that requested, the
@@ -1087,7 +1089,7 @@ enum sp_return sp_nonblocking_read(struct sp_port *port, void *buf, size_t count
  *
  * @since 0.1.0
  */
-enum sp_return sp_blocking_write(struct sp_port *port, const void *buf, size_t count, unsigned int timeout);
+enum sp_return sp_blocking_write(struct sp_port *port, const void *buf, size_t count, unsigned int timeout_ms);
 
 /**
  * Write bytes to the specified serial port, without blocking.
@@ -1214,13 +1216,13 @@ enum sp_return sp_add_port_events(struct sp_event_set *event_set,
  * Wait for any of a set of events to occur.
  *
  * @param[in] event_set Event set to wait on. Must not be NULL.
- * @param[in] timeout Timeout in milliseconds, or zero to wait indefinitely.
+ * @param[in] timeout_ms Timeout in milliseconds, or zero to wait indefinitely.
  *
  * @return SP_OK upon success, a negative error code otherwise.
  *
  * @since 0.1.0
  */
-enum sp_return sp_wait(struct sp_event_set *event_set, unsigned int timeout);
+enum sp_return sp_wait(struct sp_event_set *event_set, unsigned int timeout_ms);
 
 /**
  * Free a structure allocated by sp_new_event_set().