Commit Graph

8869 Commits

Author SHA1 Message Date
Martin Hundebøll d5bfc2ab41 gatmux: disable destroy notification on read watcher
With the reference in place in received_data(), the address sanitizer
now encounters a use-after-free when the destroy notification is
dispatched for the read watcher (see below).

Fix this by remove the destroy notification callback, as it isn't really
used except in the shutdown function.

==5797==ERROR: AddressSanitizer: heap-use-after-free on address 0x621000ac5904 at pc 0x55c1243b1f14 bp 0x7ffdef001340 sp 0x7ffdef001330
WRITE of size 4 at 0x621000ac5904 thread T0
    #0 0x55c1243b1f13 in read_watcher_destroy_notify ../git/gatchat/gatmux.c:660
    #1 0x7f08a8676742  (/usr/lib/libglib-2.0.so.0+0x62742)
    #2 0x7f08a867e2e4 in g_main_context_dispatch (/usr/lib/libglib-2.0.so.0+0x6a2e4)
    #3 0x7f08a8680210  (/usr/lib/libglib-2.0.so.0+0x6c210)
    #4 0x7f08a8681122 in g_main_loop_run (/usr/lib/libglib-2.0.so.0+0x6d122)
    #5 0x55c1243d6703 in main ../git/src/main.c:286
    #6 0x7f08a8423152 in __libc_start_main (/usr/lib/libc.so.6+0x27152)
    #7 0x55c1241fe1ad in _start (/home/martin/projects/ofono/x86/src/ofonod+0xfd1ad)

0x621000ac5904 is located 4 bytes inside of 4672-byte region [0x621000ac5900,0x621000ac6b40)
freed by thread T0 here:
    #0 0x7f08a88cc6b0 in __interceptor_free /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:122
    #1 0x55c1243b1ebf in g_at_mux_unref ../git/gatchat/gatmux.c:652
    #2 0x55c1243b062c in received_data ../git/gatchat/gatmux.c:276
    #3 0x7f08a867e2ce in g_main_context_dispatch (/usr/lib/libglib-2.0.so.0+0x6a2ce)

previously allocated by thread T0 here:
    #0 0x7f08a88cccd8 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:153
    #1 0x55c1243b1bf1 in g_at_mux_new ../git/gatchat/gatmux.c:613
    #2 0x55c1243b4b53 in g_at_mux_new_gsm0710_basic ../git/gatchat/gatmux.c:1172
    #3 0x55c124386abd in cmux_gatmux ../git/plugins/quectel.c:871
    #4 0x55c12438779f in cmux_cb ../git/plugins/quectel.c:1023
    #5 0x55c1243a368e in at_chat_finish_command ../git/gatchat/gatchat.c:459
    #6 0x55c1243a3bc8 in at_chat_handle_command_response ../git/gatchat/gatchat.c:521
    #7 0x55c1243a4408 in have_line ../git/gatchat/gatchat.c:600
    #8 0x55c1243a539e in new_bytes ../git/gatchat/gatchat.c:759
    #9 0x55c1243ae2f9 in received_data ../git/gatchat/gatio.c:122
    #10 0x7f08a867e2ce in g_main_context_dispatch (/usr/lib/libglib-2.0.so.0+0x6a2ce)

SUMMARY: AddressSanitizer: heap-use-after-free ../git/gatchat/gatmux.c:660 in read_watcher_destroy_notify
Shadow bytes around the buggy address:
  0x0c4280150ad0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4280150ae0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4280150af0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4280150b00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4280150b10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c4280150b20:[fd]fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c4280150b30: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c4280150b40: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c4280150b50: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c4280150b60: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c4280150b70: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==5797==ABORTING
2019-10-08 14:49:22 -05:00
Martin Hundebøll 1b4ee8dbb8 gatmux: take reference to mux object while processing incoming data
When closing down a cmux object, the address sanitizer detects a
use-after-free in gatmux.c (see below).

Avoid this by taking a reference to the mux object during the processing
in received_data().

ofonod[3640549]: ../git/plugins/quectel.c:cfun_disable() 0x610000000b40
ofonod[3640549]: ../git/plugins/quectel.c:close_serial() 0x610000000b40
ofonod[3640549]: ../git/plugins/quectel.c:close_mux() 0x610000000b40
ofonod[3640549]: ../git/examples/emulator.c:powered_watch() Removing modem 0x610000000b40 from the list
ofonod[3640549]: ../git/examples/emulator.c:powered_watch() Removing server watch: 106
ofonod[3640549]: ../git/src/modem.c:modem_change_state() old state: 0, new state: 0

=================================================================
==3640549==ERROR: AddressSanitizer: heap-use-after-free on address 0x62100073dd28 at pc 0x5566b6402a21 bp 0x7ffe7a2db0e0 sp 0x7ffe7a2db0d0
READ of size 8 at 0x62100073dd28 thread T0
    #0 0x5566b6402a20 in debug ../git/gatchat/gatmux.c:109
    #1 0x5566b6404bd7 in channel_close ../git/gatchat/gatmux.c:525
    #2 0x7fa0516e44a6 in g_io_channel_shutdown (/usr/lib/libglib-2.0.so.0+0x774a6)
    #3 0x7fa0516e4644 in g_io_channel_unref (/usr/lib/libglib-2.0.so.0+0x77644)
    #4 0x5566b64048a4 in watch_finalize ../git/gatchat/gatmux.c:474
    #5 0x7fa0516d6f6f  (/usr/lib/libglib-2.0.so.0+0x69f6f)
    #6 0x7fa0516ac6a7 in g_slist_foreach (/usr/lib/libglib-2.0.so.0+0x3f6a7)
    #7 0x7fa0516b277b in g_slist_free_full (/usr/lib/libglib-2.0.so.0+0x4577b)
    #8 0x5566b6403413 in dispatch_sources ../git/gatchat/gatmux.c:224
    #9 0x5566b64039ea in received_data ../git/gatchat/gatmux.c:268
    #10 0x7fa0516d727e in g_main_context_dispatch (/usr/lib/libglib-2.0.so.0+0x6a27e)
    #11 0x7fa0516d91c0  (/usr/lib/libglib-2.0.so.0+0x6c1c0)
    #12 0x7fa0516da0d2 in g_main_loop_run (/usr/lib/libglib-2.0.so.0+0x6d0d2)
    #13 0x5566b6429b1b in main ../git/src/main.c:286
    #14 0x7fa05147fee2 in __libc_start_main (/usr/lib/libc.so.6+0x26ee2)
    #15 0x5566b62531ad in _start (/home/martin/projects/ofono/x86/src/ofonod+0xfc1ad)

0x62100073dd28 is located 40 bytes inside of 4672-byte region [0x62100073dd00,0x62100073ef40)
freed by thread T0 here:
    #0 0x7fa0519256c0 in __interceptor_free /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:122
    #1 0x5566b64052d7 in g_at_mux_unref ../git/gatchat/gatmux.c:645
    #2 0x5566b63d6d19 in close_mux ../git/plugins/quectel.c:199
    #3 0x5566b63d7047 in close_serial ../git/plugins/quectel.c:223
    #4 0x5566b63db62a in cfun_disable ../git/plugins/quectel.c:1056
    #5 0x5566b63f6ae1 in at_chat_finish_command ../git/gatchat/gatchat.c:459
    #6 0x5566b63f701b in at_chat_handle_command_response ../git/gatchat/gatchat.c:521
    #7 0x5566b63f785b in have_line ../git/gatchat/gatchat.c:600
    #8 0x5566b63f87f1 in new_bytes ../git/gatchat/gatchat.c:759
    #9 0x5566b640174c in received_data ../git/gatchat/gatio.c:122
    #10 0x5566b64047b4 in watch_dispatch ../git/gatchat/gatmux.c:464
    #11 0x5566b640313b in dispatch_sources ../git/gatchat/gatmux.c:183
    #12 0x5566b64039ea in received_data ../git/gatchat/gatmux.c:268
    #13 0x7fa0516d727e in g_main_context_dispatch (/usr/lib/libglib-2.0.so.0+0x6a27e)

previously allocated by thread T0 here:
    #0 0x7fa051925ce8 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:153
    #1 0x5566b6405009 in g_at_mux_new ../git/gatchat/gatmux.c:606
    #2 0x5566b6407f6b in g_at_mux_new_gsm0710_basic ../git/gatchat/gatmux.c:1165
    #3 0x5566b63da9ba in cmux_cb ../git/plugins/quectel.c:882
    #4 0x5566b63f6ae1 in at_chat_finish_command ../git/gatchat/gatchat.c:459
    #5 0x5566b63f701b in at_chat_handle_command_response ../git/gatchat/gatchat.c:521
    #6 0x5566b63f785b in have_line ../git/gatchat/gatchat.c:600
    #7 0x5566b63f87f1 in new_bytes ../git/gatchat/gatchat.c:759
    #8 0x5566b640174c in received_data ../git/gatchat/gatio.c:122
    #9 0x7fa0516d727e in g_main_context_dispatch (/usr/lib/libglib-2.0.so.0+0x6a27e)

SUMMARY: AddressSanitizer: heap-use-after-free ../git/gatchat/gatmux.c:109 in debug
Shadow bytes around the buggy address:
  0x0c42800dfb50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c42800dfb60: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c42800dfb70: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c42800dfb80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c42800dfb90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c42800dfba0: fd fd fd fd fd[fd]fd fd fd fd fd fd fd fd fd fd
  0x0c42800dfbb0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c42800dfbc0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c42800dfbd0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c42800dfbe0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c42800dfbf0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==3640549==ABORTING
2019-10-08 14:45:42 -05:00
Richard Röjfors 78a5b4b735 ublox: netreg: Also subscribe to UREG URC's
It turns out that both L2xx and L4xx modems are a bit
buggy when it comes to send CREG URC's when the tech changes.
Try to overcome this by subscribing to both UREG and CREG,
and poll the other when any of the URC's are received.
Protect from doing simultaneous polls though.
2019-10-01 11:22:33 -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
Antara Borwankar b9da075d63 atmodem: CGDCONT handling for cid 0
Added handling for cid 0 in +CGDCONT callback.
2019-09-30 11:14:50 -05:00
Martin Hundebøll c8fdff395a quectel: remove leftover reset of wakeup command 2019-09-26 16:38:52 -05:00
Martin Hundebøll f8090396b8 atmodem: sim: remove quectel serial vendor quirk
The sim inserted/initialized state is handled properly in the quectel
plugin now, so remove the "auto-initialized" quirk from the atmodem
sim driver.
2019-09-26 16:38:39 -05:00
Martin Hundebøll c96031dda5 gprs: free interface name in gprs_context_remove() 2019-09-26 14:50:27 -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
Richard Röjfors 388248d6a1 ublox: network-registration: Check ureg for tech also for L2 modems
It seems like the CREG reporting from the L2 modems are quite
buggy. An example for a L210 where CREG reports UTRAN while
COPS and UREG reports LTE. A manual poll also indicates LTE.

I also found that the technology mapping was incorrect,
probably confused with enum packet_bearer.

A commented log showing where CREG is not trustable:

UREG indicates LTE
21:59:29 : < \r\n+UREG: 7\r\n
21:59:29 : < \r\n+CIEV: 9,2\r\n
21:59:29 : < \r\n+CGEV: NW MODIFY 1,0,0\r\n
21:59:31 : < \r\n+CIEV: 2,2\r\n
21:59:39 : < \r\n+CIEV: 2,3\r\n
21:59:44 : < \r\n+CIEV: 2,2\r\n
22:01:38 : < \r\n+CIEV: 2,3\r\n
22:01:43 : < \r\n+CIEV: 2,2\r\n

A CREG indicating UTRAN with HSDPA and HSUPA
22:29:39 : < \r\n+CREG: 5,"0000","00000000",6\r\n
22:29:39 : > AT\r
22:29:39 : < \r\nOK\r\n
22:29:39 : > AT+COPS=3,2\r
22:29:39 : < \r\n+CIEV: 9,2\r\n
22:29:39 : < \r\nOK\r\n
22:29:39 : > AT+COPS?\r

An immediate cops indicating LTE
22:29:39 : < \r\n+COPS: 0,2,"24007",7\r\n
22:29:39 : < \r\nOK\r\n
22:29:39 : > AT+CSQ\r
22:29:39 : < \r\n+CIEV: 2,4\r\n
22:29:39 : < \r\n+CSQ: 26,4\r\n
22:29:39 : < \r\nOK\r\n
22:29:39 : > AT+CGATT=1\r
22:29:39 : < \r\nOK\r\n
22:29:39 : > AT+COPS=3,0\r
22:29:39 : < \r\nOK\r\n
22:29:39 : > AT+COPS?\r

Another cops also indicates LTE
22:29:39 : < \r\n+COPS: 0,0,"Tele2",7\r\n <- 7: LTE
22:29:39 : < \r\nOK\r\n
22:29:39 : > AT+CGREG?\r

CGREG indicates unknown -> normal on LTE
22:29:39 : < \r\n+CGREG: 2,4\r\n
22:29:39 : < \r\nOK\r\n
22:29:44 : < \r\n+CIEV: 9,2\r\n
22:29:46 : < \r\n+CIEV: 2,2\r\n
22:56:23 : < \r\n+CIEV: 2,3\r\n
22:56:28 : < \r\n+CIEV: 2,2\r\n
22:59:40 : < \r\n+CIEV: 2,4\r\n

Manual poll shows we are running LTE
at+creg?
+CREG: 2,5,"2AFC","01DB0206",7

OK
2019-09-25 20:53:08 -05:00
Jonas Bonn 4e4c209c0b ublox: raise call to open device 2019-09-24 09:57:39 -05:00
Richard Röjfors 875eb23000 gprs: Do nothing on detached when attaching.
Its incorrect to fiddle with the driver attach state when
attaching. When attaching the state is transitioning,
and the correct state will now always be assigned in
the end of the attach process, regardless of result.
2019-09-24 09:55:38 -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
Richard Röjfors da871669a3 gprs: Only release detachable context on de-attach
Currently there is an issue if the attach state changes and
there are active contexts of which the driver does not
implement the detach_shutdown.
In that case we just release the context (clears CID and
active state), but nothing is signalled on D-Bus or towards
the modem.
Ofono is then out of sync with both the connection manager
and the modem, this manifests itself later on if the modem
changes state of the context, then ofono will not find it
since the CID is cleared, and the connection manager won't
be notified.
2019-09-20 10:52:40 -05:00
Richard Röjfors 336a5b4274 gprs: deattach driver when gprs status indicates unregistered
In the same way as we consider the driver attached when the
gprs status indicates we are registered, we should consider
it deattached when the status indicates unregistration.

If we don't, then we would not always recover from the case
when deattaching the driver fails. We would just revert back
the driver attached status to true, and "ignore" if the status
indicates the opposite when we check the registration status
afterwards.
2019-09-20 09:57:15 -05:00
Antara Borwankar f3a5016a67 xmm7modem: Fix to set gateway in pdp context
gateway was not being listed in context settings. Fixed teh bug
to show correct gateway address.
2019-09-20 09:54:50 -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 b73a681972 atmodem: sms: don't request URC buffering for Quectel UC15 modems
Add a vendor quirk to avoid an error being returned when setting up sms
notification for Quectel UC15 modems.
2019-09-04 07:23:46 -05:00
Richard Röjfors 2d868fac1f ublox: gprs: React on context deactivation
In case a context get deactivated when a AT+CGACT=0 is
not issued, indicate that to gprs core.
This can happen if the device has an auto activated
LTE context and modem switches over to for instance UTRAN.
2019-09-02 16:39:02 -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
Richard Röjfors 06de0c3067 gprs: Remove prior attaching state logic
Commit 1fd419e5b4 and
0167c3339c introduced logic that
treated ofono_gprs_cid_activated as an 'attaching' state.

Since gprs_attached_update now guarantees that we
will not get attached without having a context activated
in LTE, this is not needed anymore. It also potentially
interferes in case the driver was actually attaching.
2019-08-21 13:27:26 -05:00
Richard Röjfors b50ff27d3f gprs: Check for LTE in gprs_attached_update
Since we have a different condition for the attach state
when running on LTE, we should consider it in gprs_attached_update.
Previously it's done in some instances. But for instance if
the driver got detached from GPRS but now running on LTE with a
context up, we would be deattached.
2019-08-21 13:11:11 -05:00
Pavel Machek 30fd4b3e34 atmodem: introduce send_clcc() to reduce code duplication
Reduce code duplication by introducing send_clcc function.
2019-08-19 14:45:16 -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 cbd8a66e95 doc: convert quectel 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
Martin Hundebøll e69a30f1df gatchat: add g_at_chat_retry()
The current API doesn't support canceling an in-progress command;
instead g_at_chat_cancel() simply removes the callback.

In cases where the modem doesn't respond at all to a command, a chat is
simply stalled without any way to write new commands to the modem.

Support that case by adding a g_at_chat_retry() function to the API. The
function does nothing if the command is not yet in-progress, or if the
command is finished. Otherwise, it resets the bytes-written counter to
re-write the command string.
2019-08-13 02:09:09 -05:00
Richard Röjfors e3d5ac1f16 atmodem: Implement the list_activated_contexts callback
The callback calls cgact and cgdcont to get information
regarding any activate context.
2019-08-13 01:56:53 -05:00
Richard Röjfors 9a1b490e78 gprs: Ignore activated contexts during init, list them later
There is an issue if an context gets auto activated early,
then provisioning might not have run yet for instance,
so a "new" context is created, which might be duplicated
by a provisioning context later.
So ignore the activated contexts until gprs is ready,
then it calls the driver to list active contexts.
2019-08-13 01:41:16 -05:00
Richard Röjfors aea2ce4e18 gprs: Add list_active_contexts
This is useful for instance during startup where early
activated contexts can be listed at a suitable point in time.
2019-08-13 01:41:16 -05:00
Marcel Holtmann e0f62cdb7a atmodem: Remove the pointless #pragma once 2019-08-13 00:54:27 +02:00
Marcel Holtmann 702b2b533b gisi: Fix compiler warnings from -Wpragmas 2019-08-13 00:53:45 +02:00
Richard Röjfors 88ee0123ab gprs: Do not detach when running LTE and GPRS is unavailable.
There are cases where the gprs status might updated to for instance
"unknown" while LTE is the bearer.
In that case we should not set the attach state to FALSE,
since then running LTE the conext activation reflects the attached
state.
2019-08-12 15:45:40 -05:00
Marcel Holtmann f7fca8b662 Release 1.30 2019-08-12 20:54:02 +02:00
Marcel Holtmann 8b46671d5e build: Add missing drivers/atmodem/network-registration.h 2019-08-12 20:14:32 +02:00
Marcel Holtmann a4e7e8788a quectel: Add missing include for sys/socket.h 2019-08-12 20:02:34 +02:00
Marcel Holtmann a4e267cb3a build: Add internal copy of linux/gsmmux.h for older systems 2019-08-12 19:53:40 +02:00
Marcel Holtmann 80b1d6a6ee build: Add internal copy of linux/gpio.h for older systems 2019-08-12 19:46:17 +02:00
Marcel Holtmann 7c3e2728e3 gisi: Fix compiler warnings from -Waddress-of-packed-member 2019-08-12 19:38:06 +02:00
Marcel Holtmann fd69b05542 isimodem: Fix size calculation for address array 2019-08-12 19:36:42 +02:00
Richard Röjfors 5752702cbe gprs: Do not leak CID on failure to assign context 2019-08-07 17:10:17 -05:00
Richard Röjfors d4ced627e0 gprs: Use -1 as netreg status during init.
Previously the valid "unknown" netreg status was set
during startup, but its a bit problematic for gprs.
There might be cases where a LTE context is activated
before netreg is finished updating its status.
Resulting in gprs taking faulty actions.
Instead we set the status to -1 until we are updated
with a known value.
During the time the status is -1, gprs postpones actions until
the status is valid (>= 0).
2019-08-07 16:54:25 -05:00
Richard Röjfors cfac75a332 atmodem: Check for auto activated contexts during init
To detect if a context gets activated before we register
for unsolicited events we need to check if any is
already activated, and flag it auto activated.
2019-07-24 02:11:25 -05: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 b57fff4843 doc: document power-event signals for quectel Hardware API 2019-07-22 02:39:55 -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 311a04a178 doc: add documentaion for Quectel hardware API 2019-07-22 02:37:10 -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