揮発性のメモ2

http://d.hatena.ne.jp/iww/

connman で無線LANの接続設定をする

BeagleBone Green Wirelessの初期設定 :: WASP株式会社
connmanctl command man page - connman | ManKier
ConnMan - ArchWiki


connmanctlコマンドでいったん接続してしまえば、設定が保存されて次から自動接続するようになる。

# connmanctl

connmanctl> tether wifi off
connmanctl> enable wifi

connmanctl> scan wifi
Scan completed for wifi

connmanctl> services
    HOGEHOGE             wifi_112233445566_484f4745484f4745_managed_psk
    PIYO-1               wifi_112233445566_5049594f2d31_managed_psk

connmanctl> agent on
Agent registered

connmanctl> connect wifi_112233445566_484f4745484f4745_managed_psk
Agent RequestInput wifi_112233445566_484f4745484f4745_managed_psk
  Passphrase = [ Type=psk, Requirement=mandatory, Alternates=[ WPS ] ]
  WPS = [ Type=wpspin, Requirement=alternate ]
Passphrase? hogehoge
Connected wifi_112233445566_484f4745484f4745_managed_psk

connmanctl> quit

services と scan wifi

servicesコマンドでSSIDのリストを表示するが、SSIDのリストは自動で収集するわけではない。
(収集しないと、接続済みなどで既に知っている分だけしか表示しない)
scan wifiコマンドで周りのSSIDのリストを更新する。

connect と agent on

connect コマンドで接続するとき、セキュリティの都合上、agentという機能を有効にしないとパスフェーズが入力できないように制限されている。 さらに、エージェントを起動するには そもそもconnmanctlをインタラクティブモードで起動する必要がある。

agent on | off

Enable or disable the wireless agent, used for entering wireless network passphrases. See the Example section of this man page for an example of connecting to a wireless access point.

connman - Commands only available in interactive mode

一度パスフェーズを入力したら、設定ファイルに平文で保存されるので、次からはインタラクティブモードじゃなくてもコマンドラインで引数でconnectもdisconnectもできるようになる