Jumat, 16 Maret 2007

USB to Serial Adapter

My new laptop doesn't have a serial port. This is one of the great tragedies of modern laptops in my opinion. At least for situations where I want to connect to the serial port on a server or system with a serial port, I can use a USB to serial adapter like this adapter I bought at NewEgg. I tested it just now by connecting to the serial port on my old FreeBSD laptop.

First I enabled the serial port in /etc/ttys


#ttyd0 "/usr/libexec/getty std.9600" dialup off secure
ttyd0 "/usr/libexec/getty std.9600" dialup on secure

Then I restarted init to activate it.

# kill -HUP 1

On my Ubuntu laptop I attached the USB to serial adapter to a null modem and a gender changer, then connected it to the FreeBSD laptop serial port.

I installed cu(1) on Ubuntu

# apt-get install cu

then checked dmesg output to ensure I had a device to which I could connect.

[17213831.716000] usb 1-1: new full speed USB device using uhci_hcd and address 2
[17213831.876000] usb 1-1: configuration #1 chosen from 1 choice
[17213831.984000] usbcore: registered new driver usbserial
[17213831.984000] drivers/usb/serial/usb-serial.c: USB Serial support registered for generic
[17213831.984000] usbcore: registered new driver usbserial_generic
[17213831.984000] drivers/usb/serial/usb-serial.c: USB Serial Driver core
[17213831.988000] drivers/usb/serial/usb-serial.c: USB Serial support registered for pl2303
[17213831.992000] pl2303 1-1:1.0: pl2303 converter detected
[17213831.992000] usb 1-1: pl2303 converter now attached to ttyUSB0
[17213831.992000] usbcore: registered new driver pl2303
[17213831.992000] drivers/usb/serial/pl2303.c: Prolific PL2303 USB to serial adaptor driver

Now that I saw /dev/ttyUSB0 was enabled, I connected to it.

richard@neely:~$ cu -l /dev/ttyUSB0
Connected.

FreeBSD/i386 (orr.taosecurity.com) (ttyd0)

login: richard
Password:
Last login: Fri Mar 16 11:57:49 on ttyv1
Copyright (c) 1992-2006 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.

FreeBSD 6.1-SECURITY (GENERIC) #0: Wed Feb 14 15:33:28 UTC 2007

Welcome to FreeBSD!

That's it. If I needed to set a different speed I'd use the -s switch. For example, if 9600 above was 19200 in /etc/ttys, I'd use syntax like

richard@neely:~$ cu -l /dev/ttyUSB0 -s 19200

Now I know I can rely on this USB to serial adapter when I visit servers in the data center.

0 komentar:

Posting Komentar