Add std_serial_dev_close() function.

This commit is contained in:
Martin Ling 2013-12-07 18:41:09 +00:00
parent 7faa3e8821
commit 043e899a51
2 changed files with 14 additions and 0 deletions

View File

@ -190,6 +190,7 @@ SR_PRIV int std_session_send_df_header(const struct sr_dev_inst *sdi,
const char *prefix);
SR_PRIV int std_dev_clear(const struct sr_dev_driver *driver,
std_dev_clear_t clear_private);
SR_PRIV int std_serial_dev_close(struct sr_dev_inst *sdi);
/*--- strutil.c -------------------------------------------------------------*/

13
std.c
View File

@ -230,3 +230,16 @@ SR_PRIV int std_dev_clear(const struct sr_dev_driver *driver,
return ret;
}
SR_PRIV int std_serial_close(struct sr_dev_inst *sdi)
{
struct sr_serial_dev_inst *serial;
serial = sdi->conn;
if (serial && serial->fd != -1) {
serial_close(serial);
sdi->status = SR_ST_INACTIVE;
}
return SR_OK;
}