Commit Graph

1671 Commits

Author SHA1 Message Date
Aleksander Morgado
b8c7773a74 cinterion: fix band related unit tests
The sort_band() method used in the tester was totally wrong, it was
comparing the addresses of the variables instead of the MMModemBand
values.

Use the common mm_common_bands_garray_sort() instead, which works as
expected.
2018-07-31 00:23:25 +02:00
Reinhard Speyerer
ebe9fcd574 mm-modem-helpers-cinterion: update band table for PLS8-J
The default AT^SCFG="Radio/Band" value for Cinterion PLS8-J devices is
"16819472". Add UMTS band 19 and LTE band 19 entries based on the
information given in the PLS8 datasheet.
2018-07-30 21:22:07 +02:00
mstanger
7913fe4faf mm-modem-helpers-cinterion: update freq/band table
This info comes from PLS8-X/E/J/V/US, HC25 & PHS8 references, the
last two can be found publicly via Google search.

Swapped bit-mask locations for G850 & PCS bands as they may have
changed with FW or where accidently put in the wrong place.

Updated many 3G & 4G bit-mask fields.
2018-07-27 17:47:23 +02:00
Aleksander Morgado
d134402efc ublox: always send user/pass strings, even if no authentication requested
The TOBY-L2 allowed to skup the user/pass string fields when no
authentication was requested, but according to the AT command
reference, all the remaining u-blox modules do require these two
fields given always (e.g. just as empty strings).

As per this sequence in a TOBY-L4:

 (ttyACM2): --> 'AT+UAUTHREQ=?<CR>'
 (ttyACM2): <-- '<CR><LF>+UAUTHREQ: (1-4),(0-2),,<CR><LF><CR><LF>OK<CR><LF>'
 (ttyACM2): --> 'AT+UAUTHREQ=1,0<CR>'
 (ttyACM2): <-- '<CR><LF>+CME ERROR: 4<CR><LF>'

It should have been: AT+UAUTHREQ=1,0,"",""
2018-07-10 19:45:05 +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
Aleksander Morgado
4bc7d6862d u-blox: wait 20s before probing TOBY-L200 ports
https://bugs.freedesktop.org/show_bug.cgi?id=106623
2018-06-02 16:51:07 +02:00
Aleksander Morgado
3e469e7b80 u-blox: don't run quick AT procedure if READY_DELAY not configured
The quick AT probe procedure is only meaningful to avoid waiting the
+READY URC delay. If there is no such delay configured, we shouldn't
run the quick AT probe (as a failure in the AT probe may also
trigger a +READY URC delay).

Just read the udev tag value early and complete the task if the delay
is not configured.
2018-05-08 09:51:19 +02:00
Matthew Starr
1a56b97061 ublox: use ID_MM_UBLOX_PORT_READY_DELAY udev flag as init delay
Added reading the ID_MM_UBLOX_PORT_READY_DELAY udev flag value and using
it as an init delay when a value is set.

The 20 second delay for the TOBY-L4 +READ URC has been reimplemented
using the new ID_MM_UBLOX_PORT_READY_DELAY udev value.
2018-05-08 09:43:15 +02:00
Matthew Starr
4895577597 u-blox: ignore non-AT ttyACM interfaces
For the TOBY-R2, LISA-R2, and LARA-R2, the only valid AT ports are
ttyACM0, ttyACM1, and ttyACM2.  All other ttyACM ports cause MM to
wait 20-30 seconds probing the port on startup.

Ignoring the non-AT ttyACM ports allows MM to not wait 20-30 seconds
probing and therefore startup much faster with these modems.
2018-04-30 18:29:39 +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
Aleksander Morgado
7e94928301 ublox: fix 'any' mode building
The 'any' mode refers to the mode which includes most access
technologies and where none of them is preferred.

Fix the logic so that all combinations with one technology preferred
over the others are ignored, instead of the other way around.

Fixes assertion with the 4G-only LARA R204.

    ModemManager[424]: <debug> [-192499452.090358] (ttyACM0): --> 'AT+URAT=?<CR>'
    ModemManager[424]: <debug> [-192499452.092150] (ttyACM0): <-- '<CR><LF>+URAT: (3)<CR><LF><CR><LF>OK<CR><LF>'
    **
    ERROR:ublox/mm-modem-helpers-ublox.c:817:mm_ublox_get_modem_mode_any: assertion failed: (any != MM_MODEM_MODE_NONE)

Reported-by: Matthew Starr <mstarr@hedonline.com>
2018-04-03 15:58:49 +02:00
Aleksander Morgado
3a7d4b1200 ublox: ignore ttyACM0 in the TOBY-L4
We used ttyACM0 as secondary port until now, just because we had an
extra AT capable TTY around in addition to the main control ttyACM2
port.

Turns out, using this ttyACM0 may actually break the connection setup
in the wwan interface in a bad way (e.g. not allowing DHCP setup).

The suggestion from u-blox and Intel is to fully ignore ttyACM0; and
given that we no longer need any primary/secondary port logic, we just
remove all the associated udev tags.
2018-03-09 18:42:51 +01:00
Aleksander Morgado
357b186134 ublox: ignore +PBREADY URCs
We don't want them to get in the way of our initialization phase:

    /org/freedesktop/ModemManager1/Modem/0 (device id 'c49ed59c4a411e923307330d3e1d82582cbfac37')
     -------------------------
     Hardware | manufacturer: 'u-blox'
              | model: 'unknown'
              | revision: 'TOBY-L4906
              | +PBREADY
              | 40.19_ENG0003'
              | H/W revision: 'unknown'
              | supported: 'gsm-umts, lte'
              | current: 'gsm-umts, lte'
2018-02-06 13:40:21 +01: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
Ville Skyttä
90b89bb9f4 *: Spelling fixes 2018-01-25 09:52:12 +01:00
Aleksander Morgado
d8c7251687 telit: use parent logic to load unlock retries
The generic broadband modem provides a common method to load unlock
retries based on CSIM queries. We modify the Telit plugin to use the
generic method but keeping the CSIM locking/unlocking logic in place.
2018-01-06 18:51:53 +01:00
Aleksander Morgado
30ea91e353 ublox: wait for READY URCs during port probing
The AT control TTYs in the u-blox modems may take some time to be
usable. In order to handle this issue, we configured some longer
timeouts during AT probing, but that may not be always enough.

The u-blox TTYs will report readiness via a "+AT: READY" URC, which
we can use during custom initialization to decide right away that the
port is AT. We use up to 20s as that is close to the worst case seen
during experimentation, happening after the module undergoes a full
NVM reset. If the timeout is reached without receiving the URC, we
still run standard AT probing afterwards. This new logic just tries
to make it sure we don't do any probing before the module is ready to
accept it.

If the module hasn't been hotplugged (i.e. it was already there when
ModemManager started) we do a quick first AT probing and if that fails
we run the "+AT: READY" URC wait as if it was hotplugged.
2018-01-04 10:09:24 +01:00
Colin Helliwell
8f26848ef0 helpers: move generic load_unlock_retries from Telit plugin
As a precursor to a generic load_unlock_retries method, move the
CSIM Response parser from the Telit plugin into the core code.
2018-01-01 18:37:10 +01:00
Eric Caruso
c44b928206 mm-iface-modem: add check_for_sim_swap method and enable steps
When in low-power mode, some modems will not dispatch unsolicited
notifications, such as for SIM hot swapping. There is code in
MMBroadbandModemTelit to handle this by checking the SIM identifier
during modem power up against the identifier cached in the SIM
D-Bus object. If they're different, the SIM has likely been
swapped while we were powered down.

We can move this code out to MMBroadbandModem because it doesn't
actually rely on any Telit-specific details, and invoke it from
MMIfaceModem via a new method.
2017-12-18 10:16:18 +01:00
Aleksander Morgado
33583ca4de kerneldevice: allow getting interface class/subclass/protocol 2017-12-05 10:58:29 +01:00
Aleksander Morgado
a4271d8433 mbm: port dial_3gpp() and disconnect_3gpp() to GTask
The two connection and disconnection methods are ported to GTask, and
are also updated so that the reception of the unsolicited message
reporting either connect/disconnection is able to right away complete
the pending connection/disconnection attempts, as done in other
plugins like the Icera or HSO ones.
2017-12-05 10:55:41 +01:00
Aleksander Morgado
4c8a3d0015 icera: port dial_3gpp() to GTask 2017-12-05 10:55:41 +01:00
Aleksander Morgado
09d563fd34 hso: make report_connection_status() a separate logical block
This block is a subclassed method from MMBaseBearer, which we just
happen to also use as part of the 3GPP dial logic in the connection
attempt.

So make it a separate logical block, and call the processing of the
connection attempt if one is found.

This change makes it similar to the same logic in the Icera plugin.
2017-12-05 10:55:41 +01:00
Aleksander Morgado
b6e3cb463d hso: use a 60s timeout to wait for connection unsolicited messages
Same amount of time as in the Icera plugin.
2017-12-05 10:55:41 +01:00
Aleksander Morgado
90116bf1be hso: port dial_3gpp() to GTask 2017-12-05 10:55:41 +01:00
Aleksander Morgado
d5684ff391 quectel: new plugin
For now just creating generic QMI/AT capable modems.
2017-12-05 10:55:24 +01:00
Aleksander Morgado
291300cfcb sierra: enable QMI connection status polling in Netgear AC341U
The Netgear AC341U seems to delay reporting packet service status
indications or actually not even send them. This leaves us with modems
in connected state in ModemManager but actually disconnected. We can
detect this situation by actively polling ourselves the connection
status.

See e.g. this case where the indication is received 2.5 mins after the
first OutOfCall error detected when loading statistics.

    Aug 30 22:52:50 ModemManager[574]: <info>  Modem /org/freedesktop/ModemManager1/Modem/0: state changed (connecting -> connected)
    Aug 30 22:52:50 ModemManager[574]: <info>  Simple connect state (8/8): All done
    Aug 30 22:52:50 ModemManager[574]: <warn>  Reloading stats failed: Couldn't get packet statistics: QMI protocol error (15): 'OutOfCall'
    Aug 30 22:53:20 ModemManager[574]: <warn>  Reloading stats failed: Couldn't get packet statistics: QMI protocol error (15): 'OutOfCall'
    Aug 30 22:53:50 ModemManager[574]: <warn>  Reloading stats failed: Couldn't get packet statistics: QMI protocol error (15): 'OutOfCall'
    Aug 30 22:54:20 ModemManager[574]: <warn>  Reloading stats failed: Couldn't get packet statistics: QMI protocol error (15): 'OutOfCall'
    Aug 30 22:56:21 ModemManager[574]: <info>  bearer call end reason (2): 'generic-client-end'
    Aug 30 22:56:21 ModemManager[574]: <info>  bearer verbose call end reason (3,2000): [cm] client-end
    Aug 30 22:56:21 ModemManager[574]: <info>  Modem /org/freedesktop/ModemManager1/Modem/0: state changed (connected -> registered)
2017-11-23 14:20:39 +01:00
Aleksander Morgado
17b8fcfd77 build: minor build rules reordering for the udev rules tester
Move it after all plugin build rules.
2017-11-11 13:39:16 +01:00
Ben Chan
965ff93041 novatel: port load_supported_modes to use GTask 2017-10-22 08:13:42 +02:00
Ben Chan
a20686c24c via: port modem_cdma_{setup,cleanup}_unsolicited_events to use GTask 2017-10-20 09:44:56 +02:00
Ben Chan
47cdad55a8 anydata: port get_detailed_registration_state to use GTask 2017-10-20 09:44:56 +02:00
Aleksander Morgado
882f6b04d6 cinterion: port modem_create_bearer to GTask 2017-10-07 14:10:12 +02:00
Aleksander Morgado
e9f56ddf15 cinterion: port after_sim_unlock to GTask 2017-10-07 13:58:55 +02:00
Aleksander Morgado
b1948f83a5 cinterion: port load_unlock_retries_context to GTask 2017-10-07 13:40:30 +02:00
Aleksander Morgado
e1b2b88e68 cinterion: port setup_flow_control to GTask 2017-10-07 13:40:30 +02:00
Aleksander Morgado
926e0176fb cinterion: port set_current_bands to GTask 2017-10-07 13:40:30 +02:00
Aleksander Morgado
ea58d35947 cinterion: port load_current_bands to GTask 2017-10-07 13:40:30 +02:00
Aleksander Morgado
c1e17b9cad cinterion: port load_supported_bands to GTask 2017-10-07 13:40:30 +02:00
Aleksander Morgado
7f2520a83d cinterion: port register_in_network to GTask 2017-10-07 13:40:30 +02:00
Aleksander Morgado
f9e2ebf3a0 cinterion: port modem_power_off to GTask 2017-10-07 13:40:30 +02:00
Aleksander Morgado
00aa9cd09b cinterion: port modem_power_down to GTask 2017-10-07 13:40:30 +02:00
Aleksander Morgado
73f748f7ac cinterion: port messaging_check_support to GTask 2017-10-07 13:40:30 +02:00
Aleksander Morgado
d09f9adafe cinterion: port messaging_enable_unsolicited_events to GTask 2017-10-07 13:40:30 +02:00
Aleksander Morgado
7e478e408d cinterion: port plugin custom_init to GTask 2017-10-07 13:40:30 +02:00
Ben Chan
6e68f4052b nokia: port load_access_technologies to use GTask 2017-10-07 10:56:33 +02:00
Ben Chan
d4abf79e99 nokia: port enabling_modem_init to use GTask 2017-10-07 10:56:33 +02:00
Aleksander Morgado
74d8a69b4e iridium: simplify a bit the saved_error logic in connect
Note that saved_error will be freed along with the context, unless
it's set to NULL.
2017-10-07 10:55:16 +02:00
Ben Chan
3c2b974bbd iridium: port connect to use GTask 2017-10-07 10:41:20 +02:00
Ben Chan
d0bbc43fa7 iridium: port load_operator_{code,name} to use GTask 2017-10-07 10:41:20 +02:00
Ben Chan
2768df24b4 iridium: port setup_flow_control to use GTask 2017-10-07 10:41:20 +02:00