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

This commit is contained in:
Dan Williams
2018-10-16 17:09:21 +00:00
parent 329caff84f
commit e5f65d1b27
+9
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;