Commit graph

387 commits

Author SHA1 Message Date
Sylvio Alves bda05fb51a drivers: wifi: esp32: remove pre-defined mbedTLS requirements
In #72651, build fails due to conflict when enabling mbedTLS components.
Current Wi-Fi implementation for ESP32 can discard those selected cryptos.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-05-16 18:54:43 -04:00
John Johnson 15a1b6d5c2 drivers: esp_at: make esp_pull_quoted() to only return -EAGAIN
If no " character is found in buffer by esp_pull_quoted() it
returns -EAGAIN which causes a loop that never ends. This is because
the buffer dont get filled up with new data so no " chrachter will be
found. This commit changes esp_pull_quoted() to only return -EAGAIN,
so the buffer can get filled with new data and thus the loop can come
to an end.

Signed-off-by: John Johnson <john.filip.johnson@gmail.com>
2024-05-15 14:59:03 +02:00
Marcin Niestroj 3431d09f09 drivers: wifi: esp_at: fix missing channel in scan result
WiFi scan results were not updated with information about channel, after
scan results parsing was updated. Fix that.

Fixes: a6b06004c2 ("drivers: wifi: esp_at: handle commas in SSIDs during
  scan and status")
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-04-12 16:51:52 -04:00
Marcin Niestroj 424ea9f5e4 drivers: wifi: esp_at: do not connect socket on bind(INADDR_ANY)
All connect() syscalls result in EISCONN error, since underlying
_sock_connect() is attempted to be called twice. Once from net_context.c'
bind_default() (with INADDR_ANY) as part of esp_bind() and second time as
part of esp_connect().

Do not call _sock_connect() from esp_bind(INADDR_ANY), which happens as
part of connect().

Fixes: dbf3d6e911 ("drivers: esp_at: implement bind() and recvfrom() for
  UDP sockets")
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-04-10 12:23:12 -05:00
Nazar Palamar a83d2dad8d wifi: airoc: remove dependency on CYHAL
Removing dependency on cyhal in airoc wifi driver.

It need to build airoc wifi driver with different than
PSoC 6 Soc like STM32

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2024-04-09 16:57:49 +02:00
Lucas Tamborrino fe57a12cf2 drivers: esp32: update to hal_espressif v5.1
Modify necessary drivers to meet updated hal.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-04-05 13:39:53 +02:00
Samy Francelet 4163ea0207 drivers: eswifi: Add option for maximum data size
Default MAX_DATA_SIZE might be too small depending
on application (e.g. handling the scan result with 12 APs detected)
Added config option for MAX_DATA_SIZE and warning for the user

Signed-off-by: Samy Francelet <samy.francelet@ik.me>
2024-03-15 15:16:27 -05:00
Jukka Rissanen 8860a81cfe drivers: Change drivers to support new IPv4 netmask setting API
Make sure that the drivers use the new IPv4 netmask setting API.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-03 18:58:29 +01:00
Marcin Niestroj a6b06004c2 drivers: wifi: esp_at: handle commas in SSIDs during scan and status
SSIDs can contains commas (,) when receiving scan results (+CWLAP) or
status (+CWJAP) over AT command from ESP-AT chip. This is in conflict with
modem subsystem argument parsing, which separates arguments automatically
whenever comma is encountered.

Use a direct modem command parsing, so that commas within quoted strings
are taken into account to be part of that string, instead of being treated
as delimiter.

This solves `wifi scan` and `wifi status` Zephyr shell commands output, for
networks containing commas (like "My_2,4GHz_AP") as part of SSID.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-02-28 18:02:44 +00:00
Marcin Niestroj de30757d21 drivers: wifi: esp_at: escape SSID and PSK
According to [1], SSID and PSK need to be escaped:

  Escape character syntax is needed if SSID or password contains any
  special characters, such as , or " or \

Implement character escaping to fix connection attempt to WiFi APs
containing special characters as part of SSID, like "My_2,4GHz_AP".
Increase "connect command" buffer length to handle worst-case scenario of
all the SSID and PSK characters being special characters.

[1] https://docs.espressif.com/projects/esp-at/en/release-v2.4.0.0/esp32/AT_Command_Set/Wi-Fi_AT_Commands.html#id6

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-02-28 18:02:44 +00:00
John Johnson dbf3d6e911 drivers: esp_at: implement bind() and recvfrom() for UDP sockets
Implement bind() and recvfrom() for UDP sockets. This is achived by
setting remote field in net_pkt which in return makes recvfrom() fill
in *src_addr. This is only implemented for passiv mode and CIPDINFO needs
to be enabled. Also set net_if to non-dormant when enabling AP mode to
make binding to a port and address possible.

Signed-off-by: John Johnson <john.filip.johnson@gmail.com>
2024-02-26 12:21:47 +01:00
Thomas Stranger ade3c72a35 drivers: wifi: esp_at: fix ssid_len calucation for AP query.
The driver seems to be designed to use the very last byte of the
buffer(scan, connect), so null terminating the status query
might have unintended consequences.
However we should not use strlen to determine the ssid_len,
to avoid depending on the following buffer(bssid) to be zeroed.
Related to CID 316354

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2024-02-16 10:15:37 -06:00
Jordan Yates ef21569ac9 wifi: conn_mgr connectivity bindings
Bind WiFi network devices to the generic WiFi connectivity backend if
the appropriate option is set.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2024-01-30 18:51:46 -05:00
Keith Packard 07943eae86 drivers/wifi/esp32: Remove _POSIX_C_SOURCE define as unneeded
This driver doesn't use any APIs outside of the Zephyr C library list, so
it doesn't need this _POSIX_C_SOURCE define.

Signed-off-by: Keith Packard <keithp@keithp.com>
2024-01-26 07:48:55 -05:00
Jordan Yates 7e7ab495c3 wifi: esp_at: compile without NET_NATIVE_IPV4
Allow the driver to compile without `CONFIG_NET_NATIVE_IPV4`. This can
happen if the driver is only desired for SSID scanning.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2024-01-17 14:42:19 +01:00
Chun-Chieh Li 173e4983fd drivers: wifi: esp_at: fix last rx data loss in Passive Receive mode
In Passive Receive mode, ESP modem will buffer rx data.
This fix makes the data still available to user,
even though the peer has closed the socket.
Otherwise, user will fail to get the last rx data,
when the socket is closed by the peer.

Signed-off-by: Chun-Chieh Li <ccli8@nuvoton.com>
2024-01-03 10:21:09 +01:00
Sylvio Alves b8d887f0e1 net: wifi: esp32: disable automatic reconnection on leaving
Automatic Wi-Fi station reconnection is forced even when
application requests disconnection. This PR adds a check
in the disconnection event reason to decide whether or not
perform the reconnection.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-12-11 09:57:02 +01:00
Marc Lasch afa1bd842c drivers: wifi: esp32: Mute implicit function declaration warning
Mute the function declaration warning, the compiler was emitting when
compiling the esp32 Wi-Fi driver with IPv4 disabled. The
net_dhcpv4_start() function was visible during compile time, even when
IPv4 was disabled.

Signed-off-by: Marc Lasch <mlasch@mailbox.org>
2023-12-05 10:22:30 +00:00
Marcin Niestroj 81c5727f27 drivers: wifi: airoc: drop default shell and sysworkq stack sizes
Those configuration settings should never be part of driver Kconfig file.
Drop them, since they can easily result in Kconfig symbol circular
dependency error.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-11-21 08:48:40 +00:00
Declan Snyder 4cc80097d3 drivers: wifi: include sockets headers
Some wifi drivers need internal sockets headers
included to build, put this in CMakeLists

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-11-21 08:48:04 +00:00
Krzysztof Chruściński 0f79f3a4c0 drivers: wifi: esp_at: Add dependency to UART runtime configuration
Force enabling of the UART runtime configuration for ESP AT driver.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2023-11-15 10:02:18 +01:00
Diogo Correia 21505c2c28 winc1500: WIFI_DISCONNECT request doesn't raise DISCONNECT_RESULT event
Internal flag (w1500_data.connecting) was not being set to false after
connection. Interface raises NET_EVENT_WIFI_CONNECT_RESULT event with
error status instead of NET_EVENT_WIFI_DISCONNECT_RESULT when
disconnection is manually requested (NET_REQUEST_WIFI_DISCONNECT).

Signed-off-by: Diogo Correia <diogo.correia@fraunhofer.pt>
2023-11-14 10:39:39 +00:00
Nazar Palamar 4fd732a738 drivers: wifi: added Infineon AIROC WIFI driver
Added initial version of Infineon AIROC WIFI  driver

Added initial version of binding file for Infineon AIROC WIFI
driver

Rename CONFIG_ABSTRACTION_RTOS_COMPONENT_ZEPHYR to
CONFIG_USE_INFINEON_ABSTRACTION_RTOS

Exclude cy8cproto_062_4343w platform from
drivers.modem.esp_at.build test

Change revision hal_infineon to
69c883d3bd9fac8a18dd8384624b8c472a68d06f

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2023-11-08 15:07:37 +00:00
Marek Matej d5a1a8bf04 drivers: wifi: esp32: Fix compilation error
Fix function declaration.

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2023-11-05 20:05:51 +01:00
Benedikt Schmidt a03f1010b8 drivers: fix thread function signatures
Fix thread function signatures to avoid stack corruption on thread exit.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-10-30 12:24:34 +01:00
Benedikt Schmidt 49ce054200 drivers: adc: fix thread function signatures
Fix the data acquisition thread function signatures to avoid a stack
corruption on thread exit.
Fixes #62637

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-10-30 12:24:34 +01:00
Jukka Rissanen 493fe169a8 drivers: eswifi: Fix the SSID copying
The wrong ssid_len was used which causes build error.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2023-10-10 15:50:22 +03:00
Flavio Ceolin ea109f6a20 drivers: eswifi: shell: Fix possible overflow
Limit the copied data to the buffer's size.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-10 11:41:49 +02:00
Flavio Ceolin 2504329b76 drivers: eswifi: Fix possible buffer overflow
Limit the number of the copied ssid to WIFI_SSID_MAX_LEN
and avoid a possible one byte overflow.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-10 11:41:49 +02:00
Anas Nashif 6d23a960db lib: os: build fdtable conditionally
Stop building fdtable by default, make it conditional and build it only
when needed.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-09-28 06:25:16 -04:00
Diogo Correia 168791e08a winc1500: fix undefined declarations
LOG_LEVEL > LOG_LEVEL_OFF guards were protecting a couple of function
declarations. These functions were being used without taking this fact
into consideration. These guards are now applied around the stack_stats()
function only.

Signed-off-by: Diogo Correia <diogo.correia@fraunhofer.pt>
2023-09-06 11:44:20 +02:00
Chien Hung Lin cad51f874c driver: wifi: eswifi: Fix spi buffer length
The eswifi spi driver sets up spi buffer length as number of frames,
but the length shall be number of bytes. Because eswifi use 16 bit as
frame size, so this turns out reading and writing half of data and
fails to sending any at command request and getting any responds from
eswifi module.

Fix it by setting up length as number of bytes.

Fixes #62056

Signed-off-by: Chien Hung Lin <chienhung.lin.tw@gmail.com>
2023-09-05 10:05:37 +02:00
Robert Lubos c7c86de621 drivers: wifi: Prevent CMake warnings for out-of-tree drivers
When Ethernet or Wi-Fi subsystems are enabled, but no driver source
files are provided in the Zephyr source tree (which is the case for
out-of-tree drivers), CMake throws warnings about empty libs, for
example:

  No SOURCES given to Zephyr library: drivers__ethernet
  No SOURCES given to Zephyr library: drivers__wifi

This commit sets ALLOW_EMPTY property for those libraries, to allow for
seamless out-of-tree drivers integration.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-09-02 15:09:24 +02:00
Fabio Baltieri 2a2b314fc4 drivers: fix few mismatched CONTAINER_OF
Fix few mismatched CONTAINER_OF, one missing k_work_delayable_from_work
conversion and few cases where the target should be pointing at the
first element explicitly.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-30 10:21:23 +02:00
Nick Ward 2d65acca3a drivers: gpio: use gpio_is_ready_dt helper function
Update `struct gpio_dt_spec` use with gpio_is_ready_dt()

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-08-28 08:48:35 -05:00
YuLong Yao 0ad0dea200 driver: wifi: esp32: fix esp32_wifi_send not work in ap mode
use `ESP_IF_WIFI_AP` when call esp32_wifi_send in ap mode

Signed-off-by: YuLong Yao <feilongphone@gmail.com>
2023-08-16 14:56:27 +02:00
YuLong Yao af0583d87d driver: wifi: esp32: enable iface when enable ap mode
when ap mode is enable,
we don't enable iface by `net_eth_carrier_on` before,
this will cause wifi tx error.

this patch fix this issues.

Signed-off-by: YuLong Yao <feilongphone@gmail.com>
2023-08-09 08:34:56 +00:00
YuLong Yao 28f5366e0e drivers: wifi: esp32: choose channel 0 by default
When channel set to WIFI_CHANNEL_ANY, ap will not work.
This patch choose channel 0 when channel is WIFI_CHANNEL_ANY.

Signed-off-by: YuLong Yao <feilongphone@gmail.com>
2023-08-09 08:32:39 +00:00
Sylvio Alves 41f16c3dd7 driver: wifi: esp32: increase default stack values
When testing Wi-Fi with MQTT/HTTP/Socket features,
network stacks can be full very fast, causing network issues
and eventual crash.

By analyzing used stacks,increasing the stack size described
in this PR fixes most use cases related above.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-07-27 10:17:53 +02:00
Chaitanya Tata a132487fec net: wifi: Move Wi-Fi ops to a separate struct
Decouple interface and Wi-Fi APIs, Wi-Fi APIs are common independent of
Wi-Fi offload or implemented natively (This is preparation for
introducing Native Wi-Fi).

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2023-07-11 14:55:30 +02:00
Jordan Yates 3a10923bbf drivers: wifi: esp_at: use dormant states
Update ESP AT modem driver to control the network interface dormant
state based on the network connection status, as described in the docs.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-07 09:16:31 +02:00
Jordan Yates 21ed808ba1 drivers: wifi: esp_at: handle external reset sources
Add an option that signifies that the ESP modem may be reset at the same
time as the SoC by an external source. When this is the case, we first
wait for an unsolicited "ready" message from the modem, before
attempting to reset the device. This prevents two initialisation
sequences attempting to run at the same time.

We still want to wait for the complete initialisation sequence to
complete before returning in this case.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-05 14:14:51 +02:00
Jordan Yates 542aec673d drivers: wifi: esp_at: don't disable carrier in init
Don't unconditionally set the carrier to the off state in
`esp_iface_init`, as this is already done in `esp_reset` and the
function may be called after the modem has already completed the init
sequence and called `net_if_carrier_on`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-05 14:14:51 +02:00
Jordan Yates 91d6561bf4 drivers: wifi: esp_at: wait for init again
Wait for the init process to finish again, previously removed in
a8e6fc0b83. The original reasoning (deadlock with net interface locking)
no longer applies now that `esp_reset` is called in the device init
function, not in `esp_iface_init` (332a6f084a).

Without this change, if `reset-gpios` or `power-gpios` is set,
`device_is_ready` will return true even if the chip has fallen off the
board, as no communication is validated with the board.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-07-05 14:14:51 +02:00
Marek Matej 6e72e401f2 drivers: wifi: Fix esp32 driver
Fix compilation issue on esp_wifi_drv.

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2023-07-04 15:28:03 +02:00
Ajay Parida 69fead1998 net: mgmt: Support for forced Passive scan
Default scan mode is Active. User can force the scan mode to passive
through Kconfig option or using 'passive' option from shell.
Using either of this option will override regulatory settings and
forces all scan channels to be passive only.

Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
2023-06-29 21:05:41 +02:00
Chaitanya Tata 7987098497 drivers: wifi: Register Wi-Fi architecture type
Identify the Wi-Fi capability to the networking stack and also the type
of Wi-Fi (Native vs Offloaded), this helps identifying Wi-Fi interfaces
that can be used by applications.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2023-06-26 16:12:32 +02:00
Sylvio Alves cc3ba0cd1a driver: wifi: esp32: add wifi statistics info
Adds Wi-Fi statistics feature.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-05-11 10:05:04 +02:00
Sylvio Alves 0b32c1f851 driver: wifi: esp32: add status information
Adds Wi-Fi driver connection status details.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-05-11 10:05:04 +02:00
Gerard Marull-Paretas 667eeb11fb shell: fix MISRA 5.7 violations on struct shell
MISRA Rule 5.7 requires uniqueness of tag identifiers. Shell is
frequently problematic because many code uses `const struct shell
*shell`. This causes CI noise every time one of these shell files is
edited, so let's update all of them with `const struct shell *sh`
instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-14 12:21:08 +02:00