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:13:35 -0500 |
commit | 8f74fc2bbd34965f7a77cfc136e809769fc38999 (patch) | |
tree | 650b750831effba2b5c484f0832daf46ad30758e | |
parent | 62503143817b20834caaede212fe2a966ae50274 (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 c77d55ba..74ef71a9 100644 --- a/src/mm-plugin-base.c +++ b/src/mm-plugin-base.c @@ -1054,11 +1054,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; @@ -1085,6 +1086,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, @@ -1100,6 +1102,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_probe_result (MMPluginBase *self, GUdevDevice *port, guint32 *capabilities, diff --git a/src/mm-plugin-base.h b/src/mm-plugin-base.h index 46254749..f1dc4ccf 100644 --- a/src/mm-plugin-base.h +++ b/src/mm-plugin-base.h @@ -165,6 +165,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_probe_result (MMPluginBase *self, GUdevDevice *port, |