diff options
author | Dan Williams <dcbw@redhat.com> | 2012-08-23 21:13:35 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2012-08-23 21:23:29 -0500 |
commit | 21e66dfa1774ac2ee037ac8b6e8bb4d71a6f7931 (patch) | |
tree | c5ae483d1df56295af6c532ab52888333547b0da | |
parent | 4de93241dc28c1364ade56825c0431e0345b8de0 (diff) |
core: add function to open probe ports without removing echo
Some devices (Sierra GSM ones) return stuff we need but don't
bother to prefix it with <CR><LF>, so we need to optionally turn
off the echo removal at probe time.
-rw-r--r-- | src/mm-plugin-base.c | 30 | ||||
-rw-r--r-- | src/mm-plugin-base.h | 9 |
2 files changed, 34 insertions, 5 deletions
diff --git a/src/mm-plugin-base.c b/src/mm-plugin-base.c index 8acfd080..fcd6407f 100644 --- a/src/mm-plugin-base.c +++ b/src/mm-plugin-base.c @@ -863,11 +863,12 @@ try_open (gpointer user_data) return FALSE; } -gboolean -mm_plugin_base_probe_port (MMPluginBase *self, - MMPluginBaseSupportsTask *task, - guint64 send_delay_us, - GError **error) +static gboolean +_internal_probe_port (MMPluginBase *self, + MMPluginBaseSupportsTask *task, + guint64 send_delay_us, + gboolean remove_echo, + GError **error) { MMPluginBaseSupportsTaskPrivate *task_priv = MM_PLUGIN_BASE_SUPPORTS_TASK_GET_PRIVATE (task); MMAtSerialPort *serial; @@ -894,6 +895,7 @@ mm_plugin_base_probe_port (MMPluginBase *self, MM_SERIAL_PORT_SEND_DELAY, send_delay_us, MM_PORT_CARRIER_DETECT, FALSE, MM_SERIAL_PORT_SPEW_CONTROL, TRUE, + MM_AT_SERIAL_PORT_REMOVE_ECHO, remove_echo, NULL); mm_at_serial_port_set_response_parser (serial, @@ -909,6 +911,24 @@ mm_plugin_base_probe_port (MMPluginBase *self, } gboolean +mm_plugin_base_probe_port (MMPluginBase *self, + MMPluginBaseSupportsTask *task, + guint64 send_delay_us, + GError **error) +{ + return _internal_probe_port (self, task, send_delay_us, TRUE, error); +} + +gboolean +mm_plugin_base_probe_port_leave_echo (MMPluginBase *self, + MMPluginBaseSupportsTask *task, + guint64 send_delay_us, + GError **error) +{ + return _internal_probe_port (self, task, send_delay_us, FALSE, error); +} + +gboolean mm_plugin_base_get_cached_port_capabilities (MMPluginBase *self, GUdevDevice *port, guint32 *capabilities) diff --git a/src/mm-plugin-base.h b/src/mm-plugin-base.h index e69ad178..e64dd2e7 100644 --- a/src/mm-plugin-base.h +++ b/src/mm-plugin-base.h @@ -153,6 +153,15 @@ gboolean mm_plugin_base_probe_port (MMPluginBase *self, guint64 send_delay_us, GError **error); +/* Same as mm_plugin_base_probe_port() but does not strip possible + * echoed characters before the first <cr><lf>. (ie, sets the probe port's + * MM_AT_SERIAL_PORT_REMOVE_ECHO property to FALSE) + */ +gboolean mm_plugin_base_probe_port_leave_echo (MMPluginBase *self, + MMPluginBaseSupportsTask *task, + guint64 send_delay_us, + GError **error); + /* Returns TRUE if the port was previously probed, FALSE if not */ gboolean mm_plugin_base_get_cached_port_capabilities (MMPluginBase *self, GUdevDevice *port, |