Commit Graph

48 Commits

Author SHA1 Message Date
SPRESENSE
7de8d0603f wireless/gs2200m: Fix handling of ioctl except SIOCDENYINETSOCK
When running a dual stack (usrsock daemon and kernel stack),
ioctl requests that should be handled by the kernel stack are being
processed by the usrsock daemon. This causes ifconfig and ifup to fail.
The usrsock daemon that receives an ioctl request that should be
handled by the kernel stack should reply with ENOTTY.
Replying with ENOTTY means that the ioctl request can fall back to the
kernel stack.
2023-10-13 08:48:25 +02:00
SPRESENSE
6a69f0e96f wireless/gs2200m: Add support SIOCDENYINETSOCK ioctl command
Support SIOCDENYINETSOCK ioctl command to set usrsock status.
If usock_enable is false, its means application wants to create
a socket with other network stack.
2023-09-21 01:13:39 +08:00
Xiang Xiao
7032c72f2f Indent the define statement by two spaces
follow the code style convention

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-21 07:39:53 +03:00
Gustavo Henrique Nihei
b0da60e498 apps: Use MIN/MAX definitions from "sys/param.h"
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-02-02 00:35:14 +02:00
SPRESENSE
2717ba4f88 wireless: gs2200m: Change usrsock xid from uint64_t to uint32_t
Fix the type to match usrsock.h has been changed.
2022-10-24 09:04:31 +02:00
zhanghongyu
31ad585611 gs2200m: fix usrsock_bind error in gs2200m module
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-10-21 08:33:50 +09:00
Xiang Xiao
9291d07a87 Fix the coding style issue
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-06 12:20:32 +02:00
Masayuki Ishikawa
3837091582 wireless: gs2200m: Add SIOCGIFFLAGS support to gs2200m_main.c
Summary:
- I noticed that the latest ifconfig command shows nothing
- Finally, I found that gs2200m_main.c needs to handle SIOCGIFFLAGS
- This commit fixes this issue

Impact:
- gs2200m only

Testing:
- Tested with spresense:wifi
- NOTE: gs2200m driver needs to be updated as well

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-09-07 11:21:29 +08:00
Xiang Xiao
0d85084741 wireless/gs2200m: Rename usrsock_request to usrsock_handle_request
fix the conflict after usrsock reconstruct:
https://github.com/apache/incubator-nuttx/pull/6949

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-08-29 22:17:29 +09:00
Takayoshi Koizumi
cfa5af51cd wireless/gs2200m: Release all blocking socket
When dis-associtaion happens, the socket is destroyed. And all blocking
sockets are released for that error handling can be performed.
2022-08-02 16:54:35 +09:00
Masayuki Ishikawa
7663f993f7 wireless: gs2200m: Fix recvfrom_request() in gs2200m_main.c
Summary:
- I noticed that wget causes ASSERT in gs2200m_main.c recently.
- Finally, I found that it sends a wrong ack message in
  recvfrom_request() when the socket is closed passively
- This commit fixes this issue.

Impact:
- gs2200m only

Testing:
- Tested with spresense:wifi_smp

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-04-15 10:36:52 +03:00
zhanghongyu
16c1fec99d usrsock: Move event field to usrsock_message_common_s
Zero the events field for all response message

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-04-03 11:39:19 +09:00
Petro Karashchenko
566be8c7b1 definitions: unify MAX and MIN macro definitions
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-03-16 23:20:17 +08:00
chao.an
a1857b9258 wireless/gs2200m: replace the preamble scratch to union
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-01-05 19:08:43 +09:00
chao.an
df53de1d68 net/usrsock: replace usrsock xid type to uint64_t
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-01-05 13:25:21 +08:00
Petro Karashchenko
5ac15130db apps: remove space befone newline in logs
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2021-12-27 20:52:08 -06:00
Masayuki Ishikawa
21f48846dd wireless: gs2200m: Fix error handling in sendto_request()
Summary:
- This commit returns -errno to the caller

Impact:
- gs2200m only

Testing:
- Tested with spresense:wifi_smp
- NOTE: need to update the gs2200m driver in NuttX

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-06-28 21:49:21 -05:00
Xiang Xiao
e9104dbbef Include assert.h in necessary place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-01 06:36:44 +09:00
Masatoshi Ueno
0f4ad7dc5f gs2200m: Add function to get IWNWID / IWFREQ / IWSENS information
Summary:
- This commit enables gs2200m application to get IWNWID/IWFREQ/IWSENS information

Impact:
- Affects gs2200m only

Testing:
- Tested with spresense:wifi
2020-11-02 19:59:09 +09:00
Masayuki Ishikawa
909eff540d wireless: gs2200m: Add support for ioctl(fd, SIOCGIFADDR, ...)
Summary:
- This commit adds support for ioctl(fd, SIOCGIFADDR, ...) to gs2200m_main.c

Impact:
- Only affects ioctl(fd, SIOCGIFADDR, ...) with gs2200m
- Need to update nuttx as well

Testing:
- Tested with spresense:wifi
- Tested with dhcpc

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-10-26 12:42:03 +01:00
Masayuki Ishikawa
b71c5f8cb1 wireless: gs2200m: Implement getpeername_request()
Summary:
- This commit adds getperrname_request() to gs2200m_main.c

Impact:
- Affects gs2200m only
- Need to update nuttx as well

Testing:
- Tested with spresense:wifi
- Modify telnetd and add getpeername() to show a client address

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-10-26 12:42:03 +01:00
Masayuki Ishikawa
0e9594e107 wireless: gs2200m: Fix to handle address info in accept()
Summary:
- This commit fixes to handle address info in accept()

Impact:
- All use cases which use accept() with gs2200m
- Need to update nuttx as well

Testing:
- Tested with spresene:wifi
- Tested with telnet daemon

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-10-26 12:42:03 +01:00
Masayuki Ishikawa
196b1f06df wireless: gs2200m: Fix to handle UDP connect() with bind()
Summary:
- This commit fixes to handle UDP connect() with bind() to local port
- NOTE: GS2200M does not support TCP connect() with bind to local port

Impact:
- All UDP cases which use connect() with gs2200m
- Need to update nuttx as well

Testing:
- Tested with spresense:wifi
- Create a UDP socket and bind() to local port.
- Then connect() to remote address with port and send()

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-10-26 12:42:03 +01:00
Masayuki Ishikawa
f4b0f9e290 wireless: gs2200m: Fix recvfrom_reques() in gs2200m_main.c
Summary:
- During Wi-Fi stress test, I noticed ASSERT happens in gs2200m_main.c
- Actually, req->max_buflen was 0 but the case was not handled correctly
- This commit fixes this issue

Impact:
- Affects read/recvfrom with len=0 cases

Testing:
- Tested with spresense:wifi_smp
- Run nxplayer for audio streaming
- Run ps/free/ifconfig commands via telnet
- Run smp command via telnet

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-10-09 08:47:14 +02:00
SPRESENSE
4e1a22428a wireless/gs2200m/gs2200m_main.c: Add passing MSG flags
Add passing MSG_* flags for gs2200m driver.
2020-08-06 20:52:09 +09:00
Masayuki Ishikawa
faec1f8614 wireless: gs2200m: Replace license header with Apache License 2.0
Summary:
- This commit replaces license headers under wireleass/gs2200m.

Impact:
- No impact

Testing:
- Buid check only

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-07-29 01:05:31 -05:00
SPRESENSE
f8354b0c03 wireless/gs2200m: Fix freeing uninitialized memory
Add initialize local variable and check the buffer is allocated before free().
2020-07-28 09:46:09 +02:00
Masayuki Ishikawa
13479e0a8c wireless: gs2200m: Update help messages in gs2200m_main.c
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-05-22 10:30:16 +02:00
Masayuki Ishikawa
e2414cd731 wireless: gs2200m: Fix to receive a big packet
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-05-18 09:44:37 +02:00
Masayuki Ishikawa
f3934ec6d8 wireless: gs2200m: Add support for getsockname() to gs2200m
NOTE: need to update nuttx repo as well

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-05-14 07:50:16 -06:00
Masayuki Ishikawa
06e74202b5 wireless: gs2200m: Fix to release a bound socket
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-04-30 20:17:26 +08:00
Masayuki Ishikawa
efcbd2d842 wireless: gs2200m: Fix nxstyle warnings in gs2200m_main.c
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-04-14 11:22:10 +02:00
Masayuki Ishikawa
c126732799 wireless: gs2200m: Add support for UDP connect in gs2200m_main.c
NOTE: gs2200m driver needs to be updated as well

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-04-14 11:22:10 +02:00
Xiang Xiao
41d88f06e7 Run codespell -w with the latest dictonary again 2020-02-23 07:10:14 -06:00
Masayuki Ishikawa
de4d52d465 wireless: gs2200m: Add support for setsockopt_request()
NOTE: Just check parameters and do nothing special

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-02-14 15:01:28 +08:00
Gregory Nutt
d2e1c8a4f3 apps/wireless/gs2200m/gs2200m_main.c: Eliminate a warning
Eliminate warning:

    gs2200m_main.c:  In function 'gs2200m_loop':
    gs2200m_main.c:1416:1:  warning: label 'errout' defined but not used [-Wunused-label]
2020-02-09 00:32:25 +01:00
Miguel Herranz
a5dff52a71 Change unimplemented requests behaviour in gs2200m
The ASSERT is too strong, as it cannot be disabled, so changing to
DEBUGASSERT, as calling these functions should not be a problem as
long as the application logic handle the error correctly.

The error code is changed to ENOSYS, as it seems to better reflect
the fact that the call itself would be valid, but the functionality
is not implemented (see [1] or `man errno`).

[1] https://www.gnu.org/software/libc/manual/html_node/Error-Codes.html
2020-02-06 23:43:37 +01:00
YAMAMOTO Takashi
2f4b309b1b gs2200m: Retry indefinately on GS2200M_IOC_ASSOC failure
Author: Alan Carvalho de Assis <engenharia03@siam.ind.br>

    Run nxstyle again gs2200m_main.c file and fix issues

Author: YAMAMOTO Takashi <yamamoto@midokura.com>

    gs2200m: Retry indefinately on GS2200M_IOC_ASSOC failure

    The ioctl doesn't return why it failed.
    It might or might not be a transient failure.

    In my environment, gs2200m often returns the following for AT+WA.
    It usually works after a few retries.

    [   12.110000] _parse_pkt_in_s1: +++++ 0:(msize=19, msg=WLAN CONNECT ERROR|)
    [   12.110000] _parse_pkt_in_s1: +++++ 1:(msize=6, msg=ERROR|)
2020-02-05 18:45:43 -03:00
Masayuki Ishikawa
e4af73ec56 wireless: gs2200m: Fix sendto_request() in gs2200m_main.c
Signed-off-by: Masayuki Ishikawa <<Masayuki.Ishikawa@jp.sony.com>
2020-01-28 10:35:50 +01:00
Masayuki Ishikawa
ebf666100a apps: gs2200m: Remove unnecessary usleep() to improve throughput
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2020-01-21 16:03:41 +09:00
Xiang Xiao
857158451b Unify the void cast usage
1.Remove void cast for function because many place ignore the returned value witout cast
2.Replace void cast for variable with UNUSED macro

Change-Id: Ie644129a563244a6397036789c4c3ea83c4e9b09
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-01-02 23:21:01 +08:00
Xiang Xiao
e806097c70 Application.mk and main.c files: Change builtin's entry point from main to xxx_main by macro expansion. This change make the entry point fully compliant with POSIX/ANSI standard. 2019-10-06 06:14:56 -06:00
Masayuki Ishikawa
104d7f3716 Merged in masayuki2009/nuttx.apps/gs2200m_supports_SIOCGIFHWADDR (pull request #199)
wireless/gs2200m/gs2200m_main.c: ioctl_request() supports SIOCGIFHWADDR

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-09-02 01:53:29 +00:00
Masayuki Ishikawa
1980c30738 Merged in masayuki2009/nuttx.apps/gs2200m_with_dhcp (pull request #189)
wireless/gs2200m: Add dhcp client handlings in ioctl_request()

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-07-30 10:51:07 +00:00
Masayuki Ishikawa
ff8d6aeed0 Merged in masayuki2009/nuttx.apps/gs2200m_with_udp (pull request #186)
wireless/gs2200m: Add udp support to gs2200m_main.c

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-07-25 05:41:16 +00:00
Masayuki Ishikawa
2cd84d713c Merged in masayuki2009/nuttx.apps/add_ch_setting (pull request #185)
wireless/gs2200m: Add channel parameter for AP mode

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-07-10 11:34:09 +00:00
Gregory Nutt
334b450452 wireless/gs2200m/gs2200m_main.c: Fix a warning about an uninitialized return value found in build testing. 2019-06-29 18:50:20 -06:00
Masayuki Ishikawa
d2f3ad91e2 Merged in masayuki2009/nuttx.apps/wireless_gs2200m (pull request #177)
apps/wireless/gs2200m: Moved from apps/system/gs2200m

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-06-27 00:54:19 +00:00