Sending a Serial Break to a Cisco on Mac OSX

Ever need to reset the enable password of your Cisco router? One of the ways to do it involves sending a Break over the serial console line during boot. However! If you don’t have a good old-fashioned 100% genuine built-in serial port (and who the hell does these days!), but instead are using a USB to Serial adapter, this can sometimes be difficult. You youngins may not understand what a Break is on a serial port 😉 — but knowing what it is makes it a bit more clear why crappy $2 serial adapters suck at it. You know, these things:

Cheapie USB to Serial adapter

Cheapie USB to Serial adapter

In a serial port, you have a physical wire that transmits your data, called TXD. There are plenty of others, but that’s the one of concern. Normally while idle, the line is held at a logical 1 voltage level. (we say “logical” so you don’t make any assumptions about the voltage level, which may not intuitively map to the 1 or 0 value as you expect. In this case the actual voltage doesn’t matter, but RS232 typically swings between positive and negative 12-ish volts.) Data is sent by changing between logical 1 and logical 0 for each byte you send.

One RS-232 Data Frame

One RS-232 Data Frame

A Break is a kind of out-of-band signal – something you want to tell the receiving equipment that is NOT part of your data. Hence, it’s transmitted in a different way than your data bytes, so that the receiving equipment can know that it’s not data. For the Break, the TXD line is held at a logical 0 voltage for longer than one data frame. (There are short breaks and long breaks, also.)

As the Break is not just simple data being transmitted, you’ll find that some USB to Serial adapters and drivers don’t support sending Breaks properly. The Prolific pl2303 is one that I’ve had problems sending Break with on Mac OSX 10.9 Yosemite. (I haven’t tried one of the FTDI-based adapters that I have bumping around somewhere.) The manufacturer-supplied driver just doesn’t do it right, at least, the version that I downloaded and installed in late-2014. When I had to reset the password on a Cisco 1700 series router, using GNU Screen as the terminal app and typing C-a B or C-a C-b, it wouldn’t respond.

UPDATE 8/28: Please note! The open-source driver doesn’t work in Yosemite! There’s some stupid kext signing thing that kills it. You can uninstall it if you need by removing the osx-pl2303.kext directory from /System/Library/Extensions, and then reinstall the manufacturer’s driver. But you may lose the break! I haven’t tested. Bollox.

But there’s a workaround discussed by scottm32768 over here: Just be warned that enabling dev mode for kernel extensions opens a nice big security hole, letting Bad Guys run Bad Things if they get access to your machine. Practically speaking, it’s not a big deal. But still, be aware of your security exposure so you can act in proper context.

Luckily Martijn Pepping created an open-source pl2303 driver that supports sending Break, and changux has a GUI installer wrapper for it here. Thanks to both of them for helping us all out!

By the way, if you need to uninstall an existing Prolific driver before installing the open-source one, you can do it something like this:

# Delete the driver kernel extension...
sudo rm -rf /System/Library/Extensions/ProlificUsbSerial.kext
sudo kextcache -system-cache

# then verify that it's gone and the device doesn't show up,
# assuming you know what the device was before you deleted it!
ls /dev/tty*

Have fun sending Breaks!