====== Raspberry Pi Revision abfragen ======
== LoxBerry 0.3.x ==
Diese Information ist gültig für LoxBerry V0.3.x und höher. Ältere LoxBerry Versionen haben dieses Feature noch nicht integriert. Wenn Du es verwendest, solltest Du in der Plugin-Konfiguration die Mindestversionsnummer des LoxBerry auf 0.3.0 setzen.
Falls das eigene Plugin davon abhängig ist, ob es auf einem Raspberry läuft oder nicht (z. B. wenn es die GPIOs des Raspberry verwendet), kann man das sehr leicht abfragen. Dazu prüft man, ob die Datei ''%%/opt/loxberry/config/system/is_raspberry.cfg%%'' vorhanden ist. Andere Hardware-Platformen können ebenfalls abgefragt werden. Die entsprechenden Dateien heissen:
''%%/opt/loxberry/config/system/is_x86.conf%%'' bzw. ''%%/opt/loxberry/config/system/is_x64.conf%%''
Natürlich kann man auch gleich während der Installation des Plugins diese Information abfragen und die Installation dann gegebenenfalls verweigern: [[entwickler:entwicker_tipps_und_tricks:hardware_architektur_bei_der_plugininstallation_abfragen|Hardware-Architektur bei der Plugininstallation abfragen]]
Im Bash-Skript sieht die Anfrage wie folgt aus:
**Hardware Architektur abfragen**
if [ -e $LBSCONFIG/is_raspberry.cfg ]; then
echo The hardware architecture is Raspberry
fi
if [ -e $LBSCONFIG/is_x86.cfg ]; then
echo The hardware architecture is x86
fi
if [ -e $LBSCONFIG/is_x64.cfg ]; then
echo The hardware architecture is x64
fi
Um noch abzufragen, auf welcher Hardware-Revision der Raspberry-Serie das Plugin ausgeführt wird, ruft man das kleine Skript ''%%/opt/loxberry/bin/showpitype%%'' auf. Das Skript gibt folgende Informationen, gefolgt von einem LineFeed (\n), der gegebenenfalls noch ausgefiltert werden muss, aus:
^Hardware Revision^Ausgabe^
|Kein Raspberry |nopi |
|Raspberry 1 |type_1 |
|Raspberry 2 |type_2 |
|Raspberry 3 |type_3 |
|Raspberry 4 |type_4 |
|Raspberry Zero |type_0 |
|Unbekannt |unknown|