Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions drivers/wifi/eswifi/eswifi_socket_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ LOG_MODULE_DECLARE(LOG_MODULE_NAME);
#include <stdlib.h>
#include <errno.h>

#include <zephyr/posix/fcntl.h>
#include <zephyr/net/socket_offload.h>
#include <zephyr/net/tls_credentials.h>

Expand Down Expand Up @@ -391,8 +392,9 @@ static ssize_t eswifi_socket_recvfrom(void *obj, void *buf, size_t len,
socklen_t *fromlen)
{
if (fromlen != NULL) {
errno = EOPNOTSUPP;
return -1;
int sock = OBJ_TO_SD(obj);
struct eswifi_off_socket *socket = &eswifi->socket[sock];
*from = socket->peer_addr;
}

return eswifi_socket_recv(obj, buf, len, flags);
Expand Down Expand Up @@ -514,6 +516,10 @@ static int eswifi_socket_poll(struct zsock_pollfd *fds, int nfds, int msecs)
return -1;
}

if ((fds[0].events & ZSOCK_POLLOUT)) {
fds[0].revents = ZSOCK_POLLOUT;
}

if (!k_fifo_is_empty(&socket->fifo)) {
goto done;
}
Expand All @@ -527,7 +533,7 @@ static int eswifi_socket_poll(struct zsock_pollfd *fds, int nfds, int msecs)
ret = k_sem_take(&socket->read_sem, timeout);
if (ret) {
errno = ETIMEDOUT;
return -1;
return 0;
}

done:
Expand Down Expand Up @@ -604,6 +610,12 @@ int eswifi_socket_create(int family, int type, int proto)
static int eswifi_socket_ioctl(void *obj, unsigned int request, va_list args)
{
switch (request) {
case F_GETFL:
LOG_WRN("F_GETFL not supported, returning flags as 0");
return 0;
case F_SETFL:
LOG_WRN("F_SETFL not supported, ignoring flags");
return 0;
case ZFD_IOCTL_POLL_PREPARE:
return -EXDEV;

Expand Down