Wednesday, February 11, 2009

Of Macs and serial ports

My trusty iBook, as all Macintosh computers manufactured in the last few years, have no serial port. That has never stopped me from doing work as I had a Linux laptop, a Dell Latitude D600, which I would bring whenever I needed to talk to a Cisco switch or use as console for a Unix workstation (say, Sun Solaris or IBM AIX box).

But, then, the Dell laptop died. And I needed to configure a cisco switch from scratch... at least configure it enough so I could then telnet to it. To do that I needed to connect the famous Cisco blue console cable to the Mac. I needed a usb-to-serial cable.

Not knowing where to find one of those usb-to-serial cables, I decided to try one of my favorite places: geeks.com. I not only found it but here is a picture of the cable:

Clicking on the image *should* lead you to the link for the cable. After I received it, I connected it to the Mac. The laptop was aware of the device, even recognizing its chipset. But, it would not be available for use. Here is what I mean:

Mireille:~ dalek$ ls /dev/tty.*
/dev/tty.Bluetooth-Modem                /dev/tty.Nokia6103-NokiaPCSuite-1
/dev/tty.Bluetooth-PDA-Sync             /dev/tty.modem
/dev/tty.Nokia6103-Dial-upnetwor-2
Mireille:~ dalek$ 

Clearly, I need a driver for it. Examining the information shown by the machine about the driver, we see the chipset is made by prolific. After a bit of searching online, I found the manufacturer's site and downloaded the drivers from its site. Do note in that page that they also have drivers for Windows and even Linux. I do not know if Linux would ever need such a driver; finding that out is for a different episode. Anyway, after installing it, we had to reboot the laptop. After that, it was time to connect the usb-to-serial cable and find out if it was seen as a device we could use. Can you spot the new entry?

Mireille:~ dalek$ ls /dev/tty.*
/dev/tty.Bluetooth-Modem                /dev/tty.Nokia6103-NokiaPCSuite-1
/dev/tty.Bluetooth-PDA-Sync             /dev/tty.modem
/dev/tty.Nokia6103-Dial-upnetwor-2      /dev/tty.usbserial
Mireille:~ dalek$ 

Now we have a device, tty.usbserial, we can try it out. We could install minicom using fink, but we can be a bit lazy and use, of all things, screen. Believe it or not, screen can also be used to connect to a terminal device. So, if you type something like

Mireille:~ dalek$ screen /dev/tty.usbserial 9600

you would be telling screen to connect to our usb-to-serial cable, identified as tty.usbserial, at 9600baud which happens to be the default port speed for a Cisco switch. Neat, huh?