Snprintf calls should be avoid when not necessary, instead snprintk
should be used as it offers the same functionnalities at a lower cost
in flash.
Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
Position over LTE (PoLTE) can be used to locate a device as
an alternative to GNSS.
Increase RX thread stack size for PoLTE processing.
Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
Allow application control for starting modem driver.
This allows network attach to be randomized.
Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
For low power operation, set the IP connection reconfig
flag when receiving a startup report.
This will ensure the GPRS connection is reconfigured
before any socket operations take place.
Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
Allow the driver to run if a SIM card is not present.
This allows public HL7800 APIs like firmware updates
to be used even if no network is available.
Remove duplicate query ICCID command.
Signed-off-by: Andrew Hedin <andrew.hedin@lairdconnect.com>
bugfix: NULL termination is required by
dns_resolve_reconfigure API so null terminate the DNS
server list.
Fix checkpatch warning.
Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
net_buf_skipcrlf() will remove all \r\n characters from the buffer.
If the data after CONNECT\r\n contained \r or \n it would
be removed, resulting in dropped data.
Fix this to only remove two bytes to ensure data is not dropped.
Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
Change socket RX trailer (EOF) missing to warning and
keep socket RX data instead of discarding.
Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
It should be "u-blox,sara-r4", because the vendor prefix for this
company is "u-blox", not "ublox".
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
According to the documentation the OFF state has to be used when the
devices is fully turned off, ie, power removed. Most drivers were using
a sort of fall-through for all non-active states, leading to behaviors
not following the specifications.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The verb tense for the suspended state was not consistent with other
states. The likely reason: state was being used as a command/action.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
The difference between low power and suspend states is a thin blur line
that is is not clear and most drivers have used indistinctly. This patch
converges to the usage of the suspend state for low power, since
contrary to the low power state, it is used by both system and runtime
device PM. The low power state is still kept, but its future is unclear
and needs some discussion.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
When building tests/drivers/build_all/modem on native_posix_64 we get:
modem_cmd_handler.c:545:9: error: ret may be used
uninitialized in this function
[-Werror=maybe-uninitialized]
Fix by adding simple initialization of ret = 0 at start of function.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
There are currently modem_cmd_send() and modem_cmd_send_nolock()
functions, each with slightly different behavior regarding acquiring (or
not) sem_tx_lock. Introduce a generic function that will allow caller to
select behavior using flags.
While at it, add possibility to disable setting and unsetting command
handlers. This will be useful in situations when there are multiple
replies expected one after the other coming as a response to single
command. This is the case for example with ESP-AT driver, which expects
following data as response to AT+CIPSEND command:
OK
>
where 'OK' is handled by static CMD_RESP (so releasing response
semaphore right away), while '>' is handled by dynamic
CMD_HANDLER (which is releasing another semaphore). Keeping command
handlers in place allows to receive '>' without race condition because
of small period of time where command handlers are not set.
Convert modem_cmd_send_nolock() and modem_cmd_send() to static inline
functions, as they are just a specific invocation of
modem_cmd_send_ext() function.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
So far modem API used UART device names / labels. Change API to operate
on device pointers instead, so that we stop using device_get_binding()
in modem core and in some DT compatible modem drivers.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
This PR addresses radio signal stength measurement during
and before PPP session. The PR provides provides facility
of readout for both +CSQ and +CESQ versions depending
upon the modems. This PR follows the idea of rssi readout
of PR#35496. Additionally, reliable Cell info update
is also ensured.
Signed-off-by: Tahir Akram <mtahirbutt@hotmail.com>
The callback is not used anymore, so just delete it from the pm_control
callback signature.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
We do not need the return value of k_sem_take() so ignore it.
Coverity-CID: 236602
Fixes#36313
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Query the numerical network operator id, location area code (LAC)
and cell id. Following AT commands are used:
AT+COPS?
AT+CEREG?
Functionality is enabled by CONFIG_MODEM_CELL_INFO=y.
Tested with uBlox SARA-R410M-02B.
Signed-off-by: Hans Wilmers <hans@wilmers.no>
Query the numerical network operator id, location area code (LAC)
and cell id. Following AT commands are used:
AT+COPS?
AT+CEREG?
Functionality is enabled by CONFIG_MODEM_CELL_INFO=y.
Tested with uBlox SARA-R410M-02B.
Signed-off-by: Hans Wilmers <hans@wilmers.no>
Implement numerical network operator id, location area code (LAC)
and cell id in modem context and modem shell.
Please note that the functionality to query these values must be
implemented in the modem driver.
Signed-off-by: Hans Wilmers <hans@wilmers.no>
The reboot option of the +KSRAT command is only
supported by newer firmware.
Add a check to determine what version of the command
to use when setting the RAT.
Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
The default behavior of the +KSRAT= command has
changed to not reboot the HL7800.
Adjust the command so the reboot takes place properly.
Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
If the modem drivers are built on a 64-bit platform we get errors with
the logging code due to use of size_t. Update to use %zX to handle this
correctly between 32-bit and 64-bit platforms.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Remove reset pin requirement from devicetree as this
is not required for modem functionality, and is not
used in the driver anyways.
Signed-off-by: Emil Lindqvist <emil@lindq.gr>
If modem receives an IPv6 address, buffer overrun
would occur. Fix this by checking string length to
ensure what type of IP address needs to be parsed.
Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
Use recently introduced API, which takes care of gracefully closing any
pending DNS requests and replacing existing DNS server list with new
one.
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Replace all existing deprecated API with the recommended alternative.
Be aware that this does not address architectural errors in the use
of the work API.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
In a previous commit, a check was added to ensure modem was properly
attached to packet service before initializing PPP. Failure to perform
this check can lead to the dreaded 'NO CARRIER' issue.
While this is a nice idea, the implementation was lacking because when
the check failed, the entire modem initialization procedure was
restarted from square one. For modems/bearers that were slow to attach,
this is potentially disastrous. The proper solution is to loop only the
'AT+CGATT?' part until it succeeds, or fails N times.
This commit implements this looping behavior (using the work queue).
Signed-off-by: Benjamin Lindqvist <benjamin.lindqvist@endian.se>