/* Echoes characters received from CLI. Implements CLI feedback. */
int32_t cn0415_parse(struct cn0415_dev *dev)
/* Echoes characters received from CLI. Implements CLI feedback. */
int32_t cn0415_parse(struct cn0415_dev *dev)
{
	int32_t ret;
	uint8_t c = 0, rdy = 1;
	ret = usr_uart_read_nb(dev->aducm3029_uart_desc, &c, &rdy);
	if(ret != 0)
		return ret;
	if(rdy == 1) {
		switch(c) {
		case _LF:
		case _CR:
			uart_cmd = UART_TRUE;
			break;
		case _BS:
			if(uart_line_index == 0)
				break;
			uart_line_index--;
			break;
		case _NC:
			break;
		default:
			uart_current_line[uart_line_index++] = c;
			if(uart_line_index == 256) {
				uart_line_index--;
			}
		}
		uart_current_line[uart_line_index] = '\0';
	}
	return ret;
}