option -c will disable \n -> \r\n conversion both for serial device and console if it is a tty
refactor: use only one function to set termios parameters, use termious related code and options only if CONFIG_SERIAL_TERMIOS is defined
since it is moved to the central place in nuttx side instead
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I544d6110f1ca6460f7c82f970870aa9b1e7ab3dd
Adapt to the change in the main repo.
mallinfo is meant to be API compatible with Linux,
where it's provided by malloc.h.
(I think the API actually originated with System V. I don't
remember how it was there though. Anyway, I guess the
compatibility with Linux is more important than System V
these days.)
This is the companion to PR #766. It removes the CONFIG_CAN_PASS_STRUCT option as recommended by Issue #620
NuttX PR #766 depends on PR being in place but not vice versa. This PR should be merge-able without #766 and then PR #766 should also pass its checks.
These had the larger default for the sim.
It's no longer necessary as DEFAULT_TASK_STACKSIZE
can have different default for each arch.
See also:
commit b1d44a81b4
This commit changes only ones with the default 2048 and
leaves the others.
E.g. this leaves SYSTEM_RAMTEST_STACKSIZE, whose default is 1024.
I guess those need to be inspected one-by-one.
For now, I left the following instances because it isn't
clear to me why they are using the different values.
Maybe they need one-by-one inspection.
examples/igmp/Makefile:STACKSIZE = 1024
examples/powerled/Makefile:STACKSIZE = 1024
examples/powermonitor/Makefile:STACKSIZE = 768
examples/relays/Makefile:STACKSIZE = 512
examples/smps/Makefile:STACKSIZE = 1024
graphics/screenshot/Makefile:STACKSIZE = 4096
system/flash_eraseall/Makefile:STACKSIZE = 1024
testing/cxxtest/Makefile:STACKSIZE = 4096
testing/smart_test/Makefile:STACKSIZE = 4096
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
Check POLLHUP and POLLERR in telnet poll loop
to handle the remote end close correctly
Send "NVT"(network virtual terminal) as the default if getenv("TERM") return NULL
telnet should trigger the error handling if inet_pton return zero
since zero mean the string has format error
Don't return 1 in _environ_telnet to avoid trigger the compression
and remove the redundant TELNET_TELOPT_COMPRESS2 check
Change telnet_error_u to telnet_error_e required by the coding standard
Ensure telnet object get freed before the abnormal exit
* fix warning: format '%u' expects argument of type 'unsigned int *', but argument 3 has type 'uint16_t *
Change-Id: I3eccf8e2cd917f19b7a9edab233b327297d74bb7
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
* fix warning: format '%ld' expects argument of type 'long int', but argument 2 has type 'int'
Change-Id: Ic59a1e9e49256637fa73459c46b8cded036cf971
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Introduce new configuration of CONFIG_SYSTEM_ZMODEM_SNDFILEBUF, which
allocates cache buffer for reading file to be sent. This option can
improve the performance of zmodem sending file by multiple bytes read
of file, especially when the single read of file is very slow.
Author: Gregory Nutt <gnutt@nuttx.org>
Run all .c and .h affected by this PR through nxstyle.
Author: Alin Jerpelea <alin.jerpelea@sony.com>
* system/usbmsc: Fix accessing uninitialized pointer
* fsutils/inifile: Fix a memory leak in inifile error case
* fsutils/mksmartfs: Fix uninitialized return code
* system/zmodem: Fix a compile error in zmodem debug enabled
* nshlib/nsh_fscmds.c: Add syntax check to cp command
If the destication of NutShell cp command is the same with the source,
it may cause the file corruption. Add the syntax check of argument to
avoid this problem.
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>
Bugfix/spitool exch parse txdata
* friendlier I2C "knock-knock" uses only read request
While many I2C slave devices have multiple indexed registers, some have
only one register and it's not indexed. For example, the I2C bus switch
TCA9548A has only a Control Register, attempting to index to "Reg[0]"
alters its contents to 0x00 disabling all subordinate buses. This patch
fixes that problem by simply trying to read something/anything from the
slave. This also helps coax out slaves with register files that start
from a higher index, i.e. the AT24CS0x, FLASH chips with a UUID that
appears as a 2nd I2C slave at (address+8), report their serial number at
Reg[80]-Reg[8F] and will NAK a read of Reg[0].
* modify get/set to prevent write of reg index if not specifed
* correctly parse exch txdata args, if any
* should always call the board's deselect
Approved-by: Gregory Nutt <gnutt@nuttx.org>
Feature/i2c dump
* friendlier I2C "knock-knock" uses only read request
While many I2C slave devices have multiple indexed registers, some have
only one register and it's not indexed. For example, the I2C bus switch
TCA9548A has only a Control Register, attempting to index to "Reg[0]"
alters its contents to 0x00 disabling all subordinate buses. This patch
fixes that problem by simply trying to read something/anything from the
slave. This also helps coax out slaves with register files that start
from a higher index, i.e. the AT24CS0x, FLASH chips with a UUID that
appears as a 2nd I2C slave at (address+8), report their serial number at
Reg[80]-Reg[8F] and will NAK a read of Reg[0].
* modify get/set to prevent write of reg index if not specifed
* add 'dump' command to issue a single transaction
to retrieve multiple bytes from an I2C slave and register/offset.
* use NuttX' isprint()
* refactor to reduce coupling, hexdump only needs outstream
Approved-by: Gregory Nutt <gnutt@nuttx.org>
1. Check NSH_NETINIT for self network initialization
2. Check NSH_ARCHINIT for sel arch specific initialization
3. Always show help regardless of NSH_BUILTIN_APPS
4. Loop forever regardless of NSH_BUILTIN_APPS, user could:
a.change the default behavior by the command line argument
b.or ctrl+c to break out the loop
Bugfix/i2ctool dev clobbers slave config
* friendlier I2C "knock-knock" uses only read request
While many I2C slave devices have multiple indexed registers, some have
only one register and it's not indexed. For example, the I2C bus switch
TCA9548A has only a Control Register, attempting to index to "Reg[0]"
alters its contents to 0x00 disabling all subordinate buses. This patch
fixes that problem by simply trying to read something/anything from the
slave. This also helps coax out slaves with register files that start
from a higher index, i.e. the AT24CS0x, FLASH chips with a UUID that
appears as a 2nd I2C slave at (address+8), report their serial number at
Reg[80]-Reg[8F] and will NAK a read of Reg[0].
* modify get/set to prevent write of reg index if not specifed
Approved-by: Gregory Nutt <gnutt@nuttx.org>
include/ and netutils/: Remove references to CONFIG_DISABLE_SIGNALS. Signals can no longer be disabled.
nshlib/: Remove references to CONFIG_DISABLE_SIGNALS. Signals can no longer be disabled.
system/: Remove references to CONFIG_DISABLE_SIGNALS. Signals can no longer be disabled.
testing/: Remove references to CONFIG_DISABLE_SIGNALS. Signals can no longer be disabled.
examples/: Remove references to CONFIG_DISABLE_SIGNALS. Signals can no longer be disabled.
Squashed commit of the following:
apps/nshlib: Remove NSH initialization. Now uses the common apps/netutils/netinit logic (which was cloned from nshlib to begin with).
apps/netutils/netinit: Clone network initialization logic from NSH to this directory so that it can be available for general use.
apps/system/nxplayer: Fix some logical errors from recent comments. They broke the build of the nxplayer as a library vs. a task. apps/graphics/nxglyphs: Fix yet more namespace problems.
graphics/nxwm/src/nxwm_main.cxx: Move from graphics/nxwidgets/UnitTests/nxwm/nxwm_main.cxx.
apps/graphicx/nx*: Fixes numerous build issues mostly associated with include paths and namespaces.
apps/nxglyphs: Decouple (mostly) from nxwidgets and nxwm so that they can be used elsewhere. Creates include/graphics/nxglyphs.h
apps/graphics/nxglyphs: Put all NxWidgets and NxWM glyphs into a common directory where they can eventually be shared. Not very sharable at the moment due to header file entanglements. Need a separate nxglyps.hxx header file.
Separate nxwidets and nxwm into separate directories. Remove old, common NxWidgets directory.
system/vi: Condition KEY_CMDMODE_REPEAT with CONFIG_SYSTEM_VI_INCLUDE_COMMAND_REPEAT to avoid build error when option is not selected.
Approved-by: Gregory Nutt <gnutt@nuttx.org>
c26c62e remove some code when binary logs are disabled
4c8e0df src/el-pmemory.c: fix usage of uninitialized variable
9b641a4 src/el-pmemory.c: fix wrong options object used
eb1fcb4 options: fix g_options altered after el_ocleanup
f64ec5e add: printing memory without ascii table
c16e5cd make code more c89 compatible
d0f1a54 fix: remove comma at the end of enum list
9defd3f fix bad comment
with very minor features added:
f3c138b add: option to print to stdout
d7857c4 make embedlog print to stderr by default
===============================================
1. Deletion of last line in file using 'dd' caused infinite loop searching for
'nextline'. Fixed.
2. Insertion of line above 1st line using 'O' caused line to be inserted on
2nd line. Fixed.
3. Paste buffer from 'dd' was being free'd after the 'p'aste operation,
preventing multiple paste opportunity. Fixed.
4. The cursor was not being bound to the line end and was allowed to 'hover'
over the '\n' EOL character. This caused wierd (relative to standard vi)
insertion locations and cursor movement with 'a'ppend and 'i'nsert. Fixed.
5. The 'vi_shrinkpos' position didn't take the end of file pointer into
account when calculating 'curpos', 'prevpos' variables causing wierdness
when deleting things near the end of the file. Fixed.
6. The 'yy'ank command was improperly deleting the text from the document
instead of simply yanking to the paste buffer. Fixed.
7. The 'dd'elete line funciton was not copying the deleted line to the paste
buffer as part of the delete operation. Fixed.
8. The bottom line of the screen was sometimes being used for document text
and other times for command / find entry. Fixed by reserving the bottom
the bottom line for status / command only.
9. When scrolling up / down through a file, the cursor position was not
preserved and moved further and further to the left column based on the
line lengths of the lines visited. Fixed.
10. The display was being COMPLETELY redrawn with each keystroke, causing the
responsiveness to be imbearable. Fixed. Added logic to dynamicall
indicated which portions of the screen need to be updated (full display,
current line to end of screen, current line only, none).
11. The individual display line updates were being performed a character at
a time by calling the vi_putch() function, causing slow performance,
especially in telnet or USBCDC sessions where there is a lot of overhead
per packet. Fixed by calling vi_write() instead with a block of
characters with breaks as needed for TAB exansion.
12. The forward delete 'x' operation allowed deletion through '\n' characters
causing lines to be joined. This is different from standard vi where
'x' at the end of a line performs a delete backward operation. Fixed.
13. When in 'ex' or find sub-modes (':' or '/' bottom line modes), hitting
backspace with empty text did not return the operation to command mode
like it does in standard vi. Fixed.
14. Performing a 'find' opertation would only search from the current cursor
position to the end of the file and did not wrap like in standard vi.
Fixed.
15. Loading a file that was larger than the initial text allocation would
force a call to 'vi_extendtext', marking the file as modified when in
fact it hadn't even been loaded yet. Fixed.
16. Combined vi_insert_mode and vi_replace_mode into a single function to
save code space since they are nearly identical routines.
17. In command mode, backspace was deleting characters which is different
from standard vi. Backspace in command mode normally simply moves the
cursor left / to the previous line. Fixed.
18. Added code to handle boundry conditions when the file is new and
commands are applied to an empty file.
19. Fixed vi_shrinktext so it doesn't allocate a zero-length buffer when
the last character in the file is deleted.
20. The 'x' command was not copying to the paste buffer. Fixed.
21. Fixed parsecolon routine to properly deal with ":wq" command sequence.
New feature additions
=====================
1. Vi startup feature to prepend the current working directory to the
supplied filename if it does not start with '/' absolute path specifier.
This allows editing files in the current directory without needing to
fully qualify the filename.
2. Standard '~' empty screen line characters for proper identification
of empty '\n' only lines at the end of the file.
3. Moving into insert or append mode now prints '--INSERT--' in the status
line and clears it upon exit.
4. Integration with termcurses to detect special keystrokes and to
handle terminal type differences. Haven't yet converted all vt100 print
codes to termcurses equivalents.
5. Support for up, down, left, right arrows, page-up, page-down keys
in command mode.
6. Added 'b' command to move cursor 'b'ack to previous word. Honors the
command repeat value for multiple word moves.
7. Added 'w' command to move cursor to next 'w'ord. Honors the command
repeat value for multiple word moves.
8. Added 'f' and 't' commands to find characters on the current line.
Honors the command repeat value.
9. Added the find 'n'ext command to repeat the previous find operation.
10. Added the 'H', 'M', and 'L' commands to move the cursor to top,
middle and bottom of the display.
11. Extended yank/paste to manage a paste buffer with character mode in
addition to line mode. Character mode allows cut / paste of
individual characters or groups of characters vs. full lines.
12. Added support in the 'd'elete and 'y'ank commands for character mode
deletions such as 'dw', 'dfa', '2yw', etc.
13. Added support in paste routine for multiple paste using command value
argument.
14. Added support for the 'D' and 'C' delete and change to end of line
commands.
15. Added support for 's'ubstitute key ('x' followed by insert mode).
16. Modified yank / paste allocation scheme to avoid repeated alloc
and free of paste buffer. Uses a minimum allocation size scheme and
only does free / realloc when paste does not fit. If the paste is
smaller than the current allocation and the current allocation is
larger than the threshold, then the buffer is freed and a smaller
buffer allocated. Otherwise the existing buffer is used.
17. Support for 'P'aste before current cursor position.
18. Support for '?' reverse search mode.
19. Support for 'J'oin next line with current line command.
20. Printing of current row,col in status line of display.
21. Command repeat '.' support for commands that modifiy text.
22. Support in replace / insert mode for arrow keys, PGUP / PGDN, HOME,
and END. Using these will cause the command repeat buffer to
reset such that only the last text addition after a cursor movement
is saved.
23. Added 'X' delete previous command.
24. Added "gg" go to top of document command sequence.
25. Added "ZZ" save and quit command (equivalent to :wq).
26. Implemented '^' goto first non-whitespace on current line, along
with '+' and '-' goto first non-whitespace on next / previous line.
27. Added CR / LF goto first non-whitespace on next line in command mode.
1. A memory corruption issue that occurs from a paste operation that would overflow the fixed buffer size for keyboard processing.
2. A stall in getch() processing when there are cached keycodes in the termcurses emulation (tcurses_vt100.c).