Skip to content

shell_putc() prints chars twice when using buffered output #22

@joemcool

Description

@joemcool

shell_putc() calls both shell_writer() and obhandle->shell_bwriter() if both are not 0. This results in chars being printed twice, once by each writer. There is no way to avoid this condition when using buffered output, since shell_writer() is required by shell_init() and there's no way to undefined it.

Steps to reproduce:
--Initialize the shell as in the Shell_Basic example
--Add a buffered writer, something like:

void shell_buffered_writer(char* buffer, uint8_t count)  
{  
  // If we can write to a client  
  if(client==true && client.connected())  
  {  
    client.write(buffer, count);  
  }  
}

--Write enough output with shell_print() to trigger a buffered write
--Observe that the output is written twice

Proposed solution:
Rework the if statements in shell_putc() so that only one writer is called

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions