summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2012-11-26 17:29:48 -0600
committerDan Williams <dcbw@redhat.com>2012-11-27 09:56:25 -0600
commita01e8aa31724ee1210b86d1d7261897a305d8710 (patch)
tree6d7adeac511a1a76e1b0247cebda6982ff69a3e9
parent8772d63389b97a65bcace9fe0b54175a6adab9fe (diff)
serial-port: consistently use mm_warn() instead of g_warning()
-rw-r--r--src/mm-serial-port.c45
1 files changed, 21 insertions, 24 deletions
diff --git a/src/mm-serial-port.c b/src/mm-serial-port.c
index acfec4ca..0a8820d2 100644
--- a/src/mm-serial-port.c
+++ b/src/mm-serial-port.c
@@ -184,8 +184,8 @@ mm_serial_port_print_config (MMSerialPort *port, const char *detail)
err = tcgetattr (priv->fd, &stbuf);
if (err) {
- g_warning ("*** %s (%s): (%s) tcgetattr() error %d",
- __func__, detail, mm_port_get_device (MM_PORT (port)), errno);
+ mm_warn ("*** %s (%s): (%s) tcgetattr() error %d",
+ __func__, detail, mm_port_get_device (MM_PORT (port)), errno);
return;
}
@@ -251,7 +251,7 @@ parse_baudrate (guint i)
speed = B460800;
break;
default:
- g_warning ("Invalid baudrate '%d'", i);
+ mm_warn ("Invalid baudrate '%d'", i);
speed = B9600;
}
@@ -277,7 +277,7 @@ parse_bits (guint i)
bits = CS8;
break;
default:
- g_warning ("Invalid bits (%d). Valid values are 5, 6, 7, 8.", i);
+ mm_warn ("Invalid bits (%d). Valid values are 5, 6, 7, 8.", i);
bits = CS8;
}
@@ -303,7 +303,7 @@ parse_parity (char c)
parity = PARENB | PARODD;
break;
default:
- g_warning ("Invalid parity (%c). Valid values are n, e, o", c);
+ mm_warn ("Invalid parity (%c). Valid values are n, e, o", c);
parity = 0;
}
@@ -323,7 +323,7 @@ parse_stopbits (guint i)
stopbits = CSTOPB;
break;
default:
- g_warning ("Invalid stop bits (%d). Valid values are 1 and 2)", i);
+ mm_warn ("Invalid stop bits (%d). Valid values are 1 and 2)", i);
stopbits = 0;
}
@@ -347,10 +347,9 @@ real_config_fd (MMSerialPort *self, int fd, GError **error)
memset (&stbuf, 0, sizeof (struct termios));
if (tcgetattr (fd, &stbuf) != 0) {
- g_warning ("%s (%s): tcgetattr() error: %d",
- __func__,
- mm_port_get_device (MM_PORT (self)),
- errno);
+ mm_warn ("(%s): tcgetattr() error: %d",
+ mm_port_get_device (MM_PORT (self)),
+ errno);
}
stbuf.c_iflag &= ~(IGNCR | ICRNL | IUCLC | INPCK | IXON | IXANY );
@@ -675,11 +674,10 @@ mm_serial_port_queue_process (gpointer data)
/* Ensure the response array is fully empty before setting the
* cached response. */
if (priv->response->len > 0) {
- g_warning ("%s: (%s) response array is not empty when using "
- "cached reply, cleaning up %u bytes",
- __func__,
- mm_port_get_device (MM_PORT (self)),
- priv->response->len);
+ mm_warn ("(%s) response array is not empty when using cached "
+ "reply, cleaning up %u bytes",
+ mm_port_get_device (MM_PORT (self)),
+ priv->response->len);
g_byte_array_set_size (priv->response, 0);
}
@@ -775,9 +773,9 @@ data_available (GIOChannel *source,
status = g_io_channel_read_chars (source, buf, SERIAL_BUF_SIZE, &bytes_read, &err);
if (status == G_IO_STATUS_ERROR) {
if (err && err->message) {
- g_warning ("(%s) read error: %s",
- mm_port_get_device (MM_PORT (self)),
- err->message);
+ mm_warn ("(%s): read error: %s",
+ mm_port_get_device (MM_PORT (self)),
+ err->message);
}
g_clear_error (&err);
}
@@ -824,12 +822,11 @@ port_connected (MMSerialPort *self, GParamSpec *pspec, gpointer user_data)
connected = mm_port_get_connected (MM_PORT (self));
if (ioctl (priv->fd, (connected ? TIOCNXCL : TIOCEXCL)) < 0) {
- g_warning ("%s: (%s) could not %s serial port lock: (%d) %s",
- __func__,
- mm_port_get_device (MM_PORT (self)),
- connected ? "drop" : "re-acquire",
- errno,
- strerror (errno));
+ mm_warn ("(%s): could not %s serial port lock: (%d) %s",
+ mm_port_get_device (MM_PORT (self)),
+ connected ? "drop" : "re-acquire",
+ errno,
+ strerror (errno));
if (!connected) {
// FIXME: do something here, maybe try again in a few seconds or
// close the port and error out?