Difference between revisions of "RPi/de"

From GIMX
Jump to: navigation, search
(Updating to match new version of source page)
(Created page with "Als Bonus kann man einen Knopf hinzufügen, welcher beim Drücken einen Blinkeffekt ergibt und den RPi herunterfährt.")
 

(24 intermediate revisions by 2 users not shown)

Line 2: Line 2:
 
Warnung: RPi Unterstützung sollte als experimentell betrachtet werden.Es kann zu Problemen kommen, wenn GIMX auf dem RPi ausgeführt werden soll.
 
Warnung: RPi Unterstützung sollte als experimentell betrachtet werden.Es kann zu Problemen kommen, wenn GIMX auf dem RPi ausgeführt werden soll.
  
GIMX can run on many Linux targets, and the [http://www.raspberrypi.org/ the Raspberry Pi] is one of them!
+
GIMX läuft unter verschiedenen Linux Geräten und der [http://www.raspberrypi.org/ Raspberry Pi] ist einer davon !
== Hardware considerations ==
+
=Hardware Empfehlungen=
  
Use a USB HUB only if there are no ports available on the RPi.<br />
+
Nutze nur einen USB HUB wenn am RPi keine resp. zu wenige Ports verfügbar sind.<br />
It is highly recommended to use a HUB with an external power supply.
+
Es ist empfehlenswert einen USB HUB mit externer Stromversorgung zu nutzen.
  
== Firmware update ==
+
==Firmware aktualisierung==
As early firmwares had severe USB issues it is recommended to update the firmware before using GIMX.<br />
+
Erste Firmwares hatten Probleme mit den USB Ports, deshalb ist es empfehlenswert die Firmware Updates vor der Nutzung von GIMX durchzuführen.<br />
Updating the firmware may also be useful if you plan to use a Logitech force feedback wheel (the uhid kernel module was missing in earlier firmwares).<br />
+
Die Firmware zu aktualisieren kann auch hilfreich sein, wenn geplant ist ein Logitech Force Feedback Wheel einzusetzen (Das uhid Kernel Modul fehlte in früheren Firmwares).<br />
Type the following command:
+
Folgende befehle ausführen (Terminal/SSH):
<pre>sudo rpi-update</pre>
+
<pre>sudo rpi-update
And don't forget to reboot:
+
sudo reboot</pre>
<pre>sudo reboot</pre>
+
 
Tested Rpi firmware:
+
Falls Probleme mit der aktuellsten Firmware auftreten, sollte diese installiert werden:
 +
<pre>sudo rpi-update 771a503cfc2a1130e2df2a4ddfc45ffa0f592b3f
 +
sudo reboot</pre>
 +
Getestete RPi Firmware:
 
<pre>pi@raspberrypi ~ $ uname -a
 
<pre>pi@raspberrypi ~ $ uname -a
Linux raspberrypi 4.1.9+ #819 PREEMPT Thu Oct 1 20:31:26 BST 2015 armv6l
+
Linux raspberrypi 4.1.21+ #873 Mon Apr 11 18:00:37 BST 2016 armv6l GNU/Linux</pre>
GNU/Linux</pre>
+
<!--== UHID Kernel Modul ==
<!--== UHID kernel module ==
 
  
 
If you plan to use a Logitech force feedback wheel, you will have to build the uhid.ko module for your kernel.<br />
 
If you plan to use a Logitech force feedback wheel, you will have to build the uhid.ko module for your kernel.<br />
Line 50: Line 52:
 
make INSTALL_HDR_PATH=dest headers_install
 
make INSTALL_HDR_PATH=dest headers_install
 
sudo cp dest/include/linux/uhid.h /usr/include/linux/-->
 
sudo cp dest/include/linux/uhid.h /usr/include/linux/-->
== USB adapter using the on-board UART interface ==
 
  
=== Hardware requirements ===
+
==USB Adapter mithilfe der On-Board UART Schnittstelle==
  
The on-board UART runs at 0V/3.3V levels, and the AVR USB board has to run at 5V to operate at 16MHz (running at 3.3V would only allow to operate at 8MHz).<br />
+
===Hardware Anforderungen===
Connecting the RPi and the AVR USB board directly may damage the hardware!<br />
 
One cheap solution is to use a voltage divider:<br />
 
* Connect both GNDs
 
* It's safe to connect the TXD pin of the RPi to the Rx pin of the AVR USB board (the GIMX firmwares configure the Rx pin as an input)
 
* To connect the Tx pin of the AVR USB board to the RXD pin of the RPi, you'll need to convert the voltage level from 0..5V to 0..3.3V.<br />
 
This can be done with a simple resistive divider:
 
<div class="image200px">[http://gimx.fr/img/wiki/Resistive_divider.png http://gimx.fr/img/wiki/Resistive_divider.png]</div>
 
Vin is the Tx pin of the AVR USB board, Vout is the RXD pin of the RPi, R1=2.2kΩ , R2=3.3kΩ
 
* Do not connect any other pin!
 
  
=== Sotware adjustments ===
+
<b>ACHTUNG DIES IST EINE ÜBERSETZUNG - Bei unklarheiten das Original in Englisch durch lesen!</b>
  
By default, the RPi sends debug messages on the UART port. To use it for GIMX, we should execute:
+
Das On-Board UART läuft mit Spannungen von 0V/3.3V, das AVR USB-Board muss mit einer Spannung von 5V und 16MHz laufen (Spannungen von 3.3V würden nur mit 8MHz arbeiten).<br />
 +
Das direkte Verbinden der RPi mit dem AVR USB-Board könnte die Hardware beschädigen!
 +
Eine günstige Lösung ist es einen Spannungsteiler zu verwenden:<br />
 +
* Beide GNDs verbinden
 +
* Es ist sicher den TXD Pin der RPI mit dem Rx Pin vom AVR USB-Board zu verbinden (Die GIMX Firmware konfiguriert den Rx Pin als eingabe)
 +
*Um den Tx pin vom AVR USB-Board zum RXD pin der RPi zu verbinden, muss man die Spannung von 0..5V auf 0..3.3V anpassen.<br />
 +
Dies kann mit einem Spannungsteiler gemacht werden:
 +
<div class="image200px">[https://gimx.fr/img/wiki/Resistive_divider.png https://gimx.fr/img/wiki/Resistive_divider.png]</div>
 +
Vin ist der TX Pin vom AVR USB-Board, Vout ist der RXD Pin der RPi, R1=2.2kΩ , R2=3.3kΩ
 +
*Keine anderen Pins verbinden !
 +
 
 +
===Software Einstellungen===
 +
 
 +
Standardmässig ist der RPi UART als Serielle Konsole konfiguriert.<br />
 +
Deaktivierung der Seriellen Konsole mittels raspi-config:
 
<pre>
 
<pre>
 
sudo raspi-config  
 
sudo raspi-config  
 
</pre>
 
</pre>
Then select:
+
Dann folgendes auswählen:
 
<pre>
 
<pre>
 
"Advanced Options", "Serial", "No", "Finish"
 
"Advanced Options", "Serial", "No", "Finish"
 
</pre>
 
</pre>
Open the /boot/config.txt with the nano editor:
+
Die Standardkonfiguration erlaubt keine hohe Baudrate.<br />
 +
Hohe Baudrate durch das anpassen von /boot/config.txt aktivieren:
 
<pre>
 
<pre>
 
sudo nano /boot/config.txt
 
sudo nano /boot/config.txt
 
</pre>
 
</pre>
Add the following line at the end of the file:
+
Folgende Zeile am Schluss der Datei hinzufügen:
 
<pre>
 
<pre>
 
init_uart_clock=8000000  
 
init_uart_clock=8000000  
 
</pre>
 
</pre>
Create a symbolic link to make gimx-launcher find the port:
+
Neustart um die Änderungen wirksam zu machen:
 
<pre>
 
<pre>
sudo ln -s /dev/ttyAMA0 /dev/ttyUSB0
+
sudo reboot
 
</pre>
 
</pre>
  
== GIMX installation ==
+
==GIMX Installation==
<pre>sudo apt-get install gdebi
+
<pre>wget https://gimx.fr/download/gimx-raspbian -O gimx.deb
wget http://gimx.fr/download/gimx-raspbian -O gimx.deb
+
sudo dpkg -i gimx.deb
sudo gdebi gimx.deb</pre>
+
sudo apt-get -f install</pre>
  
 
If you get a "Dependency is not satisfiable: ..." error message, upgrade Raspbian:
 
If you get a "Dependency is not satisfiable: ..." error message, upgrade Raspbian:
 
<pre>sudo apt-get update && sudo apt-get upgrade</pre>
 
<pre>sudo apt-get update && sudo apt-get upgrade</pre>
  
== Stop/disable triggerhappy service ==
+
==Triggerhappy Dienst stoppen/deaktivieren==
[https://github.com/wertarbyte/triggerhappy/blob/master/README Triggerhappy] is a daemon that opens every input device for reading, and that consumes a few percent of the CPU time.
+
[https://github.com/wertarbyte/triggerhappy/blob/master/README Triggerhappy] ist ein dienst der jedes Eingabegerät zum lesen öffnet und dadurch etwas an CPU Zeit resp. Leistung verbraucht.
  
It seems a good idea to stop it while running GIMX.
+
Es ist von vorteil den Dienst zu beenden, wenn GIMX benutzt wird.
 +
 
 +
Um Triggerhappy zu stoppen:
 +
<pre>sudo service triggerhappy stop</pre>
 +
Um Triggerhappy zu deaktivieren:
 +
<pre>sudo update-rc.d triggerhappy disable</pre>
 +
 
 +
==GIMX Starten==
 +
Den [[Quick_Start|Quick start page]] lesen um GIMX mit Benutzeroberfläche zu starten.<br />
 +
Es ist eine gute Idee GIMX direkt via Terminal, ohne grafische Oberfläche zu starten. Dies kann über Netzwerk, mit einem SSH Client oder mittels [[#Autostart GIMX at boot without GUI]] bewerkstelligt werden<br />
 +
 
 +
Idealerweise sollte GIMX nicht via Netzwerkport gestartet werden (Da es an der USB Schnittstelle verbunden ist).<br />
 +
Weitere Informationen für Terminalbefehle [[Command_line|this page]].<br />
 +
 
 +
==Automatisches starten von GIMX ohne Benutzeroberfläche==
 +
Als root /etc/systemd/system/gimx.service Datei mit folgendem Inhalt erstellen:
 +
 
 +
<pre>
 +
[Unit]
 +
Description=GIMX 
 +
After=syslog.target network.target
 +
 
 +
[Service]
 +
User=pi 
 +
Type=simple 
 +
ExecStart=/usr/bin/gimx -p /dev/ttyUSB0 -c LogitechDrivingForceGT_G29.xml --nograb 
 +
Restart=always 
 +
RestartSec=5
 +
 
 +
[Install]
 +
WantedBy=multi-user.target
 +
</pre>
 +
 
 +
ttyUSB0 mit deinem Gerät ersetzen und LogitechDrivingForceGT_G29.xml mit deiner Konfigurationsdatei ersetzen (welche im pi home Verzeichnis liegen sollte: /home/pi/.gimx/config/LogitechDrivingForceGT_G29.xml).
 +
 
 +
Ausführen: <pre>sudo systemctl daemon-reload</pre> Um systemd die neue Datei bekannt zu machen und <pre>sudo systemctl enable gimx && sudo systemctl start gimx</pre> um den GIMX Dienst automatisch zu starten.
 +
 
 +
== Notify when GIMX is running using a led ==
 +
In order to have a proper confirmation about if the gimx service is up and running, you can add a simple python script that turns a led on if the gimx service is running.
 +
 
 +
The file will be located at /home/pi/blink.py:
 +
 
 +
<pre>
 +
#!/usr/bin/python
 +
import os 
 +
import time 
 +
import RPi.GPIO as GPIO
 +
 
 +
led = 23 
 +
button = 18 
 +
GPIO.setmode(GPIO.BCM) 
 +
GPIO.setup(led, GPIO.OUT) 
 +
GPIO.setup(button, GPIO.IN, pull_up_down = GPIO.PUD_UP)
 +
 
 +
def Shutdown(channel): 
 +
  GPIO.output(led, True)
 +
  time.sleep(0.2)
 +
  GPIO.output(led, False)
 +
  time.sleep(0.2)
 +
  GPIO.output(led, True)
 +
  time.sleep(0.2)
 +
  GPIO.output(led, False)
 +
  os.system("sudo shutdown -h now")
 +
 
 +
GPIO.add_event_detect(18, GPIO.FALLING, callback = Shutdown, bouncetime = 2000)
 +
 
 +
while True: 
 +
  found = False
 +
  time.sleep(5)
 +
  pids = [pid for pid in os.listdir('/proc') if pid.isdigit()]
 +
  for pid in pids:
 +
    try:
 +
      cmd = open(os.path.join('/proc', pid, 'cmdline'), 'rb').read()
 +
      if "gimx" in cmd:
 +
        found = True
 +
    except IOError: # proc has already terminated
 +
      continue
 +
  if found == True:
 +
    GPIO.output(led, True)
 +
  else:
 +
    GPIO.output(led, False)
 +
</pre>
  
To stop triggerhappy:
+
Als Bonus kann man einen Knopf hinzufügen, welcher beim Drücken einen Blinkeffekt ergibt und den RPi herunterfährt.
sudo service triggerhappy stop
 
To disable triggerhappy:
 
sudo update-rc.d triggerhappy disable
 
  
== Run GIMX ==
+
<div class="image200px">[https://gimx.fr/img/wiki/PiButtonLed.png https://gimx.fr/img/wiki/PiButtonLed.png]</div>
Read the [[Quick_Start|Quick start page]] to learn how to run GIMX through the GUI.<br />
 
A good idea is to run GIMX directly from a terminal, without starting a graphical session.<br />
 
This can be done over the network, using a ssh client.<br />
 
Ideally, GIMX should be launched without using the Ethernet port (because it is connected on the USB bus).<br />
 
More details on command line options on [[Command_line|this page]].<br />
 
=== Bluetooth ===
 
In a terminal:
 
gimx -t Sixaxis -c <config file> -b <PS3 bdaddr>
 
The dongle address has to be changed before running the above commands.
 
  
=== DIY USB adapter ===
+
To start at boot, simply add it to the pi user crontab (crontab -e) as <pre>@reboot python /home/pi/blink.py &</pre>
In einem Terminal:
 
gimx -c <config file> -p /dev/<ttyUSB port>
 

Latest revision as of 16:58, 29 December 2016

Other languages:
Deutsch • ‎English • ‎français

Warnung: RPi Unterstützung sollte als experimentell betrachtet werden.Es kann zu Problemen kommen, wenn GIMX auf dem RPi ausgeführt werden soll.

GIMX läuft unter verschiedenen Linux Geräten und der Raspberry Pi ist einer davon !

Hardware Empfehlungen

Nutze nur einen USB HUB wenn am RPi keine resp. zu wenige Ports verfügbar sind.
Es ist empfehlenswert einen USB HUB mit externer Stromversorgung zu nutzen.

Firmware aktualisierung

Erste Firmwares hatten Probleme mit den USB Ports, deshalb ist es empfehlenswert die Firmware Updates vor der Nutzung von GIMX durchzuführen.
Die Firmware zu aktualisieren kann auch hilfreich sein, wenn geplant ist ein Logitech Force Feedback Wheel einzusetzen (Das uhid Kernel Modul fehlte in früheren Firmwares).
Folgende befehle ausführen (Terminal/SSH):

sudo rpi-update
sudo reboot

Falls Probleme mit der aktuellsten Firmware auftreten, sollte diese installiert werden:

sudo rpi-update 771a503cfc2a1130e2df2a4ddfc45ffa0f592b3f
sudo reboot

Getestete RPi Firmware:

pi@raspberrypi ~ $ uname -a
Linux raspberrypi 4.1.21+ #873 Mon Apr 11 18:00:37 BST 2016 armv6l GNU/Linux

USB Adapter mithilfe der On-Board UART Schnittstelle

Hardware Anforderungen

ACHTUNG DIES IST EINE ÜBERSETZUNG - Bei unklarheiten das Original in Englisch durch lesen!

Das On-Board UART läuft mit Spannungen von 0V/3.3V, das AVR USB-Board muss mit einer Spannung von 5V und 16MHz laufen (Spannungen von 3.3V würden nur mit 8MHz arbeiten).
Das direkte Verbinden der RPi mit dem AVR USB-Board könnte die Hardware beschädigen! Eine günstige Lösung ist es einen Spannungsteiler zu verwenden:

  • Beide GNDs verbinden
  • Es ist sicher den TXD Pin der RPI mit dem Rx Pin vom AVR USB-Board zu verbinden (Die GIMX Firmware konfiguriert den Rx Pin als eingabe)
  • Um den Tx pin vom AVR USB-Board zum RXD pin der RPi zu verbinden, muss man die Spannung von 0..5V auf 0..3.3V anpassen.

Dies kann mit einem Spannungsteiler gemacht werden:

Resistive_divider.png

Vin ist der TX Pin vom AVR USB-Board, Vout ist der RXD Pin der RPi, R1=2.2kΩ , R2=3.3kΩ

  • Keine anderen Pins verbinden !

Software Einstellungen

Standardmässig ist der RPi UART als Serielle Konsole konfiguriert.
Deaktivierung der Seriellen Konsole mittels raspi-config:

sudo raspi-config 

Dann folgendes auswählen:

"Advanced Options", "Serial", "No", "Finish"

Die Standardkonfiguration erlaubt keine hohe Baudrate.
Hohe Baudrate durch das anpassen von /boot/config.txt aktivieren:

sudo nano /boot/config.txt

Folgende Zeile am Schluss der Datei hinzufügen:

init_uart_clock=8000000 

Neustart um die Änderungen wirksam zu machen:

sudo reboot

GIMX Installation

wget https://gimx.fr/download/gimx-raspbian -O gimx.deb
sudo dpkg -i gimx.deb
sudo apt-get -f install

If you get a "Dependency is not satisfiable: ..." error message, upgrade Raspbian:

sudo apt-get update && sudo apt-get upgrade

Triggerhappy Dienst stoppen/deaktivieren

Triggerhappy ist ein dienst der jedes Eingabegerät zum lesen öffnet und dadurch etwas an CPU Zeit resp. Leistung verbraucht.

Es ist von vorteil den Dienst zu beenden, wenn GIMX benutzt wird.

Um Triggerhappy zu stoppen:

sudo service triggerhappy stop

Um Triggerhappy zu deaktivieren:

sudo update-rc.d triggerhappy disable

GIMX Starten

Den Quick start page lesen um GIMX mit Benutzeroberfläche zu starten.
Es ist eine gute Idee GIMX direkt via Terminal, ohne grafische Oberfläche zu starten. Dies kann über Netzwerk, mit einem SSH Client oder mittels #Autostart GIMX at boot without GUI bewerkstelligt werden

Idealerweise sollte GIMX nicht via Netzwerkport gestartet werden (Da es an der USB Schnittstelle verbunden ist).
Weitere Informationen für Terminalbefehle this page.

Automatisches starten von GIMX ohne Benutzeroberfläche

Als root /etc/systemd/system/gimx.service Datei mit folgendem Inhalt erstellen:

[Unit]
Description=GIMX  
After=syslog.target network.target

[Service]
User=pi  
Type=simple  
ExecStart=/usr/bin/gimx -p /dev/ttyUSB0 -c LogitechDrivingForceGT_G29.xml --nograb  
Restart=always  
RestartSec=5

[Install]
WantedBy=multi-user.target

ttyUSB0 mit deinem Gerät ersetzen und LogitechDrivingForceGT_G29.xml mit deiner Konfigurationsdatei ersetzen (welche im pi home Verzeichnis liegen sollte: /home/pi/.gimx/config/LogitechDrivingForceGT_G29.xml).

Ausführen:

sudo systemctl daemon-reload

Um systemd die neue Datei bekannt zu machen und

sudo systemctl enable gimx && sudo systemctl start gimx

um den GIMX Dienst automatisch zu starten.

Notify when GIMX is running using a led

In order to have a proper confirmation about if the gimx service is up and running, you can add a simple python script that turns a led on if the gimx service is running.

The file will be located at /home/pi/blink.py:

#!/usr/bin/python
import os  
import time  
import RPi.GPIO as GPIO

led = 23  
button = 18  
GPIO.setmode(GPIO.BCM)  
GPIO.setup(led, GPIO.OUT)  
GPIO.setup(button, GPIO.IN, pull_up_down = GPIO.PUD_UP)

def Shutdown(channel):  
  GPIO.output(led, True)
  time.sleep(0.2)
  GPIO.output(led, False)
  time.sleep(0.2)
  GPIO.output(led, True)
  time.sleep(0.2)
  GPIO.output(led, False)
  os.system("sudo shutdown -h now")

GPIO.add_event_detect(18, GPIO.FALLING, callback = Shutdown, bouncetime = 2000)

while True:  
  found = False
  time.sleep(5)
  pids = [pid for pid in os.listdir('/proc') if pid.isdigit()]
  for pid in pids:
    try:
      cmd = open(os.path.join('/proc', pid, 'cmdline'), 'rb').read()
      if "gimx" in cmd:
        found = True
    except IOError: # proc has already terminated
      continue
  if found == True:
    GPIO.output(led, True)
  else:
    GPIO.output(led, False)

Als Bonus kann man einen Knopf hinzufügen, welcher beim Drücken einen Blinkeffekt ergibt und den RPi herunterfährt.

PiButtonLed.png

To start at boot, simply add it to the pi user crontab (crontab -e) as

@reboot python /home/pi/blink.py &