GNU/Linux Reminder

IP fixe pour le wifi sous raspbian

Dans le fichier /etc/dhcpcd.conf, mettre:
...
interface wlan0
static ip_address=192.168.CC.DD/24
static routers=192.168.CC.1
static domain_name_servers=1.1.1.1 1.0.0.1
...

Préconfiguation du Wifi dans MotionOs

Dans la partition de boot, créer un fichier wpa_supplicant.conf au format Unix (Edition > Convertir les sauts de lignes > Convertir au format Unix (LF)) avec le texte:
        country=CH
        update_config=1
        ctrl_interface=/var/run/wpa_supplicant
        
        network={
            scan_ssid=1
            ssid="MonWiFiSSID"
            psk="********"
        }
Le fichier doit être présent avec le premier démarrage, sinon il faut reflasher la carte SD ou modifier le fichier /data/etc/wpa_supplicant.conf

Préconfiguation de l'activation SSH

Dans la partition de boot, créer un fichier ssh ou ssh.txt.

Donner + de courant au port USB pour le raspberry pi zero

Dans le fichier /boot/config.txt, mettre:
max_usb_current=1

Faire une recherche de text dans des fichiers

$ grep -lri "Texte à chercher" /chemin/de/départ/
ou
$ find . | xargs grep -i 'Text à chercher' -sl
ou
$ find /chemin/de/départ/ -name "*.filtre" -type f -exec grep "Texte à chercher" {} \; -print

Trouver les Raspberri Pi sur son réseau

$ sudo nmap -sn 192.168.CC.0/24 | grep  -i 'b8:27:eb' -A 1

Dans quelle version de Debian suis-je

$ cat /etc/issue
ou
$ cat /etc/debian_version
ou
$ cat /etc/os-release
ou (l'installation de lsb-release peut être nécessaire)
$ sudo apt-get install lsb-release
$ lsb_release -da
ou
$ hostnamectl

Désactiver la LED de la caméra d'un raspberry pi

Dans le fichier /boot/config.txt, ajoutez:
# Disable the camera led
disable_camera_led=1
et rebootez

Faire clignoter la LED de la caméra

Créez un fichier python:
#!/usr/bin/env python
import time
import RPi.GPIO as GPIO
 
# Use GPIO numbering
GPIO.setmode(GPIO.BCM)
 
# Set GPIO for camera LED
# Use 5 for Model A/B and 32 for Model B+
CAMLED = 5 
 
# Set GPIO to output
GPIO.setup(CAMLED, GPIO.OUT, initial=False) 
 
# Five iterations with half a second
# between on and off
for i in range(5):
 GPIO.output(CAMLED,True) # On
 time.sleep(0.5)
 GPIO.output(CAMLED,False) # Off
 time.sleep(0.5)
 

Désactiver les LED d'un raspberry pi zero

Pour un effet permanent, dans le fichier /boot/config.txt, ajoutez:
 # Disable the ACT LED on the Pi Zero.
dtparam=act_led_trigger=none
dtparam=act_led_activelow=on
En ligne de commande: mettez les déclencheurs de la ACT_LED à 'none'
$ echo none | sudo tee /sys/class/leds/led0/trigger
Eteignez la ACT_LED
$ echo 1 | sudo tee /sys/class/leds/led0/brightness

Déactiver les LED d'un raspberry pi 2 ou 3

Pour un effet permanent, dans le fichier /boot/config.txt, ajoutez:
# Disable the ACT LED.
dtparam=act_led_trigger=none
dtparam=act_led_activelow=off

# Disable the PWR LED.
dtparam=pwr_led_trigger=none
dtparam=pwr_led_activelow=off
En ligne de commande, mettez les déclencheurs de la ACT_LED à 'none'
$ echo none | sudo tee /sys/class/leds/led0/trigger
Eteignez la ACT_LED
$ echo 1 | sudo tee /sys/class/leds/led0/brightness
Eteignez le PWR_LED:
$ echo 0 | sudo tee /sys/class/leds/led1/brightness

Forcer le HDMI d'un raspberry pi

Dans le fichier /boot/config.txt, adaptez:
hdmi_safe=1
ou
disable_overscan=0 # pas d'overscan dans le cas d'un adaptateur
hdmi_force_hotplug=1 # force l'activation du cable HDMI
hdmi_group=2 # 1 mode TV (CEA), 2 mode monitor (DMT)
hdmi_drive=2 # 1 mode DVI (sans le son) / 2 mode HDMI (avec une sortie)
hdmi_mode=16 # voir le tableau hdmi_mode/DMT

hdmi_mode/CEAresolutionfrequencynotes
1640x480VGA
2480p60Hz
3480p60Hz16:9 aspect ratio
4720p60Hz
51080i60Hz
6480i60Hz
7480i60Hz16:9 aspect ratio
8240p60Hz
9240p60Hz16:9 aspect ratio
10480i60Hzpixel quadrupling
11480i60Hzpixel quadrupling, 16:9 aspect ratio
12240p60Hzpixel quadrupling
13240p60Hzpixel quadrupling, 16:9 aspect ratio
14480p60Hzpixel doubling
15480p60Hzpixel doubling, 16:9 aspect ratio
161080p60Hz
17576p50Hz
18576p50Hz16:9 aspect ratio
19720p50Hz
201080i50Hz
21576i50Hz
22576i50Hz16:9 aspect ratio
23288p50Hz
24288p50Hz16:9 aspect ratio
25 576i 50Hz pixel quadrupling
26 576i 50Hz pixel quadrupling, 16:9 aspect ratio
27 288p 50Hz pixel quadrupling
28 288p 50Hz pixel quadrupling, 16:9 aspect ratio
29 576p 50Hz pixel doubling
30 576p 50Hz pixel doubling, 16:9 aspect ratio
31 1080p 50Hz
32 1080p 24Hz
33 1080p 25Hz
34 1080p 30Hz
35 480p 60Hz pixel quadrupling
36 480p 60Hz pixel quadrupling, 16:9 aspect ratio
37 576p 50Hz pixel quadrupling
38 576p 50Hz pixel quadrupling, 16:9 aspect ratio
39 1080i 50Hz reduced blanking
40 1080i 100Hz
41 720p 100Hz
42 576p 100Hz
43 576p 100Hz 16:9 aspect ratio
44 576i 100Hz
45 576i 100Hz 16:9 aspect ratio
46 1080i 120Hz
47 720p 120Hz
48 480p 120Hz
49 480p 120Hz 16:9 aspect ratio
50 480i 120Hz
51 480i 120Hz 16:9 aspect ratio
52 576p 200Hz
53 576p 200Hz 16:9 aspect ratio
54 576i 200Hz
55 576i 200Hz 16:9 aspect ratio
56 480p 240Hz
57 480p 240Hz 16:9 aspect ratio
58 480i 240Hz
59 480i 240Hz 16:9 aspect ratio
hdmi_mode/DMTResolutionFrequency
4640x480 60Hz
9800x600 60Hz
161024x768 60Hz
211152x864 75Hz
231280x768 60Hz
281280x800 60Hz
321280x960 60Hz
351280x102460Hz
391360x768 60Hz
421400x1050 60Hz
471440x900 60Hz
511600x1200 60Hz
581680x105060Hz
691920x120060Hz
811366x76860Hz
821920x108060Hz
85 1280x72060Hz