port-serial-qcdm: allow specifying input subsystem

We have assumed until now that all QCDM ports are based on TTY
drivers, e.g. exposed via USB.

This may no longer be true, so allow creating QCDM ports with
an explicit subsystem instead of defaulting always to TTY.
This commit is contained in:
Aleksander Morgado
2020-11-09 12:31:03 +01:00
parent 56fca14473
commit 4ec2db75b8
4 changed files with 7 additions and 5 deletions

View File

@@ -176,7 +176,7 @@ base_modem_create_tty_port (MMBaseModem *self,
const gchar *flow_control_tag;
if (ptype == MM_PORT_TYPE_QCDM)
port = MM_PORT (mm_port_serial_qcdm_new (name));
port = MM_PORT (mm_port_serial_qcdm_new (name, MM_PORT_SUBSYS_TTY));
else if (ptype == MM_PORT_TYPE_GPS)
port = MM_PORT (mm_port_serial_gps_new (name));
else if (ptype == MM_PORT_TYPE_AUDIO)

View File

@@ -745,7 +745,7 @@ serial_probe_qcdm (MMPortProbe *self)
}
/* Open the QCDM port */
ctx->serial = MM_PORT_SERIAL (mm_port_serial_qcdm_new (mm_kernel_device_get_name (self->priv->port)));
ctx->serial = MM_PORT_SERIAL (mm_port_serial_qcdm_new (mm_kernel_device_get_name (self->priv->port), MM_PORT_SUBSYS_TTY));
if (!ctx->serial) {
port_probe_task_return_error (self,
g_error_new (MM_CORE_ERROR,

View File

@@ -350,11 +350,12 @@ config_fd (MMPortSerial *port, int fd, GError **error)
/*****************************************************************************/
MMPortSerialQcdm *
mm_port_serial_qcdm_new (const char *name)
mm_port_serial_qcdm_new (const char *name,
MMPortSubsys subsys)
{
return MM_PORT_SERIAL_QCDM (g_object_new (MM_TYPE_PORT_SERIAL_QCDM,
MM_PORT_DEVICE, name,
MM_PORT_SUBSYS, MM_PORT_SUBSYS_TTY,
MM_PORT_SUBSYS, subsys,
MM_PORT_TYPE, MM_PORT_TYPE_QCDM,
MM_PORT_SERIAL_SEND_DELAY, (guint64) 0,
NULL));

View File

@@ -45,7 +45,8 @@ struct _MMPortSerialQcdmClass {
GType mm_port_serial_qcdm_get_type (void);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MMPortSerialQcdm, g_object_unref)
MMPortSerialQcdm *mm_port_serial_qcdm_new (const char *name);
MMPortSerialQcdm *mm_port_serial_qcdm_new (const char *name,
MMPortSubsys subsys);
MMPortSerialQcdm *mm_port_serial_qcdm_new_fd (int fd);
void mm_port_serial_qcdm_command (MMPortSerialQcdm *self,