We can also send Morse code not only from a keyboard but from a text.
% echo "cq de jh1ood k" | ic-7410_cw_keyboard
% ic-7410_cw_keyboard < message1.txt
At EOF, we need to wait a little bit before exiting so that all the text is transmitted to IC-7410. This is not very smart, so it might be better to check the ack from IC-7410 instead of just waiting for a fixed period.
diff -c ic-7410_cw_keyboard.c ic-7410_cw_keyboard_from_text.c while (1) { nread = read (STDIN_FILENO, &c, 1); + if(nread == 0) { sleep(2); return EXIT_SUCCESS;} message[count++]=c; if (c == '\004') { /* C-d */ break;