Is there a way of determining whether the current Raspberry Pi is either a 2 Model B and 3 with Raspbian Jessie Lite 8.0?
This is because I have a particular bootstrap.sh
written in Bash where it needs to set the attribute txpower
for a Wi-Fi USB dongle (here, Raspberry Pi 2) using a Ralink RT5370 chipset driver.
I set the Wireless attributes using iwconfig
(which, I know is deprecated, but it currently gets the job done, so I am not changing it).
Since, in Raspberry Pi 3 the internal Wi-Fi chipset is a bcm
-based chipset which will not let the following command execute:
iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0dBm
With Raspberry Pi 3 the above mentioned command works just by removing dBm
from the above mentioned command:
iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0
I would like to add a check whether the Raspberry Pi model is 2 or 3 using Bash.
Any hints?
In case, someone wants to go through the bootstrap.sh
: Bootstrapping for TWIN
Notes
I checked that
dBm
is not required, also in the case of the Raspberry Pi 2 with the Ralink chipset hence for non-ambiguity one can use the same command for both the Raspberry Pis viz.iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0
It is interesting to note that for external Wi-Fi USB dongles one needs to perform the following (for Raspberry Pi 2):
ifconfig wlan0 down iwconfig wlan0 mode ad-hoc channel 6 essid myadhoc txpower 0 ifconfig wlan0 up
while as for inbuilt Wi-Fi modules (Raspberry Pi 3) there is no need for
ifconfig up and down
. Just the straightforwardiwconfig
command works.