It depends. There is no one size fits all answer. It depends on the type of data and the preipheral device where it's being received.
This will only work if the other end is capable of receiving it. And this depends on the capabilities of the firmware of the device.I haven't done this for a while but if I was connected over a serial TTY then I'd use the (X|Y|Z)modem protocol
The GoFlex Home has a firmware recovery mechanism built into the bootloader.
So if you can't get kwboot to work it sounds like you'll need to figure out this initial interaction first by looking at kwboot's source. I think you can invoke lsx from cu using ~C, or Minicom can do it too once its set up.Following power-up or a system reset, system BootROM code polls the UART for a brief period of time, sensing a handshake message which initiates an image upload. This
sends this boot message until it receives a positive acknowledgement. The image is transferred using Xmodem.
It sounds like kwboot does a little more than just sending the file:
So if you can't get kwboot to work it sounds like you'll need to figure out this initial interaction first by looking at kwboot's source. I think you can invoke lsx from cu using ~C, or Minicom can do it too once its set up.
xmodem_send(int tty_fd, int in_fd)
{
unsigned char packet[134];
static const int buflen = 128;
int packetno, lastpacket;
int c;
int retry;
int res;
printf("Sending file...");
/* We have already received a NAK, but wait for another to be sure */
if (wait_for_nak(tty_fd) == -1)
return -1;
lastpacket = 0;
packetno = 1;
for (retry = 0; retry < MAX_RETRANS; ++retry) {
rotator();
if (packetno != lastpacket) {
res = build_packet(in_fd, packetno, packet, buflen);
if (res == -1) return -1;
if (res == 1) break;
lastpacket = packetno;
}
else
printf("*%d*.", retry);
c = send_packet(tty_fd, packet, buflen + 4);
if (c == -1) {
if (errno == ETIMEDOUT)
continue; /* retry if timed out */
fprintf(stderr,
"%s: error writing to serial port: %m\n", argv0);
break;
}
switch (c) {
case ACK:
retry = 0;
++packetno;
break;
case CAN:
printf("cancelled by remote\n");
if ((c = read_byte(tty_fd, 1)) == CAN) {
write_byte(tty_fd, ACK);
tcdrain(tty_fd);
return -1;
}
break;
default:
printf("unexpected character %02x\n", c);
case NAK:
break;
}
}
if (retry == MAX_RETRANS) {
fprintf(stderr, "Too many retries, cancelling send\n");
cancel_send(tty_fd);
return -1; /* xmit error */
}
printf("\nFinishing...");
for (retry = 0; retry < MAX_RETRANS; ++retry) {
write_byte(tty_fd, EOT);
tcdrain(tty_fd);
if ((c = read_byte(tty_fd, 1)) == ACK)
break;
}
if (c != ACK) {
puts("failed\n");
return -1;
}
puts("done\n");
return 0;
}