Make sure the device is enabled before trying to send commands to it.
This commit is contained in:
@@ -280,6 +280,12 @@ mm_serial_send_command (MMSerial *self,
|
|||||||
const char *s;
|
const char *s;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
if (priv->fd == 0) {
|
||||||
|
g_set_error (error, MM_SERIAL_ERROR, MM_SERIAL_SEND_FAILED,
|
||||||
|
"%s", "Sending command failed: device is not enabled");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (mm_serial_is_connected (self)) {
|
if (mm_serial_is_connected (self)) {
|
||||||
g_set_error (error, MM_SERIAL_ERROR, MM_SERIAL_SEND_FAILED,
|
g_set_error (error, MM_SERIAL_ERROR, MM_SERIAL_SEND_FAILED,
|
||||||
"%s", "Sending command failed: device is connected");
|
"%s", "Sending command failed: device is connected");
|
||||||
|
Reference in New Issue
Block a user