ThinkPad X31 には IrDA 通信機能がついているので、ちょっと試してみようと思い IrDA 対応機器を身の回りで探してみると、いま使っている携帯電話 NOKIA6108 が対応していました。
カーネルの設定とかは gnokii というノキアの携帯電話とのデータ通信用のプログラムに付属の文書 "Docs/gnokii-IrDA-Linux" が役立ちました。
gnokii は 6108 には対応していないらしく、電話帳の保存とかいろいろうまくいかなかったので、結局 scmxx という Siemens の携帯電話用のデータ通信プログラムを使いました。以降で説明するように、これはとてもうまく動作しました。
ThinkPad X31 についている IrDA チップセット用のドライバは nsc-ircc で、この文書で紹介してあるのと一緒だったのでほどんどその通り実行しただけです。
ただし、 nsc-ircc のモジュールオプションとして、 dongle_id=9 を与えるというのが何の説明もなしに書かれていて分かりにくいので、分かった範囲で補足しておきます。
nsc-ircc ドライバは初期化のときに dongle id というのを検出するようになっているのですが、検出ルーチンにバグがあるためか、違う dongle id を検出してしまうことがあるようです。具体的には、 "IBM0071" という PNP ID のチップセットだとおかしな事が起こるようです。(Ubuntu の /etc/init.d/irda-setup によると) 次のコマンドで確認できます。
# cat /sys/bus/pnp/devices/*/id | grep IBM0071
この場合は dongle_id=9 というモジュールパラメータを与えて dongle_id 検出ルーチンをスキップして、明示的に設定して回避します。(2.6.17-rc3)
# modprobe -r nsc-ircc
# modprobe nsc-ircc dongle_id=9
# irattach irda0 -s
Linux マシンの側からの準備ができたので今度は、携帯電話の側から IrDA 通信を始めます。
トップ画面から Menu --> Connectivity --> Infrared を選択すると IrDA 通信中を示すマークが点灯するので、赤外線が出る部分同士をお互いに向けるとデータ通信が可能になります。
Linux マシンにもどってデータ通信用のプログラム SCMxx を使います。
まずはじめに携帯電話のアクセス可能なメモリの情報を調べます。
# scmxx --device=/dev/ircomm0 --mem-info
Accessing device ircomm0...done
Using "UTF-8" as system character set.
OK, a modem device is present.
Warning: phones from this vendor were not confirmed to be working with this software!
Binary files:
mem readable writable description
--- -------- -------- -----------
Phonebooks:
mem slots writable digits chars description
--- ------ -------- ------ ----- -----------
ME 1-500 yes 48 50 mobile equipment phonebook
DC 1-20 yes 48 50 last calls (mobile)
MC 1-10 yes 48 50 missed calls
RC 1-10 yes 48 50 callback numbers
SM 1-100 yes 48 14 SIM phonebook
FD 1-10 yes 48 14 SIM fix-dialing phonebook
SMS storages:
mem slots used description
--- ------ --------- -----------
ME 1-150 23/150 mobile equipment memory
SM 1-25 24/25 SIM memory
電話帳 (Phonebook) とショートメッセージ (SMS storages) のメモリの読み書きができることが分かります。一番左の列の ME とか SM とかというのが scmxx コマンドの --mem オプションに与える識別子になります。
例えば、電話帳を全部読み出したい場合は、Phonebook の ME メモリを読み出せばいいので以下のようにします。
# scmxx --device=/dev/ircomm0 --get --pbook --mem=ME --out -
Accessing device ircomm0...done
Using "UTF-8" as system character set.
OK, a modem device is present.
Warning: phones from this vendor were not confirmed to be working with this software!
Receiving phonebook entries ME(1-500)...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
...
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500
done
1,"13611111111",工作美田"
2,"13722222222",美田"
3,"13633333333",Jong O"
4,"13544444444","Jun"
...
499,"",""
500,"",""
携帯電話の電話帳に 名前 "test" 電話番号 "1234" を保存するには ...
# scmxx --device=/dev/ircomm0 --send --pbook --mem=ME --text=test --number=1234
Accessing device ircomm0...done
Using "UTF-8" as system character set.
OK, a modem device is present.
Warning: phones from this vendor were not confirmed to be working with this software!
Trying to find an empty slot...
Detected empty slot 23
Updating one entry in slot 23 of memory ME...done
SIM メモリにはいっているショートメッセージを全部読み出すには ...
# scmxx --device=/dev/ircomm0 --get --sms --mem=SM --slot=all --out -
Accessing device /dev/ircomm0...done
Using "UTF-8" as system character set.
OK, a modem device is present.
Warning: phones from this vendor were not confirmed to be working with this software!
Looking for SMS of specified type...
Found incoming, read SMS in slot 1.
Found incoming, read SMS in slot 2.
Found incoming, read SMS in slot 3.
...
Found incoming, read SMS in slot 24.
Found incoming, read SMS in slot 25.
Slot: 1
From: +8613*********
Date: 2006年05月09日 20時12分28秒
SMSC number: +8613800100500
PDU type: SMS-DELIVER
PDU flags: StatusRequest MoreMessagesToSend
Data coding scheme: UCS-2 (class 0)
Message length: 3
你好。
Slot: 2
From: +8613*********
Date: 2006年05月09日 20時40分53秒
SMSC number: +8613800100500
PDU type: SMS-DELIVER
PDU flags: StatusRequest MoreMessagesToSend
Data coding scheme: UCS-2 (class 0)
Message length: 20
...
電話番号 1234 に "Hello world." とショートメッセージを送るには ...
# scmxx --device=/dev/ircomm0 --send --sms --direct --number=1234 --text='Hello world.'
Accessing device ircomm0...done
Using "UTF-8" as system character set.
OK, a modem device is present.
Warning: phones from this vendor were not confirmed to be working with this software!
Creating PDU...
Waiting for data request...
Sending data...
The message was sent. Message reference: 72
The phone returned: OK
最近のコメント