Commit Graph

1516 Commits

Author SHA1 Message Date
Sergey Matyukevich 8492b722eb plugin: gemalto: enable netmon
Enable netmon functionality for Gemalto ELS81x modems.
2021-01-15 11:35:53 -06:00
Sergei Golubtsov 39f70c29d1 quectel: adding support for the Quectel EC200 USB modem series
Support for the Quectel EC200 USB modem series has been added. The model
identification AT command has been added as the first step in the
communication with a Quectel USB modem.
2021-01-07 23:21:32 -06:00
Sergey Matyukevich 97aea7414c plugin: gemalto: fix source of gprs notifications
Modem USB interface does not receive certain gprs context notifications.
Fix gprs chat: use Application USB interface to receive all the modem
notifications.
2020-12-22 10:34:48 -06:00
Lars Poeschel 285fad8f39 quectel: Power on/off with a gpio pulse
Current implementation uses a gpio level of 1 for powering on quectel
modems using a gpio and a level of 0 for powering off.
Normally quectel modems are powered on or off by a gpio pulse on their
PWR_KEY pin. They turn on by the first pulse and turn then off by the
next pulse. The pulse length varies between different modems.
For power on the longest I could in the quectel hardware is "more than
2 seconds" from Quectel M95 Hardware Design Manual.
For Quectel EC21 this is ">= 100 ms".
For Quectel MC60 this is "recommended to be 100 ms".
For Quectel UC15 this is "at least 0.1 s".
For power off the four modems in question vary between a minimum pulse
length of 600-700ms.
This implements a 2100ms pulse for power on and 750ms for power off.

If you have some special circuitry that powers your modem by gpio level
and you need the old behaviour, you can switch to gpio level powering
by setting environment variable OFONO_QUECTEL_GPIO_LEVEL. The gpio goes
to high level for the modem to power on and to low level if it should
power off.
2020-10-06 15:42:46 -05:00
Lars Poeschel 4a098c724a quectel: Extend power-on timeout
More complicated modems emerge and they need longer start-up times. An
EC21 takes about 13 seconds to boot up. This is slightly longer than the
20 * 500 ms we have at the moment. This extends the retries to 30, so we
have 30 * 500 ms and this does successfully power up an EC21 modem.
2020-09-29 09:22:45 -05:00
Pavel Machek 07e00b7215 droid 4: Add probing.
Probe Droid 4 modem. This should result in basic support working.
2020-09-15 10:24:37 -05:00
Lars Poeschel 23e1a56a47 xmm7xxx: Fix non compiling file
CC       plugins/xmm7xxx.o
../plugins/xmm7xxx.c:63:10: fatal error: dbus.h: No such file or directory
   63 | #include "dbus.h"
      |          ^~~~~~~~
compilation terminated.
2020-09-08 11:02:25 -05:00
Sergey Matyukevich 23c78bd316 plugins: gemalto: alternative gprs-context driver
Use alternative gprs context driver for gemalto modems
that provide USB ethernet interfaces for data path.
2020-08-19 09:50:44 -05:00
Sergey Matyukevich 71ceaf93fd plugins: udevng: detect gemalto network interfaces
Some gemalto modems, including ELS81x, may provide more than one
USB ethernet interface. Detect and save both network interfaces
rather than only the last one.
2020-08-19 09:50:41 -05:00
Shweta Jain d2fd1721f3 xmm7xxx-enable-esim-feature-in-xmm_ofono 2020-08-13 10:08:43 -05:00
Lars Poeschel a01613ad13 atmodem: Get strength and tech the quectel way on EC21
I had some trouble getting network strengh and access technology the
standard way on Quectel EC21. It does work - but only kind of. I did not
get URCs when I am sure I should. This way through CIEV, CIND and CMER
is also not documented in Quectel documentation, so I suspect this to be
unsupported.
This is now changed to the "quectelish" way of gettings those values and
this does work more fine-grained and reliable on the Quectel EC21.
2020-08-11 10:47:58 -05:00
Lars Poeschel 3401d9e29c Add a vendor OFONO_VENDOR_QUECTEL_EC2X
The distinction between OFONO_VENDOR_QUECTEL and
OFONO_VENDOR_QUECTEL_SERIAL does not suffice for EC21/EC25 in some
places, so introduce and use a new vendor:
OFONO_VENDOR_QUECTEL_EC2X
2020-08-11 10:47:36 -05:00
Lars Poeschel 446a5ae394 quectel: Try to update voltage only, when received "vbatt"
As there are some more sources of +QIND: activated, do now only update
voltage when we get the
+QIND: "vbatt",-1
but not on things like
+QIND: "act","LTE"
or
+QIND: "csq",20,99
2020-08-07 11:11:39 -05:00
Lars Poeschel ab8d482af1 quectel: Set URC port to uart1 on EC21
Set the URC port of the Quectel EC21 to uart1 when it is used through
it's serial port. This setting is saved to non-volatile storage by the
modem automatically.
2020-08-07 11:09:53 -05:00
Lars Poeschel a56976e2bb Revert "quectel: EC21 needs aux channel to be the first mux channel"
This reverts commit 1868dbf2b3.
Development for this was done on EC21 firmware version
EC21EFAR06A01M4G_BETA0318. It now turns out, that actual release
firmware versions for this modem again need the original mux order with
aux channel as the second mux channel. (We know for sure for firmware
version EC21EFAR06A03M4G.)
We do not know for sure when and for what firmware versions quectel did
the switch back on the mux order, but we suspect that the "BETA"
firmware is the only one with the reversed mux order. This "BETA"
firmware was only given out for development purposes and will not appear
"in the wild", so we revert the patch here and hope for the best.
2020-08-07 11:04:35 -05:00
Sean Nyekjaer e4d77210ea udevng: Add support for Quectel BG96 modem 2020-07-13 14:05:00 -05:00
Sergey Matyukevich 2807a5fe55 plugins: gemalto: enable LTE for ELS81x
Enable LTE atom for Cinterion ELS81x modems.
2020-06-29 10:20:01 -05:00
Sergey Matyukevich 28d4be1af2 plugins: udevng: detect Centirion ELS81x modem
Enable detection of Centirion ELS81x modem.
2020-06-29 10:20:01 -05:00
Jimmy Gysens ef7e5f016b huawei: send restore settings command on startup
When initializing a Huawei device, send the AT&F0 command to restore the
default AT settings on device restart.

Huawei stores all APN settings, which can cause issues when changing the
APN. The AT&F0 command makes sure the device starts from a clean state.
2020-06-25 11:36:20 -05:00
Lars Poeschel 1868dbf2b3 quectel: EC21 needs aux channel to be the first mux channel
The Quectel EC21 does only work correctly, if the mux channel used for
aux is the first mux channel. It does only put it's URC messages in the
first mux channel, so this has to be the aux channel in our case.
To be flexible on the mux order we introduce two arrays here, that then
contain the initialization data in their needed order.
Initialization data is then applied by for-looping over this array.
2020-05-26 22:22:09 -05:00
Lars Poeschel 8ce74ba07b quectel: EC21 add ussd with atmodem driver 2020-05-21 08:28:30 -05:00
Lars Poeschel c7de38491d quectel: EC21 does not understand AT+QIURC
Because the Quectel EC21 does not understand the AT+QIURC command, we
leave that out during initialisation.
2020-05-21 08:28:09 -05:00
Lars Poeschel debd73639a quectel: Query the model before setting up the mux
This is a change for the EC21. It will require specific handling before
and right after setting up the mux. So this change prepares this. It
queries the modem model before the mux (CMUX) is activated.
2020-05-21 08:24:40 -05:00
Lars Poeschel c121ccebc2 quectel: use lte atom on EC21 2020-05-21 08:24:37 -05:00
Lars Poeschel 3c158ceee9 quectel: Add Quectel EC21 to known serial modems
This adds the Quectel EC21 to the known modems of the quectel driver and
therefore allows to use it with its serial interface.
2020-05-21 08:24:29 -05:00
Denis Kenzior 8e78d4dba5 allowed-apns: Do not try to unregister unnecessarily
allowed-apns plugin will try to uregister the AllowedAccessPoints
interface whenever the sim state changes, even when not registered.
This results in the (benign) error being printed inside
ofono_modem_remove_interface:

Interface org.ofono.AllowedAccessPoints not found on the interface_list
2020-02-07 11:08:13 -06:00
Antara Borwankar f76e1d75d0 xmm7xxx: modified handling of XSIM states for xmm modems
+XSIM:7 state as defined in xmm7560 functional AT specification
only indicates ready for attach.

+CPIN: READY is received after SIM is completely initialized.
Also indicating readiness of Phonebook and SMS. Hence moving the
creation of SMS and Phonebook atom to xmm7xxx_post_sim function.

+XSIM:4 PUK needed state was not handled. It must be handled
same as PIN needed state. Added handling of this case to
switch_sim_state_status function.
2019-12-20 12:32:39 -06:00
Jimmy Gysens d7d49eb1d5 huawei: Fix infinite loop on modem removal
After unplugging a Huawei USB dongle, the 'atoms' in oFono are removed
via 'flush_atoms'.  Every atom has a destruct function pointer, used as
destructor.  This includes the gprs_context atom that is currently
active.

The function calls are:
flush_atoms -> destruct -> gprs_context_remove ->
at_gprs_context_remove -> modem_disconnect

Because the device is physically removed, the IO channel for the AT
port is gone.  In 'at_gprs_context_remove', there is an attempt to
resume communication over that AT port, but that is not possible. This
is detected, and 'io_disconnect' (pointer to 'modem_disconnect') is
called. 'modem_disconnect' has the same atom and tries to remove it
again, so it calls the same destructor.  This continues infinitely.

This patch moves the GPRS context removal so that it only happens if the
modem port could be re-opened successfully.  If the port cannot be
re-opened (in the case of modem removal), the atom is already in the
process of being removed by the process kicked off in flush_atoms.

This fix is limited to Huawei devices and has been tested using the
following devices:

- E3531i-2
- E3372
- E3531s-2
- E369
- E1552
2019-11-21 21:12:53 -06:00
Denis Kenzior a847ccf82c xmm7xxx: Remove unreachable statement 2019-11-13 17:01:15 -06:00
Martin Hundebøll ab9cb3b47c udevng: Support quectel MUX settings 2019-10-11 12:19:52 -05:00
Martin Hundebøll d0398b3965 quectel: support both internal and n_gsm muxes
The in-kernel implementation of gsm0710 causes deadlocks in the
kernel[1], so switch the default back to the user-space implementation
in ofono.

The change also removes the timeout-callback used to defer disabling the
n_gsm line discipline, as that is no longer needed[2]

To enable use of the kernel line discipline, add an udev env entry with
OFONO_QUECTEL_MUX="n_gsm".

[1] https://lore.kernel.org/lkml/4b2455c0-25ba-0187-6df6-c63b4ccc6a6e@geanix.com/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7030082a7415d18e3befdf1f9ec05b3d5de98de4
2019-10-11 12:19:20 -05:00
Martin Hundebøll ad73e590e2 quectel: rework sim detection
Use at_util_sim_state_query_new() to query the sim inserted state. Once
that returns, the locked state is queried by issuing a AT+CPIN? command.

If not locked, a timer is started to query the quectel init status of
the sim. Once the init status is ready, the sim atom is created, and the
modem is set to powered, and the sim is signaled both inserted, and
initialized.

If locked, the modem is set to powered, and the sim atom is created.
This allows users to enter the pin to unlock the sim. Once the sim is
unlocked, a +CPIN: READY indication is caught to query the quectel
init status. Once the init status is ready, the sim is signaled
initialized.

All the above is needed, because the modem indicated +CPIN: READY before
the sim is really ready. The only way to be certain, is to wait for the
quectel init status to be ready. Even signaling the sim inserted
prematurely can cause to modem to hang during the initial AT+CRSM
commands.
2019-10-11 12:10:21 -05:00
Antara Borwankar 26fb0623dc udev: Adding PCIe as a subsystem in udev
Adding support for enumerating PCIe types of modems in ofono
2019-09-30 11:28:34 -05:00
Martin Hundebøll c8fdff395a quectel: remove leftover reset of wakeup command 2019-09-26 16:38:52 -05:00
Jonas Bonn 93f03865f7 ublox: rework device initialization sequence
uBlox devices present their USB interfaces well before those interfaces
are ready to respond to any commands.  The documentation says to monitor
the 'greeting text' to detect readiness, but this 'greeting text' is not
actually specified for any device other than the TOBY L4.

What seems to work is to probe the device with 'AT' commands until the
device responds, and then to wait an additional second before
proceeding.  The TOBY L4 reliably sends its 'greeting text' (+AT: READY)
within this interval.

It would be more rigorous to actually wait for the 'READY' indication
for the TOBY L4, but that would require knowing the device model before
the device model is actually queried.  This is doable via the USB
product ID, but overkill when the above heuristic seems to work
reliably.

Before this patch, the ublox plugin was trying to achieve something like
the above with the g_at_chat_set_wakeup_command() function, but that had
some issues:

i)  it did not work reliably, in particular failing badly on the TOBY L4
with responses getting out of sync with commands
ii) it was an inappropriate use of the wakeup_command which is intended
for devices that may sleep when there is no communication during some
interval

This patch adds an init sequence that probes the device for readiness
before continuing with initialization.
2019-09-25 21:25:16 -05:00
Jonas Bonn 0b3c640971 ublox: use common close_devices when modem disabled
Just reshuffling the code a bit and the 'disable' path can use the
close_devices() helper to finish up.  This also prevents a bug should
the CFUN command fail to disable the modem whereby the 'aux' device
remains open but the 'modem' device has already been closed.
2019-09-25 21:25:16 -05:00
Jonas Bonn 4bf7671881 ublox: consolidate teardown in common function
The code for closing all the modem devices and flagging the modem as
unpowered is repeated several times in the driver... this patch puts
this code into a common helper for readability.
2019-09-25 21:25:16 -05:00
Jonas Bonn 4e4c209c0b ublox: raise call to open device 2019-09-24 09:57:39 -05:00
Richard Röjfors d57900b1cb plugins: quectel: Fix compiler warning
plugins/quectel.c: In function ‘quectel_pre_sim’:
plugins/quectel.c:1150:20: error: unused variable ‘sim’ [-Werror=unused-variable]
  struct ofono_sim *sim;
2019-09-24 09:53:45 -05:00
Martin Hundebøll 31cad076a4 quectel: handle sim states
The quectel M95 and MC60 modems are picky about when the sim is properly
initialized, so the logic to detect this needs to be in the quectel
plugin.

After doing basic initialization, a CPIN query is issued to detect sim
state.

If the sim is unlocked and ready, a timer is created to wait for the
modem state (AT+QINISTAT) to complete. At this point ofono is notified
about the initialized sim.

If the sim is locked, a listener for "+CPIN: READY" is set up to
know when a pin is entered. Once the indication is received, the timer
is set up as if the sim was unlocked from the beginning.

If the sim is busy/resetting, the CPIN query is issued again.
2019-09-10 08:41:12 -05:00
Martin Hundebøll 62e8e3c1e2 quectel: swap cmuxed ports
According to the manual, when using CMUX on the UC15, it outputs
unsolicited indications on port 2 (i.e. /dev/gsmtty2), so the quectel
plugin must use this when registering for such.
2019-09-02 16:25:43 -05:00
Martin Hundebøll bff7de9552 quectel: convert power event reasons to lower case 2019-08-13 05:48:47 -05:00
Martin Hundebøll 61cca1809a quectel: replace g_at_chat_set_wakeup_command() with g_at_chat_retry()
If the modem isn't powered on, the use of g_at_chat_set_wakeup_command()
makes ofono send out AT strings in an endless loop. Avoid this by using
g_at_chat_retry() in a timer instead.
2019-08-13 02:09:22 -05:00
Marcel Holtmann a4e7e8788a quectel: Add missing include for sys/socket.h 2019-08-12 20:02:34 +02:00
Martin Hundebøll 1107d3cbc3 quectel: implement dbus signals for modem power notifications
The Quectel modems issues unsolicited strings in case of power related
events. The UC15 uses +QIND: for the events, while M95 and MC60 uses
descriptive strings. (UC15 also uses a string for normal power down).

Register listeners for these strings/codes. The handler emits an
appropriate dbus signal, and closes down the modem if needed.
2019-07-22 02:40:00 -05:00
Martin Hundebøll 133233845e quectel: add dbus hardware interface
For now the interface only exposes the modem supply voltage, but is
added as a preparation for signaling power events.
2019-07-22 02:37:56 -05:00
Martin Hundebøll 9b681d7a27 quectel: pass vendor id to gprs and gprs-context
The gprs-context does special casing on the quectel serial modem when
probing the supported layer 2 protocols, so pass the vendor id when
setting up the atoms.
2019-07-19 10:34:32 -05:00
Jonas Bonn 2bb87d88ff udevng: detect LARA R2 series 2019-07-19 02:47:29 -05:00
Jonas Bonn a39944a5c0 ublox: use custom netreg atom 2019-07-19 02:45:10 -05:00
Jonas Bonn 3a53f140cc ublox: add SMS support 2019-07-19 01:43:23 -05:00