Skip to content

Instantly share code, notes, and snippets.

@securelyfitz
securelyfitz / ftscreen.sh
Created August 26, 2021 18:41
Use screen with custom baud rates on FTDI devices
#!/bin/bash
# since screen doesn't know how to set custom baud rates, this does it for FTDI devices.
# it works by using setserial to set the custom speed (spd_cust) mode for baud rate 38400
# it calculates the proper clock divider by dividing the device's base clock by the desired rate
# then, it starts screen at 38400 - which is not longer 38400 but your new clock rate.
# tested on FT232H, FT2232H, FT-X, and FT232RL
# does not work on CH341 or PL2303
# todo: confirm FTDI before running setserial and report error
# todo: validate uart range