huawei: plugin already processes generic tags

So don't re-process them in the generic modem when grabbing the port.
This commit is contained in:
Aleksander Morgado
2020-08-11 11:41:43 +02:00
parent 824ad11356
commit b2621b4336
4 changed files with 22 additions and 5 deletions

View File

@@ -695,6 +695,10 @@ grab_port (MMPlugin *self,
mm_port_probe_get_port_name (probe),
str);
g_free (str);
} else {
/* The huawei plugin handles the generic udev tags itself, so explicitly request
* to avoid processing them by the generic modem. */
pflags = MM_PORT_SERIAL_AT_FLAG_NONE_NO_GENERIC;
}
return mm_base_modem_grab_port (modem,

View File

@@ -223,6 +223,7 @@ mm_base_modem_grab_port (MMBaseModem *self,
mm_serial_parser_v1_parse,
mm_serial_parser_v1_new (),
mm_serial_parser_v1_destroy);
/* Prefer plugin-provided flags to the generic ones */
if (at_pflags == MM_PORT_SERIAL_AT_FLAG_NONE) {
if (mm_kernel_device_get_property_as_boolean (kernel_device, ID_MM_PORT_TYPE_AT_PRIMARY)) {
@@ -236,7 +237,14 @@ mm_base_modem_grab_port (MMBaseModem *self,
at_pflags = MM_PORT_SERIAL_AT_FLAG_PPP;
}
}
/* The plugin may specify NONE_NO_GENERIC to avoid the generic
* port type hints from being applied. */
if (at_pflags == MM_PORT_SERIAL_AT_FLAG_NONE_NO_GENERIC)
at_pflags = MM_PORT_SERIAL_AT_FLAG_NONE;
mm_port_serial_at_set_flags (MM_PORT_SERIAL_AT (port), at_pflags);
} else if (ptype == MM_PORT_TYPE_GPS) {
/* Raw GPS port */
port = MM_PORT (mm_port_serial_gps_new (name));

View File

@@ -473,6 +473,8 @@ mm_port_serial_at_set_flags (MMPortSerialAt *self, MMPortSerialAtFlag flags)
{
g_return_if_fail (self != NULL);
g_return_if_fail (MM_IS_PORT_SERIAL_AT (self));
/* MM_PORT_SERIAL_AT_FLAG_NONE_NO_GENERIC is not expected */
g_return_if_fail (flags <= (MM_PORT_SERIAL_AT_FLAG_PRIMARY |
MM_PORT_SERIAL_AT_FLAG_SECONDARY |
MM_PORT_SERIAL_AT_FLAG_PPP |

View File

@@ -51,6 +51,9 @@ typedef enum { /*< underscore_name=mm_port_serial_at_flag >*/
MM_PORT_SERIAL_AT_FLAG_PPP = 1 << 2,
/* This port should be used for GPS control */
MM_PORT_SERIAL_AT_FLAG_GPS_CONTROL = 1 << 3,
/* Helper flag to allow plugins specify that generic tags shouldn't be
* applied */
MM_PORT_SERIAL_AT_FLAG_NONE_NO_GENERIC = 1 << 4,
} MMPortSerialAtFlag;
typedef gboolean (*MMPortSerialAtResponseParserFn) (gpointer user_data,