Skip to content

Commit c4b5df9

Browse files
[shell] Fixes for Matter cli (#31768)
* [shell] Fixed parsing of long otcli commands The otcli command buffer (128) was to small for some ot commands like otcli dataset set active <hex dataset>. The 128 value was taken from an OT config a long time ago and since was increased to 384. A new static constexpr was created with the value of 384 to be used instead of the define. Signed-off-by: Marius Preda <marius.preda@nxp.com> * [shell] Add backspace character in ReadLine Signed-off-by: Andrei Menzopol <andrei.menzopol@nxp.com> --------- Signed-off-by: Marius Preda <marius.preda@nxp.com> Signed-off-by: Andrei Menzopol <andrei.menzopol@nxp.com> Co-authored-by: Marius Preda <marius.preda@nxp.com>
1 parent 058f199 commit c4b5df9

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

examples/shell/shell_common/cmd_otcli.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ static char sTxBuffer[SHELL_OTCLI_TX_BUFFER_SIZE];
4848
static constexpr uint16_t sTxLength = SHELL_OTCLI_TX_BUFFER_SIZE;
4949
#endif // !CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI)
5050
#endif
51+
static constexpr uint16_t kMaxLineLength = 384;
5152
#else
5253
#include <sys/types.h>
5354
#include <sys/wait.h>
@@ -81,8 +82,6 @@ CHIP_ERROR cmd_otcli_dispatch(int argc, char ** argv)
8182
{
8283
CHIP_ERROR error = CHIP_NO_ERROR;
8384

84-
// From OT CLI internal lib, kMaxLineLength = 128
85-
#define kMaxLineLength 128
8685
char buff[kMaxLineLength] = { 0 };
8786
char * buff_ptr = buff;
8887
int i = 0;

src/lib/shell/MainLoopDefault.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ size_t ReadLine(char * buffer, size_t max)
6969
done = true;
7070
}
7171
break;
72+
case 0x08:
7273
case 0x7F:
7374
// Do not accept backspace character (i.e. don't increment line_sz) and remove 1 additional character if it exists.
7475
if (line_sz >= 1u)

0 commit comments

Comments
 (0)