Mac OSXでFTDIのドライバが刺さって強制再起動になるのでRaspiでシリアルサーバーを作った
Mac OSXでスイッチサイエンスのUSB-TTL変換を使っていると、抜いたタイミングでドライバが刺さって、OSXが強制再起動してしまうことがある。
何かと面倒くさいし心が折れるので、遊んでいるRaspiでシリアルサーバーを作ることにした。
特に難しいことはない。ether経由でログインして、USBシリアルを有効にして、minicom使うだけ。
RaspiのSDカードをインストールし直すのも面倒くさいので、raspbianは入ってたjessieのまま使う。
pi@raspberrypi:~ $ sudo apt-get update pi@raspberrypi:~ $ sudo apt-get install minicom lrzsz
USBシリアルを刺す。
[ 415.459959] usb 1-1.2: new full-speed USB device number 4 using dwc_otg [ 415.617059] usb 1-1.2: New USB device found, idVendor=0403, idProduct=6001 [ 415.617080] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 415.617091] usb 1-1.2: Product: FT232R USB UART [ 415.617101] usb 1-1.2: Manufacturer: FTDI [ 415.617112] usb 1-1.2: SerialNumber: A702IZ5W [ 416.734320] usbcore: registered new interface driver usbserial [ 416.734465] usbcore: registered new interface driver usbserial_generic [ 416.734629] usbserial: USB Serial support registered for generic [ 416.749000] usbcore: registered new interface driver ftdi_sio [ 416.749157] usbserial: USB Serial support registered for FTDI USB Serial Device [ 416.749672] ftdi_sio 1-1.2:1.0: FTDI USB Serial Device converter detected [ 416.784749] usb 1-1.2: Detected FT232RL [ 416.786093] usb 1-1.2: FTDI USB Serial Device converter now attached to ttyUSB0
デバイス名は、普通にttyUSB0か。
pi@raspberrypi:~ $ sudo minicom -s
+-----[configuration]------+
| Filenames and paths |
| File transfer protocols |
| Serial port setup |
| Modem and dialing |
| Screen and keyboard |
| Save setup as dfl |
| Save setup as.. |
| Exit |
| Exit from Minicom |
+--------------------------+
Serial port setupを選んでAキーを押し、デバイス名を変更する。
A - Serial Device : /dev/ttyUSB0
Save setup as dflで設定を変更して、Exit from Minicomで一旦終了。
BBBにTTL側を接続して、minicomを起動する。
pi@raspberrypi:~ $ sudo minicom
Debian GNU/Linux 7 beaglebone ttyO0
default username:password is [debian:temppwd]
Support/FAQ: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian
The IP Address for usb0 is: 192.168.7.2
beaglebone login:
よし来た。
これで、強制再起動に怯えずに作業できるわー。
お手軽さはだいぶ下がるけどね。
このRaspiは他の用途にも使っているので、sshログインですぐにシリアル出るような設定にはしない。
ほんとは、アカウント別に作ってログインシェルをターミナルアプリにしたほうがシリアルサーバーっぽくて楽かな?
minicomじゃなくてscreenを使うと、面倒くさくはないんだけど動的にボーレートの変更できないのがイマイチ。