Commit Graph

227 Commits

Author SHA1 Message Date
Aleksander Morgado
3bc9a2dbe2 broadband-modem,ussd: explain encoding/decoding logic 2018-08-21 16:50:15 +00:00
Aleksander Morgado
548b7f8847 base-modem: load AT port type hints when adding port
We keep the pflags input in mm_base_modem_grab_port() so that plugins
can use other methods to gather port type hints (e.g. querying with AT
commands as in Huawei/Telit or looking at sysfs properties as in HSO).

For standard udev tag port type hints, it will be the base modem
looking them up.

Note that there is no longer any need to ignore non-flagged ports for
those modems that require primary/secondary flags. They will be
implicitly ignored when mm_base_modem_organize_ports() decides which
ports to use, as the flagged ones are preferred over the non-flagged
ones.
2018-08-10 04:19:13 +00:00
Aleksander Morgado
6b0424cfac plugins: consolidate ID_MM_PORT_TYPE_AT_* flag names
We define 3 common udev tag ids to be used by all plugins:

 * ID_MM_PORT_TYPE_AT_PRIMARY: the primary modem port. It will be used
   for AT control and also as PPP if there is no other port flagged
   explicitly to do PPP.

 * ID_MM_PORT_TYPE_AT_SECONDARY: the secondary modem port. It will be
   used when/if the primary port gets connected to do PPP.

 * ID_MM_PORT_TYPE_PPP: the port to be used to do PPP only. This tag
   makes sense only when the primary port shouldn't be used for PPP,
   i.e. when there is a port dedicated to do PPP and one port
   dedicated for control.
2018-08-10 04:19:13 +00:00
Aleksander Morgado
86f840d97b port-probe: explicitly report GPS port type if port flagged
And remove all custom logic from all plugins that were doing just that.
2018-08-10 04:19:13 +00:00
Aleksander Morgado
85adbdbdd1 plugins: consolidate ID_MM_PORT_TYPE_GPS flag name
Use the same flag name across all plugins with support for
NMEA-capable TTYs.
2018-08-10 04:19:13 +00:00
Aleksander Morgado
c07382a486 udev: add tags also on bind action
When a new USB device is hotplugged, e.g. a USB<->RS232 converter that
exposes a single ttyUSB0, these udev events happen:

  add  /devices/pci0000:00/0000:00:14.0/usb2/2-1 (usb/usb-device)
  add  /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0 (usb/usb-interface)
  add  /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/ttyUSB0 (usb-serial)
  add  /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/ttyUSB0/tty/ttyUSB0 (tty)
  bind /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/ttyUSB0 (usb-serial)
  bind /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0 (usb/usb-interface)
  bind /devices/pci0000:00/0000:00:14.0/usb2/2-1 (usb/usb-device)

Our udev rules in MM only added tags in the 'add' events, and it looks
like the only ones 'persistent' after this sequence are those of the
last event happening on the specific path.

This meant that all TTY subsystem rules (e.g. ID_MM_CANDIDATE) would
be stored for later check (e.g. if ModemManager is started after these
rules have been applied), which was ok. "udevadm info -p ..." would
show these tags correctly always.

But this also meant that the 'bind' udev event happening for the USB
device didn't get any of our device-specific tags, and so we would be
missing them (e.g. ID_MM_DEVICE_MANUAL_SCAN_ONLY) if MM is started
after the last event has happened. "udevadm info -p ..." would
not show these tags.

Modify all our rules to also run at the 'bind' events.

See, for context:
  https://github.com/systemd/systemd/issues/8221
2018-06-02 16:54:37 +02:00
Lubomir Rintel
b39dd2ec05 all: drop unused variables
Keeps build with GCC 8 happy.

mm-base-call.c:758:18: warning: variable 'response' set but not used [-Wunused-but-set-variable]
mm-base-call.c:822:18: warning: variable 'response' set but not used [-Wunused-but-set-variable]
mm-base-sms.c:908:18: warning: variable 'response' set but not used [-Wunused-but-set-variable]
mm-sms-list.c:331:25: warning: variable 'ctx' set but not used [-Wunused-but-set-variable]
mm-iface-modem-messaging.c:1210:21: warning: variable 'storage_ctx' set but not used [-Wunused-but-set-variable]
huawei/mm-plugin-huawei.c:183:18: warning: variable 'response' set but not used [-Wunused-but-set-variable]
ublox/mm-plugin-ublox.c:161:24: warning: variable 'response' set but not used [-Wunused-but-set-variable]
ublox/mm-plugin-ublox.c:159:24: warning: variable 'ctx' set but not used [-Wunused-but-set-variable]
icera/mm-modem-helpers-icera.c:218:25: warning: variable 'first_free' set but not used [-Wunused-but-set-variable]
novatel/mm-common-novatel.c:50:18: warning: variable 'response' set but not used [-Wunused-but-set-variable]
2018-04-24 18:11:15 +02:00
Ben Chan
456e1e0d0c huawei: handle optional 0x prefix on hex numbers in ^DHCP response
On Huawei ME936, the hex numbers in the response to AT^DHCP contain the 0x prefix, e.g.

  AT^DHCP?

  ^DHCP: 0xda7d0e0a,0xff000000,0xdb7d0e0a,0xdb7d0e0a,0x01261aac,0x00000000,100000000,50000000

This patch updates mm_huawei_parse_dhcp_response() to handle the
optional 0x prefix.
2018-01-27 12:13:18 -06:00
Aleksander Morgado
33583ca4de kerneldevice: allow getting interface class/subclass/protocol 2017-12-05 10:58:29 +01:00
Aleksander Morgado
4c36bd42d4 huawei: plug memleak when listing cdc-wdm AT ports
The returned list contains full references, so make sure we unref them
before going on. Note that it's ok to return a pointer to one object
inside this list even if we're unref-ing them all, because we're sure
that the caller knows it's peek-ing a port object.
2017-09-26 10:46:55 +02:00
Ben Chan
d6d52b95c7 huawei: port connect_3gpp to use GTask 2017-09-08 17:45:29 +02:00
Ben Chan
1ada2d23a5 huawei: port disconnect_3gpp to use GTask 2017-09-08 17:45:29 +02:00
Ben Chan
abf9d36183 huawei: port huawei_modem_create_bearer to use GTask 2017-09-08 17:45:29 +02:00
Ben Chan
7880a35b19 huawei: port huawei_custom_init to use GTask 2017-09-08 17:45:29 +02:00
Ben Chan
e76015ac49 huawei: port get_detailed_registration_state to use GTask 2017-09-08 17:45:29 +02:00
Ben Chan
9c32a96578 huawei: port setup_registration_checks to use GTask 2017-09-08 17:45:29 +02:00
Ben Chan
39484765f1 huawei: port call_start to use GTask 2017-09-08 17:45:29 +02:00
Ben Chan
8df63e385c huawei: port modem_voice_disable_unsolicited_events to use GTask 2017-09-08 17:45:29 +02:00
Ben Chan
68075a23a7 huawei: port modem_voice_enable_unsolicited_events to use GTask 2017-09-08 17:45:29 +02:00
Ben Chan
5e8a7aad76 huawei: port modem_voice_{setup,cleanup}_unsolicited_events to use GTask 2017-09-08 17:45:29 +02:00
Ben Chan
46866b08be huawei: port modem_cdma_{setup,cleanup}_unsolicited_events to use GTask 2017-09-08 17:45:29 +02:00
Ben Chan
5f641afe07 huawei: port modem_3gpp_disable_unsolicited_events to use GTask 2017-09-08 17:45:29 +02:00
Ben Chan
074e0f89fc huawei: port modem_3gpp_enable_unsolicited_events to use GTask 2017-09-08 17:45:28 +02:00
Ben Chan
02ce611d5c huawei: port modem_3gpp_{setup,cleanup}_unsolicited_events to use GTask 2017-09-08 17:45:28 +02:00
Ben Chan
38bafe021e huawei: port {enable,disable}_location_gathering to use GTask 2017-09-08 17:45:28 +02:00
Ben Chan
6ebc07f882 huawei: port location_load_capabilities to use GTask 2017-09-08 17:45:28 +02:00
Ben Chan
36d975bd4e huawei: port modem_after_sim_unlock to use GTask 2017-09-08 17:45:28 +02:00
Ben Chan
0aae6d3e35 huawei: port modem_time_check_support to use GTask 2017-09-08 17:45:28 +02:00
Ben Chan
60129a6fde huawei: port modem_load_signal_quality to use GTask 2017-09-08 17:45:28 +02:00
Ben Chan
0c468bb1a4 huawei: port load_sim_identifier to use GTask 2017-09-08 17:45:28 +02:00
Ben Chan
1495fb1d1d huawei: port load_power_state to use GTask 2017-09-08 17:45:28 +02:00
Ben Chan
046f1b3301 huawei: port load_supported_modes to use GTask 2017-09-08 17:45:28 +02:00
Ben Chan
c7ec2c4fbb huawei: port load_current_modes to use GTask 2017-09-08 17:45:28 +02:00
Ben Chan
bf03f1e2d7 huawei: port set_current_modes to use GTask 2017-09-08 17:45:28 +02:00
Ben Chan
5d9c4d70a1 huawei: port set_current_bands to use GTask 2017-09-08 17:45:28 +02:00
Ben Chan
8b9402da2b huawei: port sysinfo to use GTask 2017-09-08 17:45:28 +02:00
Aleksander Morgado
d135c56f0f huawei: update frequency bands support
Updated to use the non-deprecated MMModemBand values.
2017-09-07 10:55:17 +02:00
Aleksander Morgado
1f2bb64028 charsets: ensure all methods are prefixed with 'mm_' 2017-08-16 16:08:15 +02:00
Ben Chan
625c204761 huawei: remove redundant call to huawei_parse_auth_type()
This patch removes a redundant `encoded_auth = huawei_parse_auth_type (auth)`
in connect_3gpp_context_step().
2017-08-04 14:02:06 +02:00
Ben Chan
e1823e605e huawei: ensure MMBearerConnectResult populated into GSimpleAsyncResult
During the CONNECT_3GPP_CONTEXT_STEP_LAST step,
connect_3gpp_context_step() conditionally creates and populates a
MMBearerConnectResult object into the GSimpleAsyncResult object when the
ipv4_config field of the Connect3gppContext struct is set. That assumes
the ipv4_config field is always initialized in
connect_dhcp_check_ready() during the
CONNECT_3GPP_CONTEXT_STEP_IP_CONFIG step. Instead of having such an
assumption, this patch modifies connect_3gpp to always initialize
the ipv4_config field, such that connect_3gpp_context_step() always
populates a MMBearerConnectResult object into the GSimpleAsyncResult
object.
2017-08-03 12:35:40 +02:00
Aleksander Morgado
f1f313c214 huawei: skip unrequired explicit casts to GSimpleAsyncResult 2017-07-17 10:20:16 +02:00
Aleksander Morgado
91bbcb5c5f huawei: fix async completion in 3gpp event handlers setting 2017-07-17 10:20:16 +02:00
Aleksander Morgado
c0c2e8aae8 huawei: fix async completion in voice event handlers setting 2017-07-17 10:20:16 +02:00
Aleksander Morgado
7b0c0bc96b huawei: fix async completion in cdma event handlers setting 2017-07-17 10:20:16 +02:00
Aleksander Morgado
b5e94185bb huawei: let the E3372 run NDISDUP via TTY
This modem ends up exposing a cdc-wdm port and a WWAN network
interface, but the cdc-wdm port is totally unusable, it won't reply to
any AT command or anything.

Instead this modem can do NDISDUP via TTY, which is what the Windows
drivers are also doing.
2017-06-02 13:13:59 +02:00
Aleksander Morgado
f824602bdd modem-helpers: if operator not in UCS2, see if already valid UTF-8
The method doing the operator name normalization takes as input the
current configured modem charset. If this is UCS2, we will now just
assume this is a hint: the string may or may not come in hex/UCS2.

This logic makes the custom operator name loading in Huawei unneeded,
if the modem is configured in UCS2, we still properly process operator
names coming in plain ASCII.
2017-04-02 10:06:07 +02:00
Ben Chan
254f2e3412 plugins: remove explicit GDestroyNotify cast on g_free / g_object_unref
g_free and g_object_unref are in form of  `void (*)(gpointer)`, which
matches the GDestroyNotify signature. An explicit GDestroyNotify cast on
g_free and g_object_unref is thus not needed.
2017-03-29 10:22:18 +02:00
Riccardo Vangelisti
dc01a30c2f huawei: ignore unsolicited message ^EONS 2017-03-24 17:52:47 +01:00
Aleksander Morgado
00fb9e98f6 kernel-device: device-specific properties in either port or physdev
There are 2 main types of udev properties: device-specific and
port-specific.

The port-specific properties are set independently per port (e.g. port
type hints set per interface number for a given vid:pid).

The device-specific properties apply to all ports in the device. Some
of these properties are currently expected in the physical device
(e.g. ID_MM_PLATFORM_DRIVER_PROBE) while some others are expected in
each port (e.g. the plugin udev tag filters).

This patch tries to simplify the logic and just assume that the device
specific tags may be given in either the physical device or the port
device, by providing separate APIs to retrieve port-specific or
device-specific (global) properties. If the same tag is given in both
the device and the port, the one in the device takes preference.

For the generic backend, these new APIs are really useless, as all
device-specific and port-specific properties are always stored in the
port object themselves (there is no 'tree' of devices in the generic
backend, no 'physdev' device).

For the udev backend, though, there really is a difference, as the
tags may be set in port or device.

https://bugs.freedesktop.org/show_bug.cgi?id=100156
2017-03-22 09:40:10 +01:00
Ben Chan
31655bb5a5 glib: remove invocations of g_type_init()
g_type_init() has been deprecated (and also marked with the attribute
'deprecated') since glib 2.36 as the type system is automatically
initialized. Since the minimum version of glib required by ModemManager
is 2.36, calling g_type_init() isn't necessarily in the ModemManager
code.
2017-02-03 10:05:14 +01:00