base-modem,port-probe: set serial port flow control from udev tag
Set the serial port flow control from the udev tag ID_MM_TTY_FLOW_CONTROL before accessing the port.
This commit is contained in:

committed by
Dan Williams

parent
4e69c10c2d
commit
94879ce1ce
@@ -151,6 +151,7 @@ mm_base_modem_grab_port (MMBaseModem *self,
|
||||
gchar *key;
|
||||
const gchar *subsys;
|
||||
const gchar *name;
|
||||
const gchar *flow_control_tag;
|
||||
|
||||
g_return_val_if_fail (MM_IS_BASE_MODEM (self), FALSE);
|
||||
g_return_val_if_fail (MM_IS_KERNEL_DEVICE (kernel_device), FALSE);
|
||||
@@ -246,11 +247,18 @@ mm_base_modem_grab_port (MMBaseModem *self,
|
||||
G_CALLBACK (serial_port_timed_out_cb),
|
||||
self);
|
||||
|
||||
/* For serial ports, optionally use a specific baudrate */
|
||||
/* For serial ports, optionally use a specific baudrate and flow control */
|
||||
if (mm_kernel_device_has_property (kernel_device, "ID_MM_TTY_BAUDRATE"))
|
||||
g_object_set (port,
|
||||
MM_PORT_SERIAL_BAUD, mm_kernel_device_get_property_as_int (kernel_device, "ID_MM_TTY_BAUDRATE"),
|
||||
NULL);
|
||||
flow_control_tag = mm_kernel_device_get_property (kernel_device,
|
||||
"ID_MM_TTY_FLOW_CONTROL");
|
||||
if (flow_control_tag)
|
||||
g_object_set (port,
|
||||
MM_PORT_SERIAL_FLOW_CONTROL,
|
||||
mm_parse_flow_control_tag (flow_control_tag),
|
||||
NULL);
|
||||
}
|
||||
/* Net ports... */
|
||||
else if (g_str_equal (subsys, "net")) {
|
||||
|
@@ -711,6 +711,7 @@ serial_probe_qcdm (MMPortProbe *self)
|
||||
gint len;
|
||||
guint8 marker = 0x7E;
|
||||
PortProbeRunContext *ctx;
|
||||
const gchar *flow_control_tag;
|
||||
|
||||
g_assert (self->priv->task);
|
||||
ctx = g_task_get_task_data (self->priv->task);
|
||||
@@ -751,6 +752,13 @@ serial_probe_qcdm (MMPortProbe *self)
|
||||
g_object_set (ctx->serial,
|
||||
MM_PORT_SERIAL_BAUD, mm_kernel_device_get_property_as_int (self->priv->port, "ID_MM_TTY_BAUDRATE"),
|
||||
NULL);
|
||||
flow_control_tag = mm_kernel_device_get_property (self->priv->port,
|
||||
"ID_MM_TTY_FLOW_CONTROL");
|
||||
if (flow_control_tag)
|
||||
g_object_set (ctx->serial,
|
||||
MM_PORT_SERIAL_FLOW_CONTROL,
|
||||
mm_parse_flow_control_tag (flow_control_tag),
|
||||
NULL);
|
||||
|
||||
/* Try to open the port */
|
||||
if (!mm_port_serial_open (ctx->serial, &error)) {
|
||||
@@ -1256,6 +1264,7 @@ serial_open_at (MMPortProbe *self)
|
||||
{
|
||||
GError *error = NULL;
|
||||
PortProbeRunContext *ctx;
|
||||
const gchar *flow_control_tag;
|
||||
|
||||
g_assert (self->priv->task);
|
||||
ctx = g_task_get_task_data (self->priv->task);
|
||||
@@ -1295,6 +1304,13 @@ serial_open_at (MMPortProbe *self)
|
||||
g_object_set (ctx->serial,
|
||||
MM_PORT_SERIAL_BAUD, mm_kernel_device_get_property_as_int (self->priv->port, "ID_MM_TTY_BAUDRATE"),
|
||||
NULL);
|
||||
flow_control_tag = mm_kernel_device_get_property (self->priv->port,
|
||||
"ID_MM_TTY_FLOW_CONTROL");
|
||||
if (flow_control_tag)
|
||||
g_object_set (ctx->serial,
|
||||
MM_PORT_SERIAL_FLOW_CONTROL,
|
||||
mm_parse_flow_control_tag (flow_control_tag),
|
||||
NULL);
|
||||
|
||||
parser = mm_serial_parser_v1_new ();
|
||||
mm_serial_parser_v1_add_filter (parser,
|
||||
|
Reference in New Issue
Block a user