mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-08-09 11:15:27 +00:00
There is is an error in the way that the sock id is determined. A unique fd is reserved and assigned appropriatly, but the id, which should correspond to a socket number within the modem, is set to an invalid, and identical for all sockets, value, and then not used appropriatly in the drivers, instead, the sock_fd is used, which can be any value really, it is not related to the socket number in any way. This results in the drivers only working if the reserved fd happens to be between base_socket_num and (socket_len - 1) This patch assignes the id to the index of the socket + the base_socket_num, the socket at index 0 will get the id 1 if the base_socket_num is 1, and the modem_socket_from_id should then be used to get a pointer to the socket, since the id is not neccesarily equal to the index. The FIXME has been solved by adding a note both at the start of the modem_socket_get function and inside the Kconfig file for the MODEM_SOCKET option description. It is not an error, but the user must be aware that it uses the POSIX file descriptors, for which only 4 are allocated by default. This patch fixes the bug, without breaking the brittle modem drivers which currently are built around this bug. The modem drivers should be updated to use the id as the socket num instead of the sock_fd after this fix has been merged. The "socket # needs assigning" has been removed, as that is what this patch is doing I also added comments to the id and sock_fd in the modem_socket structure to help developers use the id and fd appropriately. Signed-off-by: Bjarki Arge Andreasen <bjarkix123@gmail.com> |
||
---|---|---|
.. | ||
CMakeLists.txt | ||
gsm_ppp.c | ||
hl7800.c | ||
Kconfig | ||
Kconfig.gsm | ||
Kconfig.hl7800 | ||
Kconfig.quectel-bg9x | ||
Kconfig.simcom-sim7080 | ||
Kconfig.ublox-sara-r4 | ||
Kconfig.wncm14a2a | ||
modem_cmd_handler.c | ||
modem_cmd_handler.h | ||
modem_context.c | ||
modem_context.h | ||
modem_iface_uart_async.c | ||
modem_iface_uart_interrupt.c | ||
modem_iface_uart.h | ||
modem_receiver.c | ||
modem_receiver.h | ||
modem_shell.c | ||
modem_socket.c | ||
modem_socket.h | ||
quectel-bg9x.c | ||
quectel-bg9x.h | ||
simcom-sim7080.c | ||
simcom-sim7080.h | ||
ublox-sara-r4.c | ||
wncm14a2a.c |