port-serial: don't allow opens when a port is connected

This commit is contained in:
Dan Williams
2017-04-17 00:19:09 -05:00
parent 329caff84f
commit e5f65d1b27

View File

@@ -1175,6 +1175,15 @@ mm_port_serial_open (MMPortSerial *self, GError **error)
return FALSE;
}
if (mm_port_get_connected (MM_PORT (self))) {
g_set_error (error,
MM_SERIAL_ERROR,
MM_SERIAL_ERROR_OPEN_FAILED,
"Could not open serial device %s: port is connected",
device);
return FALSE;
}
if (self->priv->open_count) {
/* Already open */
goto success;