Commit Graph

5323 Commits

Author SHA1 Message Date
YAMAMOTO Takashi
f613da4f92 webclient.c: Remove a space after a negative sign
from:

    return - ECONNABORTED;

to:

    return -ECONNABORTED;

The latter style is more commonly used within NuttX code base.

Note: nxstyle doesn't complain on either of them.
2021-02-12 08:51:23 +00:00
chao.an
ebbf2fc072 netutils/dhcpc: configurable Bootstrap flags
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-02-11 21:38:43 -08:00
YAMAMOTO Takashi
ca6907ccbe ntpclient.c: Avoid integer overflows in offset calculation
The current calculation easily overflows if the local time is
around the unix epoch.  I guess it isn't too unusual for
devices without RTC.  Or, the battery is dead.  Or, whatever.

This commit avoids the overflow by simply dividing everything by 2.
While more sophisticated and precise solutions are possible,
I feel that they are overkill for this simple implementation.

For example,

The unix epoch (1970) is 0x83aa7e8000000000 in
64-bit NTP timestamp. (1900-origin)
The timestamp now, as of writing this, is 0xe3cda16b00000000.

With the code before this commit, the offset will be:

(lldb) p (long long)((0xe3cda16b00000000 - 0x83aa7e8000000000) + (0xe3cda16b00000000 - 0x83aa7e8000000000)) / 2
(long long) $16 = -2295952992316162048
(lldb)

with the new code, it would be:

(lldb) p (long long)((0xe3cda16b00000000 / 2 - 0x83aa7e8000000000 / 2) + (0xe3cda16b00000    / 2 - 0x83aa7e8000000000 / 2))
(long long) $17 = 6927419044538613760
(lldb)

It's the correct offset from the unix epoch:

(lldb) p 6927419044538613760 >> 32
(long) $0 = 1612915435
(lldb)

spacetanuki% date -r 1612915435
Wed Feb 10 09:03:55 JST 2021
spacetanuki%
2021-02-09 22:47:20 -08:00
YAMAMOTO Takashi
6d1d6e76ea wget: print a message on an error
To give the user some clue on what's going.
2021-02-04 00:30:01 -08:00
Masayuki Ishikawa
f14e98c942 netutils: iperf: Add pthread_join() to wait for completion
Summary:
- I noticed that lc823450-xgevk:rndis does not work with iperf
- Finally, I found that it does not call pthread_join()
- This commit fixes this issue

Impact:
- No impact

Testing:
- Tested with lc823450-xgevk:rndis
- NOTE: need to add iperf in the defconfig

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-02-01 18:21:36 -08:00
chao.an
623a668baa wapi: Extend "WAPI_ESSID_DELAY_ON" flag to support customized connection behavior
The current essid setting(SIOCSIWESSID) are not satisfactory in case
of specified bssid connection, if there are multiple essids with same name,
we need additional bssid information to connect to the specified softap.
The extended flag "WAPI_ESSID_DELAY_ON" instructs the driver to delay the
connection behavior of essid, so that which can accept more accurate
information before generating a connection.

About flow of wapi command, drivers that support WAPI_ESSID_DELAY_ON semantics
will have the following behavior changes:

1. Station mode without bssid set:

$ ifup wlan0
$ wapi mode wlan0 2
$ wapi psk wlan0 12345678 3
$ wapi essid wlan0 archer 1
$ renew wlan0

2. Station mode with bssid set:

$ ifup wlan0
$ wapi mode wlan0 2
$ wapi psk wlan0 12345678 3
$ wapi essid wlan0 archer 2       <----- WAPI_ESSID_DELAY_ON will indicate the driver delay
$                                        the connection event late to bssid set (SIOCSIWAP).
$ wapi ap wlan0 ec:41:18:e0:76:7e
$ renew wlan0

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-30 20:19:10 -08:00
chao.an
a53f2ad270 wireless/wapi: add get sensitivity command
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-29 07:59:48 +00:00
Alan C. Assis
382638c8c6 Add support in printf command to send 8-32 bits value 2021-01-28 05:15:59 -08:00
YAMAMOTO Takashi
8a19fe36e1 netcat_server: do not loop forever
To make it similar to other implementations.
(I followed the behavior of NetBSD's nc, which came from OpenBSD.)
2021-01-28 01:18:45 -08:00
YAMAMOTO Takashi
eb996e5650 netcat: Rewrite the i/o loop
* Stop echoing back the input.
  It isn't the responsibility of this app, IMO.

* Allow non-text data

* Error checks and cleanups
2021-01-28 01:18:45 -08:00
YAMAMOTO Takashi
8093aa7487 netcat: Fix the usage output 2021-01-28 01:18:45 -08:00
YAMAMOTO Takashi
bb620bb95c netdb: Fix usage and comment 2021-01-27 11:38:16 +01:00
YAMAMOTO Takashi
87c876c1cc netcat: Fix a buffer overflow
The buffer doesn't have the space for the terminating NUL.
Fix it by replacing it with fwrite, as there seems to be little reason
to use fprintf and NUL-terminated string in the first place.
2021-01-27 11:28:10 +01:00
Juha Niskanen
3b21cd9ceb netutils/ntpclient: add more features
Allow multiple NTP servers, also with runtime configurable list
Add validation of received NTP packets
NTPv4 support with 'Kiss o' Death' message handling
IPv6 support
Collect multiple NTP samples and filter outsiders
Check if system clock has been altered during NTP (if CONFIG_CLOCK_MONOTONIC)

Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2021-01-26 03:23:27 -08:00
Masayuki Ishikawa
faaec6513c testing: getprime: Introduce configurable thread priority
Summary:
- This commit introduces configurable thread priority
- Also, thread policy is set based on RR_INTERVAL

Impact:
- getprime only

Testing:
- Tested with spresense:wifi_smp

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-01-25 23:20:16 -08:00
Juha Niskanen
c4bcd8254a include/system/prun.h: remove leftover file 2021-01-22 17:50:13 +01:00
Xiang Xiao
e4f76ac9eb examples/romfs: Add ldir(soft link) into check
since romfs can return the soft link with the kernel change:
commit 67ef70d460db4695b950208d861ff47d4a40bdb3
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
Date:   Mon Jul 6 00:34:32 2020 +0800

    vfs/dirread: Should return the same file type as lstat

    by extend the possible value of d_type for the special file

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-21 11:12:40 -03:00
Peter van der Perk
b7ef4fb513 canutils/slcan: use syslog and cleanup 2021-01-21 11:12:14 -03:00
Peter van der Perk
e12e8016f2 canutils/slcan: Add SLCAN utility 2021-01-21 11:12:14 -03:00
YAMAMOTO Takashi
412cf2b955 webclient: Fix a use of uninitialized variable
Detected by clang static analyzer.
2021-01-19 19:06:24 -08:00
Juha Niskanen
e800609e7b netutils/tftpc: typos, nxstyle 2021-01-19 19:51:33 +01:00
Juha Niskanen
b66002c364 examples/README.md: correct ftpc usage, other minor updates and typos 2021-01-19 19:51:33 +01:00
YAMAMOTO Takashi
ee1f4fdcdb webclient: Don't call the sink callback if no data is available
This happened frequently for me with Docker Desktop's
/var/run/docker.sock on macOS.
But I believe it can happen on other environments, even with TCP.

Alternatively, this case can be handled by the callback
implementations.  But it's simpler to handle the corner case here.
2021-01-17 18:44:17 -08:00
YAMAMOTO Takashi
1131cbe14d webclient: Implement AF_LOCAL 2021-01-17 18:44:17 -08:00
Xiang Xiao
ee443edf6a system/argtable3: Update to the latest version(v3.2.0.7402e6e)
and remove 0001-feat-Switch-to-FreeBSD-getopt-library.patch
since it is already included in the new official release

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-16 14:13:25 -08:00
Masayuki Ishikawa
7f079d1c3c netutils : iperf: Fix compile warnings with Arm GCC 9.3.1
Summary:
- This commit fixes compile warnings with Arm GCC 9.3.1

Impact:
- None

Testing:
- Tested with lm3s6965-ek:discover
- NOTE: need to add the following configs
  +CONFIG_EXAMPLES_IPERF=y
  +CONFIG_EXAMPLES_IPERFTEST_DEVNAME="eth0"

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-01-15 02:22:40 -06:00
Juha Niskanen
35535655c5 ntpclient: change sinfo to ninfo
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2021-01-14 11:07:58 -06:00
Xiang Xiao
95a06846bc examples/pty_test: Fix the hardcode uart device path
should be CONFIG_EXAMPLES_PTYTEST_SERIALDEV, regression in commit:
commit 6ddbffd200
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
Date:   Sun Jan 3 23:50:50 2021 -0800

    examples/pty_test: Remove O_NONBLOCK from open

    to avoid the log storm:
    ERROR Failed to read from serial: 11
    ERROR Failed to read from serial: 11
    ERROR Failed to read from serial: 11
    ERROR Failed to read from serial: 11
    ERROR Failed to read from serial: 11
    ...

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-14 08:34:47 +01:00
Xiang Xiao
35f3b609fe system/argtable3: Update to the latest version(v3.1.5.1c1bb23)
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-14 15:18:05 +09:00
YAMAMOTO Takashi
ebe3b0d302 webclient: Report unexpected connection loss as an explicit error
Otherwise, it can end up with mysterious results in user apps.
2021-01-13 20:51:06 -06:00
Juha Niskanen
eceaeb926a netutils/ftpd, examples/ftpd: code cleanup and nxstyle
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2021-01-13 20:22:55 -06:00
Juha Niskanen
31f52a1971 netutils/ftpd: fix compilation on dual-stack systems
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2021-01-13 20:22:55 -06:00
Juha Niskanen
5c8d6934a5 netutils/ftpd: fix hardfault when initial socket, bind or listen fails
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2021-01-13 20:22:55 -06:00
Xiang Xiao
6aca60133c nsh: Pass the correct command lines to nsh_consolemain
Change-Id: Ic6617cecb6949054e6bdce8757523e7a60d83eb0
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-13 16:40:18 +08:00
Xiang Xiao
6ddbffd200 examples/pty_test: Remove O_NONBLOCK from open
to avoid the log storm:
ERROR Failed to read from serial: 11
ERROR Failed to read from serial: 11
ERROR Failed to read from serial: 11
ERROR Failed to read from serial: 11
ERROR Failed to read from serial: 11
...

Change-Id: I821743411c33b5412165f1e9020b6c9ce6c24660
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-13 16:40:18 +08:00
chenwen
756dc32fd0 netutils/iperf: Add iperf example.
system/argtable3: Add an ANSI C library for command-line parsing.
2021-01-07 08:43:26 -06:00
Nakamura, Yuuichi
bfa826d30d system/trace: Fix fprintf format warnings 2021-01-06 10:27:34 +01:00
nietingting
c98330fed9 [ltp] fix build failure with Argument too long issue
Signed-off-by: nietingting <nietingting@xiaomi.com>
2021-01-05 07:12:46 -06:00
nietingting
ccf5bd28fd ltp: fix build fail issue
Signed-off-by: nietingting <nietingting@xiaomi.com>
2021-01-05 07:12:46 -06:00
chao.an
54bbfee30e system/readline: check the control ascii only to support multi-languages
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-05 08:02:25 +01:00
chao.an
bd9174a3b6 wireless/wapi: add set country code support
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-05 08:00:29 +01:00
ligd
ef0c6b30c4 apps: update mqueue_open usage
As the mqd_t change to int

Change-Id: I16a9c137b6308eeec0badd241a101359e5f751b4
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-01-03 21:23:34 -06:00
ligd
135c5f61e1 testing/ostest/timedmqueue.c: fix nx_style
Change-Id: Ic7ba4f9008164932d3d94da1d09096a0f3e9534b
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-01-03 21:23:34 -06:00
ligd
0e4c29be03 system/nx: update mqueue_open return value
Change-Id: Ic8d7763fa2da01312cb0e02b4aaf73893cad471a
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-01-03 21:15:00 -06:00
Nathan Hartman
538c757340 apps/examples/webserver: nxstyle fixes
apps/examples/webserver/webserver_main.c:

    * Fix nxstyle errors.
2021-01-03 21:10:38 -06:00
Nathan Hartman
819454ee6e apps/examples/webserver: When NSH app, allow terminating
The examples/webserver app can be built in two modes:

    (1) in standalone mode, or
    (2) as a NSH built-in app.

When run in standalone mode, the webserver program is responsible for
bringing up the network (including DHCP if configured).  Also, the
webserver program must never exit, so if httpd fails (i.e., if
httpd_listen() returns), webserver_main() goes into an endless loop.

When run as a NSH built-in app, network bring-up is the responsibility
of other processes and the webserver program assumes the network is
already properly configured when it starts.  Also, if httpd_listen()
returns, the webserver program should terminate.

Prior to this change, the webserver program would *not* terminate,
even when running as a NSH built-in app.  For example:

    nsh> webserver &
    webserver [6:100]
    nsh> Starting webserver

    nsh> kill -9 6
    nsh> webserver_main: Still running
    nsh> webserver_main: Still running
    nsh> webserver_main: Still running
    nsh> webserver_main: Still running

The line "webserver_main: Still running" would be forever printed
every 3 seconds, however httpd_listen() is no longer running and the
webserver is not functional.

This change makes the webserver play nicely when running as a NSH
built-in app.  With this change applied:

    nsh> webserver &
    webserver [6:100]
    nsh> Starting webserver

    nsh> kill -9 6
    nsh> webserver_main: Exiting

apps/examples/webserver/webserver_main.c:

    * main(): Infer from CONFIG_NSH_BUILTIN_APPS if this is a
      standalone program or a NSH built-in app.  (See [1], where
      similar logic was added to decide whether to do network bring-up
      or not.)  If standalone, run forever as before.  If built-in
      app, exit when httpd terminates.

References:
[1] Commit 3a21b0b222
2021-01-03 21:10:38 -06:00
pengyiqiang
1b5b8c5167 lvgl: Add file system interface.
N/A

Change-Id: Iae291f0250284ef7fe8af60e02f66c326b54d979
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
2021-01-03 08:04:34 -06:00
dongjiuzhu
89bceba6b0 testing/sensortest: fix bug because getopt and add debug log
Change-Id: Id9c3499dd56690c60b2f6579d128850ce7522a6e
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2020-12-31 23:53:08 +01:00
dongjiuzhu
89376af38d testing/sensortest: fix bug because of adding custom type
Change-Id: I69fc7881e3fa7f94b549b1a342339fe5a9ec13ab
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2020-12-31 23:53:08 +01:00
Xiang Xiao
eff52fefcf Fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-12-31 12:29:59 -08:00