Rename mapping flag MSB2LSB to IMSB2LSB

This is the correct naming since we are changing the input bit order on
input from the serial device.
This commit is contained in:
Martin Lund 2024-06-29 12:14:29 +02:00
parent 9022f51ea5
commit d34fa1c1ad
5 changed files with 30 additions and 30 deletions

View file

@ -216,6 +216,8 @@ Map FF to ESC-c on input
Map NL to CR on input Map NL to CR on input
.IP "\fBINLCRNL" .IP "\fBINLCRNL"
Map NL to CR-NL on input Map NL to CR-NL on input
.IP "\fBIMSB2LSB"
Map MSB bit order to LSB on input
.IP "\fBOCRNL" .IP "\fBOCRNL"
Map CR to NL on output Map CR to NL on output
.IP "\fBODELBS" .IP "\fBODELBS"
@ -228,8 +230,6 @@ Map lowercase characters to uppercase on output
Map nul (zero) to send break signal on output Map nul (zero) to send break signal on output
.IP "\fBOIGNCR" .IP "\fBOIGNCR"
Ignore CR on output Ignore CR on output
.IP "\fBMSB2LSB"
Map MSB bit order to LSB on output
.P .P
If defining more than one flag, the flags must be comma separated. If defining more than one flag, the flags must be comma separated.
.RE .RE

View file

@ -85,7 +85,7 @@ _tio()
return 0 return 0
;; ;;
-m | --map) -m | --map)
COMPREPLY=( $(compgen -W "ICRNL IGNCR INLCR IFFESCC INLCRNL OCRNL ODELBS ONLCRNL OLTU ONULBRK OIGNCR MSB2LSB" -- ${cur}) ) COMPREPLY=( $(compgen -W "ICRNL IGNCR INLCR IFFESCC INLCRNL IMSB2LSB OCRNL ODELBS ONLCRNL OLTU ONULBRK OIGNCR" -- ${cur}) )
return 0 return 0
;; ;;
--timestamp-format) --timestamp-format)

View file

@ -118,7 +118,7 @@ struct option_t option =
.map_o_del_bs = false, .map_o_del_bs = false,
.map_o_ltu = false, .map_o_ltu = false,
.map_o_nulbrk = false, .map_o_nulbrk = false,
.map_o_msblsb = false, .map_i_msb2lsb = false,
.map_o_ign_cr = false, .map_o_ign_cr = false,
}; };
@ -773,9 +773,9 @@ void option_parse_mappings(const char *map)
{ {
option.map_o_ign_cr = true; option.map_o_ign_cr = true;
} }
else if (strcmp(token, "MSB2LSB") == 0) else if (strcmp(token, "IMSB2LSB") == 0)
{ {
option.map_o_msblsb = true; option.map_i_msb2lsb = true;
} }
else else
{ {

View file

@ -103,7 +103,7 @@ struct option_t
bool map_o_del_bs; bool map_o_del_bs;
bool map_o_ltu; bool map_o_ltu;
bool map_o_nulbrk; bool map_o_nulbrk;
bool map_o_msblsb; bool map_i_msb2lsb;
bool map_o_ign_cr; bool map_o_ign_cr;
}; };

View file

@ -623,7 +623,7 @@ static void mappings_print(void)
if (option.map_i_cr_nl || option.map_ign_cr || option.map_i_ff_escc || if (option.map_i_cr_nl || option.map_ign_cr || option.map_i_ff_escc ||
option.map_i_nl_cr || option.map_i_nl_crnl || option.map_o_cr_nl || option.map_i_nl_cr || option.map_i_nl_crnl || option.map_o_cr_nl ||
option.map_o_del_bs || option.map_o_nl_crnl || option.map_o_ltu || option.map_o_del_bs || option.map_o_nl_crnl || option.map_o_ltu ||
option.map_o_nulbrk || option.map_o_msblsb || option.map_o_ign_cr) option.map_o_nulbrk || option.map_i_msb2lsb || option.map_o_ign_cr)
{ {
tio_printf(" Mappings:%s%s%s%s%s%s%s%s%s%s%s%s", tio_printf(" Mappings:%s%s%s%s%s%s%s%s%s%s%s%s",
option.map_i_cr_nl ? " ICRNL" : "", option.map_i_cr_nl ? " ICRNL" : "",
@ -631,13 +631,13 @@ static void mappings_print(void)
option.map_i_ff_escc ? " IFFESCC" : "", option.map_i_ff_escc ? " IFFESCC" : "",
option.map_i_nl_cr ? " INLCR" : "", option.map_i_nl_cr ? " INLCR" : "",
option.map_i_nl_crnl ? " INLCRNL" : "", option.map_i_nl_crnl ? " INLCRNL" : "",
option.map_i_msb2lsb ? " IMSB2LSB" : "",
option.map_o_cr_nl ? " OCRNL" : "", option.map_o_cr_nl ? " OCRNL" : "",
option.map_o_del_bs ? " ODELBS" : "", option.map_o_del_bs ? " ODELBS" : "",
option.map_o_nl_crnl ? " ONLCRNL" : "", option.map_o_nl_crnl ? " ONLCRNL" : "",
option.map_o_ltu ? " OLTU" : "", option.map_o_ltu ? " OLTU" : "",
option.map_o_nulbrk ? " ONULBRK" : "", option.map_o_nulbrk ? " ONULBRK" : "",
option.map_o_ign_cr ? " OIGNCR" : "", option.map_o_ign_cr ? " OIGNCR" : "");
option.map_o_msblsb ? " MSB2LSB" : "");
} }
else else
{ {
@ -772,33 +772,33 @@ void handle_command_sequence(char input_char, char *output_char, bool *forward)
tio_printf("INLCRNL is %s", option.map_i_nl_crnl ? "set" : "unset"); tio_printf("INLCRNL is %s", option.map_i_nl_crnl ? "set" : "unset");
break; break;
case KEY_5: case KEY_5:
option.map_i_msb2lsb = !option.map_i_msb2lsb;
tio_printf("IMSB2LSB is %s", option.map_i_msb2lsb ? "set" : "unset");
break;
case KEY_6:
option.map_o_cr_nl = !option.map_o_cr_nl; option.map_o_cr_nl = !option.map_o_cr_nl;
tio_printf("OCRNL is %s", option.map_o_cr_nl ? "set" : "unset"); tio_printf("OCRNL is %s", option.map_o_cr_nl ? "set" : "unset");
break; break;
case KEY_6: case KEY_7:
option.map_o_del_bs = !option.map_o_del_bs; option.map_o_del_bs = !option.map_o_del_bs;
tio_printf("ODELBS is %s", option.map_o_del_bs ? "set" : "unset"); tio_printf("ODELBS is %s", option.map_o_del_bs ? "set" : "unset");
break; break;
case KEY_7: case KEY_8:
option.map_o_nl_crnl = !option.map_o_nl_crnl; option.map_o_nl_crnl = !option.map_o_nl_crnl;
tio_printf("ONLCRNL is %s", option.map_o_nl_crnl ? "set" : "unset"); tio_printf("ONLCRNL is %s", option.map_o_nl_crnl ? "set" : "unset");
break; break;
case KEY_8: case KEY_9:
option.map_o_ltu = !option.map_o_ltu; option.map_o_ltu = !option.map_o_ltu;
tio_printf("OLTU is %s", option.map_o_ltu ? "set" : "unset"); tio_printf("OLTU is %s", option.map_o_ltu ? "set" : "unset");
break; break;
case KEY_9: case KEY_A:
option.map_o_nulbrk = !option.map_o_nulbrk; option.map_o_nulbrk = !option.map_o_nulbrk;
tio_printf("ONULBRK is %s", option.map_o_nulbrk ? "set" : "unset"); tio_printf("ONULBRK is %s", option.map_o_nulbrk ? "set" : "unset");
break; break;
case KEY_A: case KEY_B:
option.map_o_ign_cr = !option.map_o_ign_cr; option.map_o_ign_cr = !option.map_o_ign_cr;
tio_printf("OIGNCR is %s", option.map_o_ign_cr ? "set" : "unset"); tio_printf("OIGNCR is %s", option.map_o_ign_cr ? "set" : "unset");
break; break;
case KEY_B:
option.map_o_msblsb = !option.map_o_msblsb;
tio_printf("MSB2LSB is %s", option.map_o_msblsb ? "set" : "unset");
break;
default: default:
tio_error_print("Invalid input"); tio_error_print("Invalid input");
break; break;
@ -997,20 +997,20 @@ void handle_command_sequence(char input_char, char *output_char, bool *forward)
option.map_i_nl_cr ? "Unset" : "Set"); option.map_i_nl_cr ? "Unset" : "Set");
tio_printf(" (4) INLCRNL: %s mapping NL to CR-NL on input", tio_printf(" (4) INLCRNL: %s mapping NL to CR-NL on input",
option.map_i_nl_cr ? "Unset" : "Set"); option.map_i_nl_cr ? "Unset" : "Set");
tio_printf(" (5) OCRNL: %s mapping CR to NL on output", tio_printf(" (5) IMSB2LSB: %s mapping MSB bit order to LSB on input",
option.map_i_msb2lsb ? "Unset" : "Set");
tio_printf(" (6) OCRNL: %s mapping CR to NL on output",
option.map_o_cr_nl ? "Unset" : "Set"); option.map_o_cr_nl ? "Unset" : "Set");
tio_printf(" (6) ODELBS: %s mapping DEL to BS on output", tio_printf(" (7) ODELBS: %s mapping DEL to BS on output",
option.map_o_del_bs ? "Unset" : "Set"); option.map_o_del_bs ? "Unset" : "Set");
tio_printf(" (7) ONLCRNL: %s mapping NL to CR-NL on output", tio_printf(" (8) ONLCRNL: %s mapping NL to CR-NL on output",
option.map_o_nl_crnl ? "Unset" : "Set"); option.map_o_nl_crnl ? "Unset" : "Set");
tio_printf(" (8) OLTU: %s mapping lowercase to uppercase on output", tio_printf(" (9) OLTU: %s mapping lowercase to uppercase on output",
option.map_o_ltu ? "Unset" : "Set"); option.map_o_ltu ? "Unset" : "Set");
tio_printf(" (9) ONULBRK: %s mapping NUL to send break signal on output", tio_printf(" (a) ONULBRK: %s mapping NUL to send break signal on output",
option.map_o_nulbrk ? "Unset" : "Set"); option.map_o_nulbrk ? "Unset" : "Set");
tio_printf(" (a) OIGNCR: %s ignoring CR on output", tio_printf(" (b) OIGNCR: %s ignoring CR on output",
option.map_o_ign_cr ? "Unset" : "Set"); option.map_o_ign_cr ? "Unset" : "Set");
tio_printf(" (b) MSB2LSB: %s mapping MSB bit order to LSB on output",
option.map_o_msblsb ? "Unset" : "Set");
// Process next input character as sub command // Process next input character as sub command
sub_command = SUBCOMMAND_MAP; sub_command = SUBCOMMAND_MAP;
@ -2513,7 +2513,7 @@ int tty_connect(void)
} }
/* Convert MSB to LSB bit order */ /* Convert MSB to LSB bit order */
if (option.map_o_msblsb) if (option.map_i_msb2lsb)
{ {
char ch = input_char; char ch = input_char;
input_char = 0; input_char = 0;
@ -2524,7 +2524,7 @@ int tty_connect(void)
} }
/* Map input character */ /* Map input character */
if ((input_char == '\n') && (option.map_i_nl_crnl) && (!option.map_o_msblsb)) if ((input_char == '\n') && (option.map_i_nl_crnl) && (!option.map_i_msb2lsb))
{ {
printchar('\r'); printchar('\r');
printchar('\n'); printchar('\n');
@ -2533,7 +2533,7 @@ int tty_connect(void)
do_timestamp = true; do_timestamp = true;
} }
} }
else if ((input_char == '\f') && (option.map_i_ff_escc) && (!option.map_o_msblsb)) else if ((input_char == '\f') && (option.map_i_ff_escc) && (!option.map_i_msb2lsb))
{ {
printchar('\e'); printchar('\e');
printchar('c'); printchar('c');