Brillo: 让RPi 2B(树莓派)摆脱网线的束缚 - 通过wifi进行连接

首先要有一块USB无线网卡,还需要带这个wifi驱动的kernel。我这里使用的是EDUP-EPN8508GS的usb无线网卡。

开机之后如果执行adb shell iw dev wlan0 info可以看到无线网卡的信息,那就证明无线网卡的驱动基本没有什么问题。

$ iw dev wlan0 info

接着就去获取ower的access token:

$ curl -H "Authorization: Privet anonymous" -H 'Content-Type: application/json'     -X POST     --data '{ "pairing": "embeddedCode", "crypto": "p224_spake2" }'     -k https://10.0.0.13/privet/v3/pairing/start
{
   "deviceCommitment": "zAUrIS6vV81dvveMw7OR8K5PQlh1dNq7E4+G5zcPY341yDa2RsKQjdwWQ/IfBZDl6YJpHxvnsh8=",
   "sessionId": "44ACD5D0-75DC-4A5A-9865-AFE75C0DA8AB"
}
$ curl -H "Authorization: Privet anonymous" -H 'Content-Type: application/json'     -X POST     --data '{ "sessionId": "44ACD5D0-75DC-4A5A-9865-AFE75C0DA8AB", "clientCommitment": "Q9CRZs3H9dFQXKfy/HPw5U/D5w3uOw7zJKVeAL+s8zu+p1X9Kiuj76ZY+Z4UHV1S3ao5becnJag=" }'     -k https://10.0.0.13/privet/v3/pairing/confirm
{
   "certFingerprint": "USQs/v/5C3YcOhJtVF3kZ8V7l6vqNJtf84PefK4n7tw=",
   "certSignature": "o81YepNQOyKLJeDOtuCQWsd5zb21JgxrmGoi5t5cuzw="
}
$ curl -H "Authorization: Privet anonymous" -H 'Content-Type: application/json'     -X POST     --data '{ "mode": "pairing", "authCode": "owjUHtj5OhFz0uOf8Qkp8guWfEKVZVS2l80skFaodS4=", "requestedScope": "owner" }' -k https://10.0.0.13/privet/v3/auth
{
   "accessToken": "ZA6Di/9nnIJKM5SxBjOrZo+RHXOKR05nb/oqynAvswozOjE6MTQ1MTIwMjIwMg==",
   "expiresIn": 3600,
   "scope": "owner",
   "tokenType": "Privet"
}

有了owner的access token, 就可以去setup wifi了:

$ curl -H "Authorization: Privet ZA6Di/9nnIJKM5SxBjOrZo+RHXOKR05nb/oqynAvswozOjE6MTQ1MTIwMjIwMg==" -H 'Content-Type: application/json' -X POST --data '{"wifi": { \
    "ssid":"NETGEAR","passphrase":"cheerfuldaisychain" \
  } \
}' -k https://10.0.0.13/privet/v3/setup/start
{
   "wifi": {
      "status": "inProgress"
   }
}

NOTE: 这里一定要注意json的语法,换行与不换行完全是不一样的。由于对JSON语法不熟悉,走了好多弯路啊。

最后可以可过访问/privet/v3/setup/status或者/privet/info查看wifi的状态:

$ curl -H "Authorization: Privet ZA6Di/9nnIJKM5SxBjOrZo+RHXOKR05nb/oqynAvswozOjE6MTQ1MTIwMjIwMg==" -H 'Content-Type: application/json' -X POST -k https://10.0.0.13/privet/v3/setup/status
{
   "wifi": {
      "status": "inProgress"
   }
}

评论

2 Comments on "Brillo: 让RPi 2B(树莓派)摆脱网线的束缚 - 通过wifi进行连接"

提醒我
avatar

Linfu
游客
Linfu
2 年 4 月 之前

你好,基于dragonboard,有两个问题请教下:
1. wifi配置成功,为什么brillo重启后还能连接上网络,配置文件以加密的形式保存在哪里呢?
2. 将正确的wpa_supplicant.conf配置文件放在device的/etc目录下,通过如下命令为什么不能正确配置wifi呢?
wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf

wpDiscuz