Quantcast
Channel: Bashタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 2811

Raspberry Pi 3B/3B+の機種判別(Raspbian Buster)

$
0
0

Raspberry Pi 3B/3B+の機種判別(Raspbian Buster)

ぱっと、インターネットを調べたところ誰も書いていなかったので記述。(RaspberryPi公式フォーラムのQAにはRaspberryPi2シリーズの出力例載っていたが、3は載っていなかった。。。)

SBC(シングルボードコンピュータ)愛好家であれば、Raspberry Pi3Bと3B+が混在環境を自宅に持っている!!という方も意外と多いのではないかと思います(???)

この機種判別が何の役に立つか?

  1. Wi-Fi設定の使い分けなどに使えるかも。(3Bだと2.4GHz、3B+だと5GHzに自動接続するようにするなど。)
  2. ~/.bashrcPS1=に追加して誤操作防止に役立てる。
  3. その他、きっと何かあるはず。きっと。

判別方法

/proc/device-tree/modelにモデル名が記述されています。3B+はモデル名に「Plus」が入る点、Revが「1.3」になっている点が異なります。

Raspberry Pi 3B

$ cat /proc/device-tree/model 
Raspberry Pi 3 Model B Plus Rev 1.3

Raspberry Pi 3B+

$ cat /proc/device-tree/model 
Raspberry Pi 3 Model B Rev 1.2

正規表現

3B+に引っ掛けるとするとこんな感じ。

^Raspberry Pi 3 Model B Plus Rev \d+(?:\.\d+)?$

Viewing all articles
Browse latest Browse all 2811

Trending Articles