core: fix serial error #defines
Should have ERROR in them.
This commit is contained in:
@@ -300,7 +300,7 @@ hso_connect_timed_out (gpointer data)
|
||||
|
||||
if (info) {
|
||||
info->error = g_error_new_literal (MM_SERIAL_ERROR,
|
||||
MM_SERIAL_RESPONSE_TIMEOUT,
|
||||
MM_SERIAL_ERROR_RESPONSE_TIMEOUT,
|
||||
"Connection timed out");
|
||||
}
|
||||
|
||||
|
@@ -405,11 +405,9 @@ mbm_emrdy_done (MMAtSerialPort *port,
|
||||
MMCallbackInfo *info = user_data;
|
||||
MMModemMbmPrivate *priv = MM_MODEM_MBM_GET_PRIVATE (info->modem);
|
||||
|
||||
if ( error
|
||||
&& error->domain == MM_SERIAL_ERROR
|
||||
&& error->code == MM_SERIAL_RESPONSE_TIMEOUT) {
|
||||
if (g_error_matches (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_RESPONSE_TIMEOUT))
|
||||
g_warning ("%s: timed out waiting for EMRDY response.", __func__);
|
||||
} else
|
||||
else
|
||||
priv->have_emrdy = TRUE;
|
||||
|
||||
do_init (port, info);
|
||||
|
@@ -371,7 +371,7 @@ pre_init_done (MMAtSerialPort *port,
|
||||
if (error) {
|
||||
/* Retry the init string one more time; the modem sometimes throws it away */
|
||||
if ( !priv->init_retried
|
||||
&& g_error_matches (error, MM_SERIAL_ERROR, MM_SERIAL_RESPONSE_TIMEOUT)) {
|
||||
&& g_error_matches (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_RESPONSE_TIMEOUT)) {
|
||||
priv->init_retried = TRUE;
|
||||
enable_flash_done (MM_SERIAL_PORT (port), NULL, user_data);
|
||||
} else
|
||||
|
@@ -39,11 +39,11 @@ mm_serial_error_get_type (void)
|
||||
|
||||
if (etype == 0) {
|
||||
static const GEnumValue values[] = {
|
||||
ENUM_ENTRY (MM_SERIAL_OPEN_FAILED, "SerialOpenFailed"),
|
||||
ENUM_ENTRY (MM_SERIAL_SEND_FAILED, "SerialSendfailed"),
|
||||
ENUM_ENTRY (MM_SERIAL_RESPONSE_TIMEOUT, "SerialResponseTimeout"),
|
||||
ENUM_ENTRY (MM_SERIAL_OPEN_FAILED_NO_DEVICE, "SerialOpenFailedNoDevice"),
|
||||
ENUM_ENTRY (MM_SERIAL_ERROR_FLASH_FAILED, "SerialFlashFailed"),
|
||||
ENUM_ENTRY (MM_SERIAL_ERROR_OPEN_FAILED, "SerialOpenFailed"),
|
||||
ENUM_ENTRY (MM_SERIAL_ERROR_SEND_FAILED, "SerialSendfailed"),
|
||||
ENUM_ENTRY (MM_SERIAL_ERROR_RESPONSE_TIMEOUT, "SerialResponseTimeout"),
|
||||
ENUM_ENTRY (MM_SERIAL_ERROR_OPEN_FAILED_NO_DEVICE, "SerialOpenFailedNoDevice"),
|
||||
ENUM_ENTRY (MM_SERIAL_ERROR_FLASH_FAILED, "SerialFlashFailed"),
|
||||
{ 0, 0, 0 }
|
||||
};
|
||||
|
||||
|
@@ -20,10 +20,10 @@
|
||||
#include <glib-object.h>
|
||||
|
||||
enum {
|
||||
MM_SERIAL_OPEN_FAILED = 0,
|
||||
MM_SERIAL_SEND_FAILED = 1,
|
||||
MM_SERIAL_RESPONSE_TIMEOUT = 2,
|
||||
MM_SERIAL_OPEN_FAILED_NO_DEVICE = 3,
|
||||
MM_SERIAL_ERROR_OPEN_FAILED = 0,
|
||||
MM_SERIAL_ERROR_SEND_FAILED = 1,
|
||||
MM_SERIAL_ERROR_RESPONSE_TIMEOUT = 2,
|
||||
MM_SERIAL_ERROR_OPEN_FAILED_NO_DEVICE = 3,
|
||||
MM_SERIAL_ERROR_FLASH_FAILED = 4,
|
||||
};
|
||||
|
||||
|
@@ -574,7 +574,7 @@ real_handle_probe_response (MMPluginBase *self,
|
||||
ignore_error = TRUE;
|
||||
|
||||
if (error && !ignore_error) {
|
||||
if (g_error_matches (error, MM_SERIAL_ERROR, MM_SERIAL_RESPONSE_TIMEOUT)) {
|
||||
if (g_error_matches (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_RESPONSE_TIMEOUT)) {
|
||||
/* Try GCAP again */
|
||||
if (task_priv->probe_state < PROBE_STATE_GCAP_TRY3) {
|
||||
task_priv->probe_state++;
|
||||
@@ -734,7 +734,7 @@ custom_init_response (MMAtSerialPort *port,
|
||||
return;
|
||||
} else if (task_priv->custom_init_fail_if_timeout) {
|
||||
/* Fail the probe if the plugin wanted it and the command timed out */
|
||||
if (g_error_matches (error, MM_SERIAL_ERROR, MM_SERIAL_RESPONSE_TIMEOUT)) {
|
||||
if (g_error_matches (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_RESPONSE_TIMEOUT)) {
|
||||
probe_complete (task);
|
||||
return;
|
||||
}
|
||||
@@ -784,7 +784,7 @@ try_open (gpointer user_data)
|
||||
probe_complete (task);
|
||||
} else if (g_error_matches (error,
|
||||
MM_SERIAL_ERROR,
|
||||
MM_SERIAL_OPEN_FAILED_NO_DEVICE)) {
|
||||
MM_SERIAL_ERROR_OPEN_FAILED_NO_DEVICE)) {
|
||||
/* this is nozomi being dumb; try again */
|
||||
task_priv->open_id = g_timeout_add_seconds (1, try_open, task);
|
||||
} else {
|
||||
|
@@ -362,13 +362,13 @@ mm_serial_port_send_command (MMSerialPort *self,
|
||||
const guint8 *p;
|
||||
|
||||
if (priv->fd < 0) {
|
||||
g_set_error (error, MM_SERIAL_ERROR, MM_SERIAL_SEND_FAILED,
|
||||
g_set_error (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_SEND_FAILED,
|
||||
"%s", "Sending command failed: device is not enabled");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (mm_port_get_connected (MM_PORT (self))) {
|
||||
g_set_error (error, MM_SERIAL_ERROR, MM_SERIAL_SEND_FAILED,
|
||||
g_set_error (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_SEND_FAILED,
|
||||
"%s", "Sending command failed: device is connected");
|
||||
return FALSE;
|
||||
}
|
||||
@@ -386,12 +386,12 @@ mm_serial_port_send_command (MMSerialPort *self,
|
||||
if (errno == EAGAIN) {
|
||||
eagain_count--;
|
||||
if (eagain_count <= 0) {
|
||||
g_set_error (error, MM_SERIAL_ERROR, MM_SERIAL_SEND_FAILED,
|
||||
g_set_error (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_SEND_FAILED,
|
||||
"Sending command failed: '%s'", strerror (errno));
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
g_set_error (error, MM_SERIAL_ERROR, MM_SERIAL_SEND_FAILED,
|
||||
g_set_error (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_SEND_FAILED,
|
||||
"Sending command failed: '%s'", strerror (errno));
|
||||
break;
|
||||
}
|
||||
@@ -526,7 +526,7 @@ mm_serial_port_timed_out (gpointer data)
|
||||
priv->timeout_id = 0;
|
||||
|
||||
error = g_error_new_literal (MM_SERIAL_ERROR,
|
||||
MM_SERIAL_RESPONSE_TIMEOUT,
|
||||
MM_SERIAL_ERROR_RESPONSE_TIMEOUT,
|
||||
"Serial command timed out");
|
||||
/* FIXME: This is not completely correct - if the response finally arrives and there's
|
||||
some other command waiting for response right now, the other command will
|
||||
@@ -708,13 +708,13 @@ mm_serial_port_open (MMSerialPort *self, GError **error)
|
||||
*/
|
||||
g_set_error (error,
|
||||
MM_SERIAL_ERROR,
|
||||
(errno == ENODEV) ? MM_SERIAL_OPEN_FAILED_NO_DEVICE : MM_SERIAL_OPEN_FAILED,
|
||||
(errno == ENODEV) ? MM_SERIAL_ERROR_OPEN_FAILED_NO_DEVICE : MM_SERIAL_ERROR_OPEN_FAILED,
|
||||
"Could not open serial device %s: %s", device, strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (ioctl (priv->fd, TIOCEXCL) < 0) {
|
||||
g_set_error (error, MM_SERIAL_ERROR, MM_SERIAL_OPEN_FAILED,
|
||||
g_set_error (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_OPEN_FAILED,
|
||||
"Could not lock serial device %s: %s", device, strerror (errno));
|
||||
close (priv->fd);
|
||||
priv->fd = -1;
|
||||
@@ -725,7 +725,7 @@ mm_serial_port_open (MMSerialPort *self, GError **error)
|
||||
tcflush (priv->fd, TCIOFLUSH);
|
||||
|
||||
if (tcgetattr (priv->fd, &priv->old_t) < 0) {
|
||||
g_set_error (error, MM_SERIAL_ERROR, MM_SERIAL_OPEN_FAILED,
|
||||
g_set_error (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_OPEN_FAILED,
|
||||
"Could not open serial device %s: %s", device, strerror (errno));
|
||||
close (priv->fd);
|
||||
priv->fd = -1;
|
||||
|
Reference in New Issue
Block a user