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), mm_port_probe_get_port_name (probe),
str); str);
g_free (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, 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_parse,
mm_serial_parser_v1_new (), mm_serial_parser_v1_new (),
mm_serial_parser_v1_destroy); mm_serial_parser_v1_destroy);
/* Prefer plugin-provided flags to the generic ones */ /* Prefer plugin-provided flags to the generic ones */
if (at_pflags == MM_PORT_SERIAL_AT_FLAG_NONE) { 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)) { 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; 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); mm_port_serial_at_set_flags (MM_PORT_SERIAL_AT (port), at_pflags);
} else if (ptype == MM_PORT_TYPE_GPS) { } else if (ptype == MM_PORT_TYPE_GPS) {
/* Raw GPS port */ /* Raw GPS port */
port = MM_PORT (mm_port_serial_gps_new (name)); 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 (self != NULL);
g_return_if_fail (MM_IS_PORT_SERIAL_AT (self)); 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 | g_return_if_fail (flags <= (MM_PORT_SERIAL_AT_FLAG_PRIMARY |
MM_PORT_SERIAL_AT_FLAG_SECONDARY | MM_PORT_SERIAL_AT_FLAG_SECONDARY |
MM_PORT_SERIAL_AT_FLAG_PPP | MM_PORT_SERIAL_AT_FLAG_PPP |

View File

@@ -42,15 +42,18 @@ typedef struct _MMPortSerialAtPrivate MMPortSerialAtPrivate;
* only when connecting is port 0 opened for dialing (ATD) and PPP * only when connecting is port 0 opened for dialing (ATD) and PPP
*/ */
typedef enum { /*< underscore_name=mm_port_serial_at_flag >*/ typedef enum { /*< underscore_name=mm_port_serial_at_flag >*/
MM_PORT_SERIAL_AT_FLAG_NONE = 0, MM_PORT_SERIAL_AT_FLAG_NONE = 0,
/* This port is preferred for command and status */ /* This port is preferred for command and status */
MM_PORT_SERIAL_AT_FLAG_PRIMARY = 1 << 0, MM_PORT_SERIAL_AT_FLAG_PRIMARY = 1 << 0,
/* Use port for command and status if the primary port is connected */ /* Use port for command and status if the primary port is connected */
MM_PORT_SERIAL_AT_FLAG_SECONDARY = 1 << 1, MM_PORT_SERIAL_AT_FLAG_SECONDARY = 1 << 1,
/* This port should be used for PPP */ /* This port should be used for PPP */
MM_PORT_SERIAL_AT_FLAG_PPP = 1 << 2, MM_PORT_SERIAL_AT_FLAG_PPP = 1 << 2,
/* This port should be used for GPS control */ /* This port should be used for GPS control */
MM_PORT_SERIAL_AT_FLAG_GPS_CONTROL = 1 << 3, 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; } MMPortSerialAtFlag;
typedef gboolean (*MMPortSerialAtResponseParserFn) (gpointer user_data, typedef gboolean (*MMPortSerialAtResponseParserFn) (gpointer user_data,