]> sigrok.org Git - libserialport.git/blobdiff - libserialport.h.in
windows: Always check return value of GetOverlappedResult().
[libserialport.git] / libserialport.h.in
index 43d7ee7e40ab8a2a6d1c2ca7b0436e0641eccbe0..9c6842ab7f079f1ed769269e0f259b21326f34f6 100644 (file)
@@ -432,8 +432,10 @@ 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.
  *
  * @param[in] port Pointer to a port structure. Must not be NULL.
- * @param[out] usb_bus Pointer to a variable to store the USB bus. Must not be NULL.
- * @param[out] usb_address Pointer to a variable to store the USB address. Must not be NULL.
+ * @param[out] usb_bus Pointer to a variable to store the USB bus.
+ *                     Can be NULL (in that case it will be ignored).
+ * @param[out] usb_address Pointer to a variable to store the USB address.
+ *                         Can be NULL (in that case it will be ignored).
  *
  * @return SP_OK upon success, a negative error code otherwise.
  *
@@ -446,8 +448,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.
  *
@@ -529,8 +533,9 @@ char *sp_get_port_bluetooth_address(const struct sp_port *port);
  *
  * @param[in] port Pointer to a port structure. Must not be NULL.
  * @param[out] result_ptr If any error is returned, the variable pointed to by
- *                        result_ptr will be set to NULL. Otherwise, it will
- *                        be set to point to the OS handle. Must not be NULL.
+ *                        result_ptr will have unknown contents and should not
+ *                        be used. Otherwise, it will be set to point to the
+ *                        OS handle. Must not be NULL.
  *
  * @return SP_OK upon success, a negative error code otherwise.
  *
@@ -550,17 +555,19 @@ enum sp_return sp_get_port_handle(const struct sp_port *port, void *result_ptr);
 /**
  * Allocate a port configuration structure.
  *
- * The user should allocate a variable of type "struct sp_config *" and pass a
- * pointer to this to receive the result. The variable will be updated to
- * point to the new configuration structure. The structure is opaque and must
- * be accessed via the functions provided.
+ * The user should allocate a variable of type "struct sp_port_config *" and
+ * pass a pointer to this to receive the result. The variable will be updated
+ * to point to the new configuration structure. The structure is opaque and
+ * must be accessed via the functions provided.
  *
  * All parameters in the structure will be initialised to special values which
  * are ignored by sp_set_config().
  *
  * The structure should be freed after use by calling sp_free_config().
  *
- * @param[out] config_ptr Pointer to a variable to receive the result.
+ * @param[out] config_ptr If any error is returned, the variable pointed to by
+ *                        config_ptr will be set to NULL. Otherwise, it will
+ *                        be set to point to the allocated config structure.
  *                        Must not be NULL.
  *
  * @return SP_OK upon success, a negative error code otherwise.
@@ -591,7 +598,8 @@ void sp_free_config(struct sp_port_config *config);
  *
  * @param[in] port Pointer to a port structure. Must not be NULL.
  * @param[out] config Pointer to a configuration structure that will hold
- *                    the result. Must not be NULL.
+ *                    the result. Upon errors the contents of the config
+ *                    struct will not be changed. Must not be NULL.
  *
  * @return SP_OK upon success, a negative error code otherwise.
  *
@@ -606,6 +614,9 @@ enum sp_return sp_get_config(struct sp_port *port, struct sp_port_config *config
  * -1, but see the documentation for each field). These values will be ignored
  * and the corresponding setting left unchanged on the port.
  *
+ * Upon errors, the configuration of the serial port is unknown since
+ * partial/incomplete config updates may have happened.
+ *
  * @param[in] port Pointer to a port structure. Must not be NULL.
  * @param[in] config Pointer to a configuration structure. Must not be NULL.
  *