Added support to receive XMODEM-CRC files from the connected serial port.

This commit is contained in:
Eliot Alan Foss 2024-05-28 15:22:29 -07:00 committed by Martin Lund
parent 94e40d82f3
commit d10e762a7d
3 changed files with 403 additions and 7 deletions

View file

@ -692,7 +692,7 @@ void handle_command_sequence(char input_char, char *output_char, bool *forward)
{
tio_printf("Sending file '%s' ", line);
tio_printf("Press any key to abort transfer");
tio_printf("%s", xymodem_send(device_fd, line, XMODEM_CRC) < 0 ? "Aborted" : "Done");
tio_printf("%s", xymodem_send(device_fd, line, XMODEM_1K) < 0 ? "Aborted" : "Done");
}
break;
@ -707,6 +707,17 @@ void handle_command_sequence(char input_char, char *output_char, bool *forward)
}
break;
case KEY_2:
tio_printf("Receive file with XMODEM-CRC");
tio_printf_raw("Enter file name: ");
if (tio_readln())
{
tio_printf("Ready to receiving file '%s' ", line);
tio_printf("Press any key to abort transfer");
tio_printf("%s", xymodem_receive(device_fd, line, XMODEM_CRC) < 0 ? "Aborted" : "Done");
}
break;
default:
tio_error_print("Invalid protocol option");
break;
@ -758,7 +769,7 @@ void handle_command_sequence(char input_char, char *output_char, bool *forward)
tio_printf(" ctrl-%c t Toggle line timestamp mode", option.prefix_key);
tio_printf(" ctrl-%c U Toggle conversion to uppercase on output", option.prefix_key);
tio_printf(" ctrl-%c v Show version", option.prefix_key);
tio_printf(" ctrl-%c x Send file via Xmodem", option.prefix_key);
tio_printf(" ctrl-%c x Send/Receive file via Xmodem", option.prefix_key);
tio_printf(" ctrl-%c y Send file via Ymodem", option.prefix_key);
tio_printf(" ctrl-%c ctrl-%c Send ctrl-%c character", option.prefix_key, option.prefix_key, option.prefix_key);
break;
@ -956,8 +967,9 @@ void handle_command_sequence(char input_char, char *output_char, bool *forward)
case KEY_X:
tio_printf("Please enter which X modem protocol to use:");
tio_printf(" (0) XMODEM-1K");
tio_printf(" (1) XMODEM-CRC");
tio_printf(" (0) XMODEM-1K send");
tio_printf(" (1) XMODEM-CRC send");
tio_printf(" (2) XMODEM-CRC receive");
// Process next input character as sub command
sub_command = SUBCOMMAND_XMODEM;
break;