HAYAGUI

MacOS X 10.3 (Panther) + USB-シリアル変換ケーブル(VS-60R)

はじめに

Windows用の USB to Serial 変換ケーブル(アダプタ)は沢山ありますが、MacOSXに対応しているものはあまりありません。 検索で見つかるのは、keyspanのUSA-19QWぐらい。

無線LANルータの WRT54G を買う為ヨドバシカメラに行った時、サン電子製の VS-60R を見つけました。なんと MacOSX対応!

MacOSX 10.3 に挿す

MacOSX 10.3 の iBook に挿すと、以下のように認識されます。

デバイスとしては、/dev/cu.usbmodemUSB-COM として認識されます。

ibg4:/dev kenz$ ls -la cu*
crw-rw-rw-  1 root  wheel    8,   5 29 Dec 17:45 cu.Bluetooth-Modem
crw-rw-rw-  1 root  wheel    8,   3 29 Dec 17:45 cu.Bluetooth-PDA-Sync
crw-rw-rw-  1 root  wheel    8,   1 29 Dec 17:45 cu.modem
crw-rw-rw-  1 root  wheel    8,   7 29 Dec 17:46 cu.usbmodemUSB-COM

minicom

シリアル通信アプリケーションとして、minicom をfinkでインストールしました。
ibg4:~ kenz$ fink list | grep minicom
        minicom 2.00.0-2        Serial communication program
ibg4:~ kenz$ 
ibg4:~ kenz$ fink install minicom
でも設定ができず。ヘルプは表示できるが、次のように設定を行おうとすると固まる。
ibg4:~ kenz$ sudo /sw/bin/minicom -s

では、fink を使わないでソースをゲットしてコンパイル。インストールディレクトリ先を /usr/local/minicom として configure する。

ibg4:~/minicom-2.1 kenz$ ./configure  --prefix=/usr/local/minicom
ibg4:~/minicom-2.1 kenz$ make
インストール先を作ってからインストール。
ibg4:~/minicom-2.1 kenz$ sudo mkdir /usr/local/minicom
Password:
ibg4:~/minicom-2.1 kenz$ sudo make install 
インストールされたバイナリは次の通り。
ibg4:/usr/local/minicom/bin kenz$ pwd 
/usr/local/minicom/bin
ibg4:/usr/local/minicom/bin kenz$ ls -la
total 1104
drwxr-xr-x  6 root  wheel     204 30 Dec 14:44 .
drwxr-xr-x  6 root  wheel     204 30 Dec 14:44 ..
-rwxr-xr-x  1 root  wheel   21800 30 Dec 14:44 ascii-xfr
-rwxr-xr-x  1 root  wheel  419632 30 Dec 14:44 minicom
-rwxr-xr-x  1 root  wheel  112468 30 Dec 14:44 runscript
-rwxr-xr-x  1 root  wheel    1119 30 Dec 14:44 xminicom
ibg4:/usr/local/minicom/bin kenz$ 
ヘルプはこのように。
ibg4:/usr/local/minicom/bin kenz$ /usr/local/minicom/bin/minicom -h
Usage: minicom [OPTION]... [configuration]
A terminal program for Linux and other unix-like systems.

  -s, --setup            : enter setup mode (only as root)
  -o, --noinit           : do not initialize modem & lockfiles at startup
  -m, --metakey          : use meta or alt key for commands
  -M, --metakey8         : use 8bit meta key for commands
  -l, --ansi             : literal; assume screen uses the IBM-PC character set
  -L, --iso              : Ditto, but assume screen uses ISO8859
  -w, --wrap             : Linewrap on
  -z, --statline         : try to use terminal's status line
  -8, --8bit             : 8bit clean mode (for Japanese, etc)
  -c, --color=on/off     : ANSI style color usage on or off
  -a, --attrib=on/off    : use reverse or highlight attributes on or off
  -t, --term=TERM        : override TERM environment variable
  -S, --script=SCRIPT    : run SCRIPT at startup
  -d, --dial=ENTRY       : dial ENTRY from the dialing directory
  -p, --ptty=TTYP        : connect to pseudo terminal
  -C, --capturefile=FILE : start capturing to FILE
  -T, --disabletime      : disable display of online time
  -v, --version          : output version information and exit
  configuration          : configuration file to use

These options can also be specified in the MINICOM environment variable.
This variable is currently unset.
The configuration directory for the access file and the configurations
is compiled to /usr/local/minicom/etc.

Report bugs to <minicom-devel@lists.alioth.debian.org>.
ibg4:/usr/local/minicom/bin kenz$ 
設定ファイルを最初に作成しておかないと作成されないみたいなので、空ファイルを作る。
ibg4:~ kenz$ sudo mkdir /usr/local/minicom/etc
ibg4:~ kenz$ sudo touch /usr/local/minicom/etc/minirc.dfl
-s オプションを付けて minicom を設定する。
ibg4:~ kenz$ sudo /usr/local/minicom/bin/minicom -s
[Serial port setup] を選択して、[Serial Device]に /dev/cu.usbmodemUSB-COM を設定する。 一旦、minicom を終了して、-o オプションをつけて minicom を起動します。 o オプションは、minicom 起動時に初期化コマンドを送出しない機能です。
ibg4:~ kenz$ /usr/local/minicom/bin/minicom -o
こんな感じに開く。
Welcome to minicom 2.1

OPTIONS: History Buffer, F-key Macros, Search History Buffer, I18n 
Compiled on Dec 30 2003, 14:35:03.

Press CTRL-A Z for help on special keys
これで通信可能。終了する時は、CTRL-A の後に X を押す。

jerm

minicom が、あまり使い勝手が良くないので、google でいろいろ探しました。 VS-60R をキーワードで引っ掛けたら、MacOSXでVS-60Rを使っている方のページが見つかりjermを使っているようでしたので、インストールしてみました。
ibg4:~/jerm-8091 kenz$ pwd 
/Users/kenz/jerm-8091
ibg4:~/jerm-8091 kenz$ make
cc -g -pipe -Wall   -c -o jerm.o jerm.c
jerm.c: In function `print_status':
jerm.c:205: warning: int format, speed_t arg (arg 3)
jerm.c:206: warning: int format, speed_t arg (arg 3)
jerm.c: In function `get_gpsweek':
jerm.c:553: warning: passing arg 1 of `gmtime' from incompatible pointer type
cc  -o jerm jerm.o -lm
cc -g -pipe -Wall    tiocdtr.c  -lm -o tiocdtr
tiocdtr.c: In function `nain':
tiocdtr.c:63: warning: implicit declaration of function `strcmp'
tiocdtr.c:77: warning: implicit declaration of function `strlen'
ibg4:~/jerm-8091 kenz$ ls -la jerm
-rwxr-xr-x  1 kenz  kenz  62420 30 Dec 15:15 jerm
ibg4:~/jerm-8091 kenz$ 
ヘルプはこのような感じ。READMEもありますので、見てくださいね。
ibg4:~/jerm-8091 kenz$ ./jerm -h
jerm: illegal option -- h
Jerminal v0.8091  Copyright (C) 2000, 2001, 2002, 2003 by candy
usage1: ./jerm [optinos] device
        -b speed        speed
        -p [none|even|odd]      parity
        -d [7|8]        data bits
        -s [1|2|1.5]    stop bit
        -f [none|x|hard]        flow control
        -F      Set FUCK MODE for TA-100KR/RA SYSTEMS CORP.
usage3: ./jerm -D [-46][-P port] device
        server mode.
usage2: ./jerm [-46][-P port] host
        client mode.
common optinos:
        -l file log file
        -z      truncate log file
        -i      init stdin/out as same as  (pipe mode)
        -j      rockwell binary data mode
ibg4:~/jerm-8091 kenz$ 
使い方は、こんな感じ。わかりやすい。
ibg4:~/jerm-8091 kenz$ ./jerm -b 9600 -p none -d 8 -s 1 -f hard /dev/cu.usbmodemUSB-COM
Jerminal v0.8091  Copyright (C) 2000, 2001, 2002, 2003 by candy
Type "Ctrl-M ~ ." to exit.
 ispeed 9600 ospeed 9600
 +IGNBRK -BRKINT -IGNPAR -PARMRK -INPCK -ISTRIP -INLCR -IGNCR -ICRNL -IXON -IXOFF -IXANY -IMAXBEL
 -OPOST -ONLCR -OXTABS -ONOEOT
 cs8 -CSTOPB +CREAD -PARENB -PARODD +HUPCL +CLOCAL +CCTS_OFLOW +CRTSCTS +CRTS_IFLOW -MDMBUF -ECHOKE
 -ECHOE -ECHO -ECHONL -ECHOPRT -ECHOCTL -ISIG -ICANON -ALTWERASE -IEXTEN
 -EXTPROC -TOSTOP -FLUSHO -NOKERNINFO -PENDIN -NOFLSH
こっちの方が簡単便利。

戻る



(C)1999 - 2003 Kenji Ito All rights reserved.