Screen and Linux tips

I normally use the Linux utility screen to connect to my BusPirate. I have two tips

  1. While connecting to the BP, if you want to scroll back the terminal history (i.e. to see the help menu), press "Control-A ESCAPE - and then you can use the up-arrow and down-arrow to scroll the display.
  2. Here is a trivial script I use with screen. It reminds me if the BusPirate is unplugged or in bootloader mode.
# Launch BusPirate using screen
#       BusPirate
#       BusPirate /dev/ttyACM2 - if it's on a different port
TT=${1:-"/dev/ttyACM0"} # default port
# You have to change this to match your ID
#Is it in bookloader mode?
if [ -d /media/$USER/RPI-RP2 ]
    echo "Unplug and replug the BusPirate"
elif [ -d /media/$USER/$ID/ ]
    # Looks good
    screen "$TT" 115200
    # What? No Bus Pirate?!?!
    echo "Please plug in your Bus Pirate"
1 Like

Typo! Bootloader not bookloader😋


I love a good script!

I’d like to make a script that watches the bus pirate firmware file for changes (python watchman?), then sends bootloader code to Bus Pirate binary interface. Watch for the USB drive to attach, copy the firmware.

I think it will be faster than the debugger when I don’t need to step code.

I’m using screen to connect to BP v5, did you manage to get colors on the terminal? I’m using MacOS with iTerm2.

I’m not sure about screen, but iTerm2 seems to support VT100-like escape commands. They recommend using them in their faq page to test boldness.

Yep, iTerm2 works great, but connecting to serial using screen doesn’t work.

I made it work using pyserial miniterm:

Command line:

python -m --raw /dev/tty.usbmodem1234567890121 115200

1 Like

While screen is an excellent tool, I’d highly recommend checking out tio, which is a serial terminal emulator specifically designed for hardware hacking/development:

It has a lot of nice features, such as defaulting to 115200 8n1 and gracefully reconnecting when a serial device goes down and comes back up (like when updating the firmware on the BP5). It also offers a remapping function which can fix some of the unusual behaviors the BP exhibits under different platforms (such as backspace not working).

In the config file, you can even setup profiles for different devices. Mine looks like this:

# Config file for tio serial terminal emulator

device = /dev/ttyACM0

device = /dev/ttyUSB0

This lets me connect to either the v5 or v3 Bus Pirate by simply running:

tio bp5


tio bp3

Thanks for the tip. I’ll check it out.

Hmm. I Installed tio and used your config file. When I connect to the BP I get no response to anything I type. Is that your entire config file?
tio /dev/ttyACM0
works fine…

Aha. The standard tio installed via apt was an old rev. I had to uninstall tio, install meson, and install tio from the github source, and make sure /usr/local/bin was in my searchpath.

BTW, the toolbar display is much nicer looking than screen. I might just be a convert!

I should have been suspicious when I typed “man tio” and there was no mention of the config file.

Which version of tio do you have now? I was/am still using screen but considering converting my faith when its good replacement

Also I would suggest some udev rules that make /dev/buspirate3 and /dev/buspirate5 for example. In case you have more ttys in your system. Mentioned here:

The version of tio that Ubuntu installed was 1.2
The Github version is 2.8

tio also allows you to use the device ID, i.e.

I thought that I could use this to automatically distinguish between my rev8 and rev10, but they have the same ID. They have the same serial # as well. I wonder if Ian is going to assign unique serial numbers to them in the future. [edited]

tio can also remap the DEL/BACKSPACE/CONTROL-H keys. I think screen can do this, but i didn’t see an obvious way to do it. The man page for tio is 480 lines, which for screen it’s 3278 lines long.

So I switched to tio. Thank you for this suggestion. Now the colors are correct and its easier to scroll up.

Now I have bash aliases for buspirate3 and buspirate5 :slight_smile: