You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2020/03/09 13:16:15 UTC

[GitHub] [mynewt-core] kasjer opened a new pull request #2233: Fix console echo handling

kasjer opened a new pull request #2233: Fix console echo handling
URL: https://github.com/apache/mynewt-core/pull/2233
 
 
   1. Echo could be turned on after some nlip bytes handling, now if user code disabled echo with console_echo(0) it will not be enabled in nlip code.
   
   2 Additionally nlip handling can be disabled to reduce code size.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2233: [RFC] Fix console echo handling

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on issue #2233: [RFC] Fix console echo handling
URL: https://github.com/apache/mynewt-core/pull/2233#issuecomment-599564085
 
 
   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### sys/console/minimal/src/console.c
   <details>
   
   ```diff
   @@ -293,12 +292,13 @@
    
        if (!ev) {
            ev = os_eventq_get_no_wait(avail_queue);
   -        if (!ev)
   +        if (!ev) {
                return 0;
   +        }
            input = ev->ev_arg;
        }
    
   -    if (MYNEWT_VAL(CONSOLE_NLIP) && handle_nlip(byte))  {
   +    if (MYNEWT_VAL(CONSOLE_NLIP) && handle_nlip(byte)) {
            if (byte == '\n') {
                insert_char(&input->line[cur], byte, end);
                input->line[cur] = '\0';
   @@ -337,7 +337,7 @@
        if (!isprint(byte)) {
            switch (byte) {
    #if MYNEWT_VAL(CONSOLE_NLIP)
   -            case CONSOLE_NLIP_PKT_START1:
   +        case CONSOLE_NLIP_PKT_START1:
                nlip_state |= NLIP_PKT_START1;
                break;
            case CONSOLE_NLIP_DATA_START1:
   @@ -346,9 +346,9 @@
    #endif
            default:
                insert_char(&input->line[cur], byte, end);
   -            /* Falls through. */
   +        /* Falls through. */
            case '\r':
   -            /* Falls through. */
   +        /* Falls through. */
            case '\n':
                if (byte == '\n' && prev_endl == '\r') {
                    /* handle double end line chars */
   ```
   
   </details>

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] kasjer commented on issue #2233: Fix console echo handling

Posted by GitBox <gi...@apache.org>.
kasjer commented on issue #2233: Fix console echo handling
URL: https://github.com/apache/mynewt-core/pull/2233#issuecomment-596529923
 
 
   Hi @dwld could you please checked if this solution fixes problem that you detected?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on issue #2233: [RFC] Fix console echo handling

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on issue #2233: [RFC] Fix console echo handling
URL: https://github.com/apache/mynewt-core/pull/2233#issuecomment-596577098
 
 
   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### sys/console/minimal/src/console.c
   <details>
   
   ```diff
   @@ -346,9 +346,9 @@
    #endif
            default:
                insert_char(&input->line[cur], byte, end);
   -            /* Falls through. */
   +        /* Falls through. */
            case '\r':
   -            /* Falls through. */
   +        /* Falls through. */
            case '\n':
                if (byte == '\n' && prev_endl == '\r') {
                    /* handle double end line chars */
   ```
   
   </details>

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on issue #2233: [RFC] Fix console echo handling

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on issue #2233: [RFC] Fix console echo handling
URL: https://github.com/apache/mynewt-core/pull/2233#issuecomment-599564085
 
 
   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### sys/console/minimal/src/console.c
   <details>
   
   ```diff
   @@ -293,12 +292,13 @@
    
        if (!ev) {
            ev = os_eventq_get_no_wait(avail_queue);
   -        if (!ev)
   +        if (!ev) {
                return 0;
   +        }
            input = ev->ev_arg;
        }
    
   -    if (MYNEWT_VAL(CONSOLE_NLIP) && handle_nlip(byte))  {
   +    if (MYNEWT_VAL(CONSOLE_NLIP) && handle_nlip(byte)) {
            if (byte == '\n') {
                insert_char(&input->line[cur], byte, end);
                input->line[cur] = '\0';
   @@ -337,7 +337,7 @@
        if (!isprint(byte)) {
            switch (byte) {
    #if MYNEWT_VAL(CONSOLE_NLIP)
   -            case CONSOLE_NLIP_PKT_START1:
   +        case CONSOLE_NLIP_PKT_START1:
                nlip_state |= NLIP_PKT_START1;
                break;
            case CONSOLE_NLIP_DATA_START1:
   @@ -346,9 +346,9 @@
    #endif
            default:
                insert_char(&input->line[cur], byte, end);
   -            /* Falls through. */
   +        /* Falls through. */
            case '\r':
   -            /* Falls through. */
   +        /* Falls through. */
            case '\n':
                if (byte == '\n' && prev_endl == '\r') {
                    /* handle double end line chars */
   ```
   
   </details>

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on issue #2233: Fix console echo handling

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on issue #2233: Fix console echo handling
URL: https://github.com/apache/mynewt-core/pull/2233#issuecomment-596547070
 
 
   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### sys/console/full/src/console.c
   <details>
   
   ```diff
   @@ -1022,7 +1022,7 @@
                nlip_state = NLIP_PKT_START1;
            } else {
                handled = g_console_ignore_non_nlip &&
   -                !MYNEWT_VAL(CONSOLE_NLIP_ECHO_LF) && byte != '\r' && byte != '\n';
   +                      !MYNEWT_VAL(CONSOLE_NLIP_ECHO_LF) && byte != '\r' && byte != '\n';
            }
            break;
        }
   ```
   
   </details>
   
   #### sys/console/minimal/src/console.c
   <details>
   
   ```diff
   @@ -293,12 +292,13 @@
    
        if (!ev) {
            ev = os_eventq_get_no_wait(avail_queue);
   -        if (!ev)
   +        if (!ev) {
                return 0;
   +        }
            input = ev->ev_arg;
        }
    
   -    if (MYNEWT_VAL(CONSOLE_NLIP) && handle_nlip(byte))  {
   +    if (MYNEWT_VAL(CONSOLE_NLIP) && handle_nlip(byte)) {
            if (byte == '\n') {
                insert_char(&input->line[cur], byte, end);
                input->line[cur] = '\0';
   @@ -337,7 +337,7 @@
        if (!isprint(byte)) {
            switch (byte) {
    #if MYNEWT_VAL(CONSOLE_NLIP)
   -            case CONSOLE_NLIP_PKT_START1:
   +        case CONSOLE_NLIP_PKT_START1:
                nlip_state |= NLIP_PKT_START1;
                break;
            case CONSOLE_NLIP_DATA_START1:
   @@ -346,9 +346,9 @@
    #endif
            default:
                insert_char(&input->line[cur], byte, end);
   -            /* Falls through. */
   +        /* Falls through. */
            case '\r':
   -            /* Falls through. */
   +        /* Falls through. */
            case '\n':
                if (byte == '\n' && prev_endl == '\r') {
                    /* handle double end line chars */
   ```
   
   </details>

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2233: [RFC] Fix console echo handling

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on issue #2233: [RFC] Fix console echo handling
URL: https://github.com/apache/mynewt-core/pull/2233#issuecomment-599595588
 
 
   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### sys/console/minimal/src/console.c
   <details>
   
   ```diff
   @@ -323,7 +323,7 @@
                ev = NULL;
                console_is_interactive = echo;
                return 0;
   -        /* Ignore characters if there's no more buffer space */
   +            /* Ignore characters if there's no more buffer space */
            } else if (byte == CONSOLE_NLIP_PKT_START2) {
                /* Disable echo to not flood the UART */
                console_is_interactive = 0;
   @@ -352,9 +352,9 @@
    #endif
            default:
                insert_char(&input->line[cur], byte, end);
   -            /* Falls through. */
   +        /* Falls through. */
            case '\r':
   -            /* Falls through. */
   +        /* Falls through. */
            case '\n':
                if (byte == '\n' && prev_endl == '\r') {
                    /* handle double end line chars */
   ```
   
   </details>

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] utzig commented on issue #2233: Fix console echo handling

Posted by GitBox <gi...@apache.org>.
utzig commented on issue #2233: Fix console echo handling
URL: https://github.com/apache/mynewt-core/pull/2233#issuecomment-596582750
 
 
   ```
            default:
                insert_char(&input->line[cur], byte, end);
   -            /* Falls through. */
   +        /* Falls through. */
            case '\r':
   -            /* Falls through. */
   +        /* Falls through. */
            case '\n':
   ```
   
   Funny one, the style checker does not know what "fall through" means and thinks that your comment applies to the next `case`!

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2233: Fix console echo handling

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on issue #2233: Fix console echo handling
URL: https://github.com/apache/mynewt-core/pull/2233#issuecomment-596577098
 
 
   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### sys/console/minimal/src/console.c
   <details>
   
   ```diff
   @@ -346,9 +346,9 @@
    #endif
            default:
                insert_char(&input->line[cur], byte, end);
   -            /* Falls through. */
   +        /* Falls through. */
            case '\r':
   -            /* Falls through. */
   +        /* Falls through. */
            case '\n':
                if (byte == '\n' && prev_endl == '\r') {
                    /* handle double end line chars */
   ```
   
   </details>

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] apache-mynewt-bot commented on issue #2233: Fix console echo handling

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on issue #2233: Fix console echo handling
URL: https://github.com/apache/mynewt-core/pull/2233#issuecomment-596547070
 
 
   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### sys/console/full/src/console.c
   <details>
   
   ```diff
   @@ -1022,7 +1022,7 @@
                nlip_state = NLIP_PKT_START1;
            } else {
                handled = g_console_ignore_non_nlip &&
   -                !MYNEWT_VAL(CONSOLE_NLIP_ECHO_LF) && byte != '\r' && byte != '\n';
   +                      !MYNEWT_VAL(CONSOLE_NLIP_ECHO_LF) && byte != '\r' && byte != '\n';
            }
            break;
        }
   ```
   
   </details>
   
   #### sys/console/minimal/src/console.c
   <details>
   
   ```diff
   @@ -293,12 +292,13 @@
    
        if (!ev) {
            ev = os_eventq_get_no_wait(avail_queue);
   -        if (!ev)
   +        if (!ev) {
                return 0;
   +        }
            input = ev->ev_arg;
        }
    
   -    if (MYNEWT_VAL(CONSOLE_NLIP) && handle_nlip(byte))  {
   +    if (MYNEWT_VAL(CONSOLE_NLIP) && handle_nlip(byte)) {
            if (byte == '\n') {
                insert_char(&input->line[cur], byte, end);
                input->line[cur] = '\0';
   @@ -337,7 +337,7 @@
        if (!isprint(byte)) {
            switch (byte) {
    #if MYNEWT_VAL(CONSOLE_NLIP)
   -            case CONSOLE_NLIP_PKT_START1:
   +        case CONSOLE_NLIP_PKT_START1:
                nlip_state |= NLIP_PKT_START1;
                break;
            case CONSOLE_NLIP_DATA_START1:
   @@ -346,9 +346,9 @@
    #endif
            default:
                insert_char(&input->line[cur], byte, end);
   -            /* Falls through. */
   +        /* Falls through. */
            case '\r':
   -            /* Falls through. */
   +        /* Falls through. */
            case '\n':
                if (byte == '\n' && prev_endl == '\r') {
                    /* handle double end line chars */
   ```
   
   </details>

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [mynewt-core] dwld commented on issue #2233: Fix console echo handling

Posted by GitBox <gi...@apache.org>.
dwld commented on issue #2233: Fix console echo handling
URL: https://github.com/apache/mynewt-core/pull/2233#issuecomment-598898973
 
 
   > Hi @dwld could you please checked if this solution fixes problem that you detected?
   
   Hi @kasjer, thanks for your work. In my current project, I do not require NLIP. I just tested this PR with CONSOLE_ECHO: 0 and CONSOLE_NLIP: 0. Unfortunately, the new line is still there, since it is printed by lines 1168 and 1169 in console.c (`console_filter_out('\r');` and `console_filter_out('\n');`).
   
   Maybe we could add an option like your introduced CONSOLE_NLIP_ECHO_LF for NLIP to enable/disable (whatever is more reasonable) the new line echo in non-NLIP mode.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services