apps/system/cu: Add a some configurable defaults (only to reduce my keystrokes in repetitive testing)
This commit is contained in:
parent
40e2a076fe
commit
ad1f59f497
@ -18,6 +18,21 @@ config SYSTEM_CUTERM
|
||||
|
||||
if SYSTEM_CUTERM
|
||||
|
||||
config SYSTEM_CUTERM_DEFAULT_DEVICE
|
||||
string "Default serial device"
|
||||
default "/dev/ttyS0"
|
||||
---help---
|
||||
Normally, the serial device to be used is provided on the command line.
|
||||
If no device is provided then this is the default device that will be\
|
||||
used.
|
||||
|
||||
config SYSTEM_CUTERM_DEFAULT_BAUD
|
||||
int "Default serial baud"
|
||||
default 115200
|
||||
---help---
|
||||
Normally, the BAUD to be used is provided on the command line. If no
|
||||
BAUD is provided then this is the default device that will be used.
|
||||
|
||||
config SYSTEM_CUTERM_STACKSIZE
|
||||
int "CU terminal stack size"
|
||||
default 2048
|
||||
|
@ -49,6 +49,15 @@
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
/* Configuration ***********************************************************/
|
||||
|
||||
#ifndef CONFIG_SYSTEM_CUTERM_DEFAULT_DEVICE
|
||||
# define CONFIG_SYSTEM_CUTERM_DEFAULT_DEVICE "/dev/ttyS0"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_SYSTEM_CUTERM_DEFAULT_BAUD
|
||||
# define CONFIG_SYSTEM_CUTERM_DEFAULT_BAUD 115200
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
|
@ -217,12 +217,14 @@ static int set_baudrate(int fd, int rate, enum parity_mode parity, int rtscts)
|
||||
static void print_help(void)
|
||||
{
|
||||
printf("Usage: cu [options]\n"
|
||||
" -l: Use named device (e.g. /dev/ttyS1)\n"
|
||||
" -l: Use named device (default %s)\n"
|
||||
" -e: Set even parity\n"
|
||||
" -o: Set odd parity\n"
|
||||
" -s: Use given speed\n"
|
||||
" -s: Use given speed (default %d)\n"
|
||||
" -r: Disable RTS/CTS flow control (default: on)\n"
|
||||
" -?: This help\n");
|
||||
" -?: This help\n",
|
||||
CONFIG_SYSTEM_CUTERM_DEFAULT_DEVICE,
|
||||
CONFIG_SYSTEM_CUTERM_DEFAULT_BAUD);
|
||||
}
|
||||
|
||||
static void print_escape_help(void)
|
||||
@ -269,14 +271,15 @@ int cu_main(int argc, FAR char *argv[])
|
||||
{
|
||||
pthread_attr_t attr;
|
||||
struct sigaction sa;
|
||||
FAR char *devname = NULL;
|
||||
int baudrate = 0;
|
||||
FAR char *devname = CONFIG_SYSTEM_CUTERM_DEFAULT_DEVICE;
|
||||
int baudrate = CONFIG_SYSTEM_CUTERM_DEFAULT_BAUD;
|
||||
enum parity_mode parity = PARITY_NONE;
|
||||
int rtscts = 1;
|
||||
int option;
|
||||
int ret;
|
||||
int bcmd;
|
||||
int start_of_line = 1;
|
||||
int exitval = EXIT_FAILURE;
|
||||
|
||||
/* Initialize global data */
|
||||
|
||||
@ -378,7 +381,7 @@ int cu_main(int argc, FAR char *argv[])
|
||||
|
||||
if (start_of_line == 1 && ch == '~')
|
||||
{
|
||||
/* we've seen and escape (~) character, echo it to local
|
||||
/* We've seen and escape (~) character, echo it to local
|
||||
* terminal and read the next char from serial
|
||||
*/
|
||||
|
||||
@ -418,6 +421,7 @@ int cu_main(int argc, FAR char *argv[])
|
||||
|
||||
pthread_cancel(g_cu.listener);
|
||||
pthread_attr_destroy(&attr);
|
||||
exitval = EXIT_SUCCESS;
|
||||
|
||||
/* Error exits */
|
||||
|
||||
@ -426,5 +430,5 @@ errout_with_fds:
|
||||
errout_with_outfd:
|
||||
close(g_cu.outfd);
|
||||
errout_with_devinit:
|
||||
return EXIT_FAILURE;
|
||||
return exitval;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user