Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I work with an RS-232 device via GNU screen.

$ screen /dev/ttyUSB0 115200

At some point I need to send a local file to the device using either the xmodem or kermit protocol. On Windows I use TeraTerm which has a corresponding menu item. How can I achieve this in GNU screen?

share|improve this question

the best way to pass a file through xmodem is to use sx. In debian this application is part of 'lrzsz' package.

In debian:

apt-get install screen lrzsz

screen /dev/ttyUSB0 115200

Then press Ctrl-A followed by : and type:

exec !! sx yourbinary.bin

This will send the file to ttyUSB0 over xmodem protocol

share|improve this answer
    
Can this operation be executed non-interactively, either with screen cu or any other package? – Vorac Oct 29 '15 at 8:06
    
@Vorac you can always do sx binary.bin | socat FILE:/dev/ttyUSB0,b115200,raw - – GnP Mar 24 at 19:59

If you want to use zmodem you have to set the zmodem option to pass, if your screen session is already running, press CTRL+A : and just enter zmodem pass . To send the data just use the sz command from the lrzsz package.

If you want to receive data via screen you have to set the value to catch.

share|improve this answer

If you are trying to do this through screen on OSX, you can follow the procedure laid out by user32704 with some small modifications. You will need to first build lrzsz from source, which can be found here:

https://ohse.de/uwe/releases/lrzsz-0.12.20.tar.gz

Then, instead of exec !! sx yourbinary.bin you should use:

exec !! lsz -X yourbinary.bin
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.