Fix variable declaration so that this driver will compile with clang,
which does not support variable declarations within switch statements
Signed-off-by: Daniel DeGrasse <ddegrasse@tenstorrent.com>
Recent changes to net_link_addr structure to not use pointers
have made it necessary to update the modem_cellular driver
to ensure compatibility with the new structure definition.
Otherwise, an assertion failure occurs in subsys/net/l2/ppp/ipv6cp.c:40.
This commit updates that link address is set to NET_LINK_ADDR_MAX_LENGTH
least significant bytes of IMEI instead of IMEI total length.
Signed-off-by: Jani Hirsimäki <jani.hirsimaki@nordicsemi.no>
Remember which DNS server was added by a source like DHCPv4 or v6
message. This will allow system to remove DNS servers that were added by
that source. Then when stopping for example DHCP, we can remove those
specific DNS servers and not leaving DNS servers hanging in the system.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
SIM-cards remember which networks has rejected attach attempts. This is
not always desired if the user has control over which networks to allow.
This commit adds a Kconfig symbol which enables clearing of saved
forbidden networks from SIM-card on boot.
Signed-off-by: Emil Lindqvist <emil@lindq.gr>
U-blox LARA-R6 LWM2M client is enabled by default. Not only causes this
the modem to connect to U-blox's server on its own, it also for some
reason causes the modem to reply "Destination unreachable" to DNS answers
from DNS requests that we send
Signed-off-by: Emil Lindqvist <emil@lindq.gr>
Instead of using 32 bit enum values for event numbers, convert
the code to use 64 bit long bit fields. This means that the
user API is changed to use 64 bit event values instead of 32
bit event values.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Add support for the simcom a76xx modem which is similar to the simcom 7080
but has a few key differences. Tested with a simcom A7672SA module but as
there is a single simcom A76XX AT commands manual, the driver should work
with other modems of the series.
Signed-off-by: Olivier Lalonde <o@syskall.com>
Fix regression introduced by dormant state, where the
carrier does not get closed when Cellular Modem driver
is suspended.
Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
Previously, it was expected that the modem would immediately
disconnect and close the PPP link, when the network was lost
(+CEREG: 4 is received). Failure to do so, would result in
modem attempting to chat with dlci2 channel, where as cellular
modem driver would drop to dlci1. This would show as dial
script timing out, which would freeze cellular modem driver.
Adding dormant state enables graceful disconnection of PPP-link
when the network is lost. This allows the modems which do
not automatically close with network link loss to close
based on PPP link closure.
Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
Use the new modem command send_data_nolock function where it was
previously just written directly to the interface.
Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Add helper function to send data on modem command handler interface.
This makes sure that when verbose logging is enabled all data is
actually logged.
Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Fix possible race condition, reset the response semaphore before we send
any data. In case we don't get scheduled back before the response is
processed.
Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Allow configuring MTU for CMUX.
Some AT manual and specification define this as a
frame size. Linux ldattach default to 127 bytes,
3GPP TS 27.010 defaults to 31.
We should limit our CMUX frames to a size that
remote end is capable of handling.
Linux silently drops oversized frames.
Also, remove MODEM_CELLULAR_CMUX_MAX_FRAME_SIZE as
this was only limiting a buffer sizes, and resulted
CMUX frames to be capped to same value.
Use MODEM_CMUX_WORK_BUFFER_SIZE and MODEM_CMUX_MTU instead.
Also rename CONFIG_MODEM_CELLULAR_CHAT_BUFFER_SIZES to
CONFIG_MODEM_CELLULAR_CHAT_BUFFER_SIZE as it is now
only used as a Chat module. DLCI pipes use
CONFIG_MODEM_CMUX_WORK_BUFFER_SIZE.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
When sleep modes are used, sockets are restored from NV after boot.
If the network changes IP addresses, restore sockets maintain old network
info in the HL7800 firmware.
On boot, restored sockets should be closed to ensure new sockets
are created with updated network info.
Signed-off-by: Ryan Erickson <ryan.erickson@ezurio.com>
Update AT command API to return a response.
Add param to set the timeout when waiting for a response.
If the user does not desire a response, the response buffer can
be NULL.
Signed-off-by: Ryan Erickson <ryan.erickson@ezurio.com>
All other APIs that need to reset the modem do so in an async way.
Make the rest API async as well.
This fixes issues where modem events related to the reset
were not generated properly.
Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
Ensure the proper byte order is used for the network socket in the stack.
When sending the AT commands, the port needs to be converted to
host endianess.
TLS handshakes check that the remote address and port match
what is expected.
Signed-off-by: Ryan Erickson <ryan.erickson@ezurio.com>
Fix bug in modem_socket where an unallocated object can be returned
for file descriptor zero before the object has been used one time.
Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Modem socket does not build with NET_SOCKETS enabled.
Referencing socket_data in struct net_context.
Signed-off-by: Joakim Andersson <joerchan@gmail.com>
`+C*REG:` may be received as AT read command answer
or unsolicited notification.
Their syntax differs, and even the overall parameter count varies
depending on what `<n>` is used in the `AT+CEREG=` write command.
To handle all cases properly, check the parameter count and
the presence of the `<tac>` parameter (which is a string and
thus begins with `"`) to figure out what is the position of `<stat>`.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
Add support for the Telit ME310G1 LTE modem which is very similar to
the ME910G1. Re-use the ME910G1's AT command scripts but rename
them to mex10_xx and define a shutdown script (AT#SHDN).
Signed-off-by: Niklas Gürtler <niklas.guertler@e-obs.de>
Add support to define a shutdown script for cellular modems, i.e.
AT commands to shutdown the modem. This allows to shutdown the
modem much quicker compared to using a power pulse which saves power.
Signed-off-by: Niklas Gürtler <niklas.guertler@e-obs.de>
CONFIG_ZVFS_POLL_MAX is now used to control the maximum number of poll()
entires. Thereby, CONFIG_NET_SOCKETS_POLL_MAX is redundant and shall
be deprecated.
Modify the defaults for NET_SOCKETS_POLL_MAX and ZVS_POLL_MAX so that
the deprecation actually makes sense instead of symbol removal. In case
the application still sets the old config, it will modify the
ZVS_POLL_MAX default.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Move the network buffer header file from zephyr/net/buf.h to
zephyr/net_buf.h as the implementation now lives outside of the networking
subsystem.
Add (deprecated) zephyr/net/buf.h header to maintain compatibility with old
file path.
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
It has been observed that using a CMUX max frame size of 127
causes FCS errors; smaller or larger works. This commit sets the max
frame size to the modem's default value.
Signed-off-by: Emil Lindqvist <emil@lindq.gr>
U-Blox LARA-R6 was added to modem_cellular, and an additional state
was introduced where the UART baudrate is changed if the modem supports
it
Signed-off-by: Emil Lindqvist <emil@lindq.gr>
The OK response should be processed before entering CMUX mode.
Use UART ISR mode by default.
Fix warnings and errors produced by the sample.
Signed-off-by: Ryan Erickson <ryan.erickson@ezurio.com>
Introduced `MODEM_CELLULAR_DEFINE_INSTANCE` macro to streamline
the definition and initialization of modem cellular instances.
This macro enables passing parameters that vary among modems, including:
`power_pulse_duration_ms`, `reset_pulse_duration_ms`, `startup_time_ms`,
`shutdown_time_ms`, `autostarts`, `init_chat_script`, `dial_chat_script`
and `periodic_chat_script`.
This will reduce the number of redundant lines in the code, aiming for
improved maintainability.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Introduced the `MODEM_CELLULAR_DEFINE_AND_INIT_USER_PIPES` macro to
consolidate multiple user pipe data definitions into a single macro call.
This will reduce the number of redundant lines in the code, aiming for
improved maintainability.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Set the remote address of received sockets.
This is necessary for services that rely on the remote address.
DNS relies on the remote address to be set properly.
Signed-off-by: Ryan Erickson <ryan.erickson@ezurio.com>
For each of the fdtable.h functions listed below, convert the
z_ prefixed semi-private functions to use the zvfs_ prefix.
ZVFS stands for Zephyr Virtual File System and
is intended to be a common library used by the C library,
POSIX API, Networking, Filesystem, and other areas.
There are already a few functions in fdtable.h that use the
zvfs_ prefix, so this change is mostly about unifying them in
a way that uses a suitable prefix ("namespace") so that it can
be considered a public API.
- z_alloc_fd
- z_fdtable_call_ioctl
- z_finalize_fd
- z_finalize_typed_fd
- z_free_fd
- z_get_fd_obj
- z_get_fd_obj_and_vtable
- z_get_obj_lock_and_cond
- z_reserve_fd
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
The supported modems don't have the same number or assignment
of DLCI channels. For example, the NRF91_SLM only has DLCI
channel 3 assigned to GNSS tunneling, where the ublox sara r5
has DLCI 3 assigned to an additional AT channel, and DLCI 4
assigned to GNSS tunneling.
This commit updates the creation and assignment of DLCI
channels and pipelinks to match the capabilties of each modem.
Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
Fill-in the mode field of the fd_entry so that the
implementation can be made aware that the specific file
descriptors created are sockets.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Add AT shell which uses the newly exposed pipes to
send/receive at commands from the modem identified by the
chosen node zephyr,at-shell.
To send an AT command, the shell command at is used, followed
by the command to send, and an optional response which
overwrites the default "OK"
For example, sending "AT", which returns "OK"
modem at at <- command
OK <- response
Enabling echo, then sending "AT" which will now return "AT" + "OK"
modem at ati1 <- command
OK <- response
at at <- command
at <- response
OK <- response
Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
Add two DLCI channels to the cellular modem driver, and expose
them using the modem pipelink module.
Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>