𑇢^^^°< Technical stuff https://wiki.arthus.net/ Fri, 13 Feb 2026 12:05:32 +0100 Fri, 13 Feb 2026 12:05:32 +0100 Pico Quectel EC25 + Sixfab LTE hat + Rpi OS Trixie + Rpi4b + ModemManager + NetworkManager <h1>Quectel EC25 + Sixfab LTE hat + Rpi OS Trixie + Rpi4b + ModemManager + NetworkManager</h1> <h2>Steps</h2> <ol> <li>Install Rpi OS with rpi-imager</li> <li>Connect hat to Rpi, insert sim (disable pin from a phone first)</li> <li>Start Rpi, login, then in term or console :</li> </ol> <h2>NetworkManager + ModemManager setup</h2> <p>Here are the only relevant commands here :</p> <pre><code>mmcli -L # gets you /org/freedesktop/ModemManager1/Modem/X where X is your modem id sudo mmcli -m X | grep 'primary port' # gets you your ifname (e.g; cdc-wdmX) sudo nmcli connection add type gsm ifname cdc-wdmX con-name FOO apn BAR user BAZ password QUUX # use your ifname, and your carrier's APN settings for apn, user, password sudo nmcli connection up FOO # activate connection</code></pre> <p>See here : [<a href="https://wiki.archlinux.org/title/Mobile_broadband_modem#ModemManager">https://wiki.archlinux.org/title/Mobile_broadband_modem#ModemManager</a>] and here : [<a href="https://wiki.archlinux.org/title/NetworkManager#Mobile_broadband_support">https://wiki.archlinux.org/title/NetworkManager#Mobile_broadband_support</a>] </p> Thu, 15 Jan 2026 01:00:00 +0100 https://wiki.arthus.net/?trixie_quectel_ec25_networkmanager https://wiki.arthus.net/?trixie_quectel_ec25_networkmanager Générer un graphique des statistiques réseau adhérent·e FDN <h1>Générer un graphique des statistiques réseau adhérent·e FDN</h1> <p>[toc]</p> <p>Il est possible aux adhérent·e·s FDN de télécharger un fichier <a href="https://fr.wikipedia.org/wiki/RRDTool">rrd</a> contenant les statistiques d'une ligne.<br /> Ce fichier est disponible dans l'<a href="https://vador.fdn.fr/adherents/">espace adhérent·e</a>, section &quot;Statistiques réseau&quot; du menu &quot;Informations techniques&quot;. </p> <p>On peut à partir de ce fichier générer un graphique grâce à l'outil <a href="https://oss.oetiker.ch/rrdtool/">RRDtool</a>. </p> <h5>La commande utilisée par le SI FDN</h5> <p>Le SI FDN utilise un script Perl pour générer ce graphique, dont les sources sont disponibles ici : </p> <p><a href="https://git.fdn.fr/adminsys/si/-/blob/main/cgi/adh/adh-statimg.cgi?ref_type=heads#L333">https://git.fdn.fr/adminsys/si/-/blob/main/cgi/adh/adh-statimg.cgi?ref_type=heads#L333</a></p> <p>En bash, la commande pour générer un graphique similaire est la suivante (ici le nom de fichier en entrée est 'fichier.rrd', penser à adapter cette valeur) :</p> <pre><code class="language-sh">rrdtool graph out.png --imgformat=PNG --start=-604800 --end=-1800 --title='Traffic' --rigid --base=1000 \ --height=240 --width=1000 --alt-autoscale-max --lower-limit=0 --vertical-label='bits par secondes' \ DEF:i1='fichier.rrd':traffic_in:AVERAGE \ DEF:o1='fichier.rrd':traffic_out:AVERAGE \ CDEF:cdefa=i1,8,* \ CDEF:cdefe=o1,8,* \ CDEF:mx=0,0,EXC,i1,UN,0,i1,IF,+,EXC,o1,UN,0,o1,IF,+,MAX,8,* \ VDEF:pct=mx,95,PERCENT \ AREA:cdefa#00CF00:'Entrée' \ GPRINT:cdefa:LAST:' Courant\:%8.2lf %s' \ GPRINT:cdefa:AVERAGE:'Moyenne\:%8.2lf %s' \ GPRINT:cdefa:MAX:'Maximum\:%8.2lf %s' \ LINE1:cdefe#002A97:'Sortie' \ GPRINT:cdefe:LAST:'Courant\:%8.2lf %s' \ GPRINT:cdefe:AVERAGE:'Moyenne\:%8.2lf %s' \ GPRINT:cdefe:MAX:'Maximum\:%8.2lf %s' \ LINE1:pct#FF0000:'95e ' \ GPRINT:pct:'95e centile\:%8.2lf %s'</code></pre> <p>Cette commande génère un fichier png &quot;out.png&quot; de ~240x1000 pixels, dans l'interval temporel -604800 secondes (une semaine dans le passé) à -1800 (30 minutes dans le passé). </p> <p>Les paramètres sur lesquels on voudra éventuellement jouer pour personnaliser/améliorer le graphique résultant sont les suivants :</p> <ul> <li><code>--start=</code> et <code>--end=</code> : bornes de l'interval qu'on souhaite représenter en secondes. </li> <li><code>--height</code> et <code>--width</code> : dimensions de l'image en pixels </li> <li><code>--imgformat</code> : peut être PNG|SVG|EPS|PDF|XML|XMLENUM|JSON|JSONTIME|CSV|TSV|SSV (penser à adapter l'extension de 'out.png') </li> <li>Les différentes couleurs sont représentées par un code héxadécimal du type #RRGGBB ()</li> </ul> <h5>Bornes d'intervals usuels</h5> <p>Les bornes d'intervals suivantes sont utilisées par le script du SI :</p> <pre><code>* quotidien : -86400, -300 * hebdomadaire : -604800, -1800 * mensuel : -2678400, -7200 * annuel : -33053184, -86400</code></pre> <p>Le calcul est simple, on multiplie les secondes par le nombre de minutes, heures, jour, etc. Exemple pour 4 jours : <code>60s * 60m * 24h * 4j</code> qui donne 345600 secondes.</p> <p><strong>Ne pas oublier le signe mathématique '-' (moins) devant le nombre (on regarde dans le passé dans la plupart des cas).</strong></p> Thu, 10 Apr 2025 02:00:00 +0200 https://wiki.arthus.net/?rrdtool-fdn https://wiki.arthus.net/?rrdtool-fdn Utilisation du TommyProm32 <h1>Utilisation du TommyProm32</h1> <p>[toc]</p> <h2>Matériel nécessaire</h2> <ul> <li>Un <a href="https://github.com/TomNisbet/TommyPROM/">TommyProm32</a></li> <li>Une (E)EPROM (<a href="https://wiki.arthus.net/assets/SST39SF.pdf">SST 39SF040</a> par exemple)</li> </ul> <h2>Flasher le TommyProm32 avec la configuration pour SST</h2> <p>En fonction du type de puce à flasher, il faut reprogrammer l'Arduino nano présent sur le PCB, via le logiciel 'Arduino'.</p> <ol> <li>Installer le <a href="https://www.arduino.cc/en/software">logiciel arduino</a> </li> <li><a href="https://www.robot-maker.com/ouvrages/tuto-arduino/installer-configurer-ide-arduino/">Configurer</a> le logiciel Arduino pour utiliser la bonne carte.</li> <li>Télécharger <a href="https://github.com/TomNisbet/TommyPROM/archive/refs/heads/master.zip">le sketch arduino du TommyProm32 </a> </li> <li>Extraire les fichiers dans le dossier de votre choix et ouvrir le projet <code>TommyPROM.ino</code> qui se trouve dans le dossier 'TommyPROM'.</li> <li>Dans le fichier 'Configure.h', dé-commenter la ligne correspondant à votre type de puce en supprimant les <code>//</code> qui se trouvent devant (lignes 9 à 14). </li> <li>Vérifier et téléverser le sketch. </li> </ol> <p><img src="https://wiki.arthus.net/assets/arduino-upload.png" alt="Arduino IDE GUI" /></p> <h3>Cas de l'utilisation d'un clône Arduino LGT8F328P</h3> <p>Ces cartes peu onéreuses (~3$) nécessitent <a href="https://github.com/RalphBacon/LGT8F328P-Arduino-Clone-Chip-ATMega328P?tab=readme-ov-file#6-simple-steps-to-get-a-lgt8f328p-based-board-running-at-32mhz">l'installation d'une librairie</a> spéciale dans le logiciel Arduino pour pourvoir les flasher. </p> <ol> <li>Télécharger <a href="https://github.com/LGTMCU/Larduino_HSP/archive/master.zip">l'archive de lalibrairie ici.</a> </li> <li>Extraire le dossier 'LGT' contenu dans l'archive dans le dossier 'hardware' qui se trouve lui même dans le dossier de vos sketches, par défaut :</li> </ol> <table> <thead> <tr> <th style="text-align: left;">OS</th> <th style="text-align: left;">Chemin</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">Windows</td> <td style="text-align: left;">C:\Users\&lt;Username>\Documents\Arduino</td> </tr> <tr> <td style="text-align: left;">Mac OSX</td> <td style="text-align: left;">/Users/user/Documents/Arduino</td> </tr> <tr> <td style="text-align: left;">LINUX</td> <td style="text-align: left;">/home/&lt;Username>/sketchbook/</td> </tr> </tbody> </table> <ol start="3"> <li>Dans le logiciel Arduino, sélectionner la carte &quot;LGT8F328P-LQFP32 MiniEVB&quot; via le menu &quot;Outils&quot; &gt; &quot;Type de carte&quot; &gt; &quot;Arduino AVR boards (from sketchbook)&quot;.</li> </ol> <p>Vous devriez maintenant pouvoir téléverser des croquis sur la carte. </p> <h2>SST39SF0X0</h2> <p>Les puces SST39SF0x0 ne nécessitent qu'une tension de 5V pour être programmée, et celle-ci est fournie par le Arduino directement depuis le port USB de l'ordinateur. </p> <h2>Connexions</h2> <p>Aucune connexion particulière n'est requise, il faut juste faire attention à insérer la puce avec le détrompeur vers l'extérieur du PCB (côté du levier du support ZIF).<br /> Avec le levier du support ZIF en position verticale, insérer la puce, puis abaisser le levier.<br /> Si on travaille avec une DIP-28 ou 24, on insérera la puce le plus bas possible sur le support (au niveau de l'inscription GND). </p> <p><img src="https://wiki.arthus.net/assets/TP32-595.jpg" alt="tp32-27c512" /></p> <h2>Opérations</h2> <ul> <li>Insérer la puce au format Dip-32 dans le support ZIF.</li> <li>Connecter le programmateur via un câble USB à un ordinateur équippé d'un logiciel de terminal série (<a href="https://teratermproject.github.io/index-en.html">TeraTerm</a> sous Windows, <a href="https://salsa.debian.org/minicom-team/minicom">Minicom</a> sous Linux).</li> <li>Lancer le logiciel de terminal et ouvrir la connexion série vers le périphérique série (ex: <code>COM3</code> sous Windows, <code>/dev/ttyACM0</code> sous Linux).</li> <li>Configurer la connexion avec les paramètres suivants : 115200 baud, 8 bits, no parity, 1 stop bit.<br /> Pour ce faire, <strong>Sous Windows</strong> dans Teraterm, menu 'Setup' &gt; 'Serial' puis entrer les bon paramètres.<br /> <img src="https://wiki.arthus.net/assets/teraterm-serial.jpg" alt="Config" /><br /> <strong>Sous Linux</strong> dans minicom, Ctrl-A P, puis touches E, L, V, Q. </li> <li>En appuyant ensuite sur n'importe quelle touche, un menu doit apparaître:<br /> <img src="https://wiki.arthus.net/assets/teraterm-tp.jpg" alt="Menu" /> </li> </ul> <p>Toutes les commandes prennent la forme <code>Xsssss eeeee</code> ou <code>X</code> correspond à une commande, <code>sssss</code> l'adresse de débutet <code>eeeee</code> l'adresse de fin (en héxadécimal). </p> <h3>Lecture d'une valeur sur l'eprom</h3> <p>Lancer une commande de lecture, par exemple <code>D0 ff</code> pour lire les valeurs des bits 0 jusqu'à 255. </p> <h3>Dump d'une eprom et transfert sur le disque dur</h3> <ol> <li>Lancer une commande de lecture, par exemple <code>R0 10000</code> pour dumper les valeurs de 0 jusqu'à 65536 (64Kio). </li> <li><strong>Sous Windows</strong> dans Teraterm :Lancer la réception des données en allant dans le menu 'File' &gt; 'Transfer' &gt; XMODEM &gt; Receive...<br /> <img src="https://wiki.arthus.net/assets/tt.gif" alt="Menu" /><br /> <strong>Sous Linux</strong> dans Minicom : Ctrl-A R, xmodem</li> <li>Sélectionner un emplacement pour sauver le fichier et valider.</li> </ol> <h3>Écriture d'une eprom</h3> <ol> <li>Lancer une commande d'écriture, par exemple <code>W0</code> pour écrire les données à partir de l'adresse 0.</li> <li><strong>Sous Windows</strong> dans Teraterm : Lancer l'envoi des données en allant dans le menu 'File' &gt; 'Transfer' &gt; XMODEM &gt; Send...<br /> <strong>Sous Linux</strong> dans Minicom : Ctrl-A S, xmodem</li> <li>Sélectionner un fichier à écrire et valider.</li> </ol> <h2>Linux: Minicom et problème de transferts xmodem</h2> <p>Sous Linux, en cas de problème avec minicom et le transfert xmodem, il faudra peut-être installer le paquet <code>lrzsz</code> et configurer la commande de transfert dans minicom : </p> <p>Pour ouvrir le menu de configuration : Ctrl-A O, Protocoles de transfert, touche C pour xmodem, Entrée, puis éditer la commande suivante : </p> <p><code>lrzsz-sx -b -X</code> </p> <p>Laisser tout le reste par défaut, appuyer sur la touche Entrée jusqu'au retour dans le menu, puis sélectionner <code>Enregistrer config. sous dfl</code> </p> <h2>Alimentation externe - exemple d'une EPROM 27C512</h2> <p>Un article spécifique pour les EPROM nécessitant une alimentation externe <a href="/?tommy-prom-32-27c512">est disponible ici.</a> </p> <h2>Références</h2> <p><a href="https://tomnisbet.github.io/TommyPROM/docs/tommyprom32-pcb#tommyprom32">https://tomnisbet.github.io/TommyPROM/docs/tommyprom32-pcb#tommyprom32</a><br /> <a href="https://ww1.microchip.com/downloads/en/DeviceDoc/20005022C.pdf">https://ww1.microchip.com/downloads/en/DeviceDoc/20005022C.pdf</a><br /> <a href="https://github.com/LGTMCU/Larduino_HSP">https://github.com/LGTMCU/Larduino_HSP</a><br /> <a href="https://github.com/RalphBacon/LGT8F328P-Arduino-Clone-Chip-ATMega328P?tab=readme-ov-file#6-simple-steps-to-get-a-lgt8f328p-based-board-running-at-32mhz">https://github.com/RalphBacon/LGT8F328P-Arduino-Clone-Chip-ATMega328P?tab=readme-ov-file#6-simple-steps-to-get-a-lgt8f328p-based-board-running-at-32mhz</a> </p> Thu, 26 Sep 2024 02:00:00 +0200 https://wiki.arthus.net/?tommy-prom-32 https://wiki.arthus.net/?tommy-prom-32 Flasher une ST M27C512 avec un TommyProm32 <h1>Flasher une ST M27C512 avec un TommyProm32</h1> <p>[toc]</p> <h2>Matériel nécessaire</h2> <ul> <li>Un <a href="https://github.com/TomNisbet/TommyPROM/">TommyProm32</a></li> <li>Une EPROM <a href="https://wiki.arthus.net/assets/m27c512.pdf">ST M27C512-45XF1 CDIP28 512 Kbit 64K x8</a> </li> <li>Deux cables Dupont</li> <li>Une alimentation capable de fournir du 6,25V et du 12,75V simultanément.</li> </ul> <h2>Utilisation générale</h2> <p>Une documentation plus générale <a href="?tommy-prom-32">est disponible ici</a> avec les instructions pour flasher le programmateur.</p> <h2>M27C512</h2> <p>La puce M27C512 nécessite deux tensions différentes pour être programmée . </p> <p>L'alimentation externe fournit du 12.75V à 'VPP Out 1' qui est routée sur la broche 22 correspondant à Vpp, et marquée O̅E̅ sur le PCB. </p> <p>Cette alimentation fournit aussi du 6.25V à 'VPP Out 2' qui est routée sur la broche 15 correspondant à Vcc, et marquée A17 sur le PCB. </p> <p>Notez que l'alimentation 5V du PCB est déconnectée de la puce en mode programmation. </p> <p>Deux jumpers doivent être placés aux emplacements J12 et J20 (en bas à droite du PCB) lorsque l'on souhaite effectuer des opérations d'écriture. </p> <p>Ils doivent être retirés pour les opérations de lecture. </p> <h2>Connexions</h2> <p>Il faut faire attention à insérer la puce avec le détrompeur vers l'extérieur du PCB (côté du levier du support ZIF). </p> <p><img src="https://wiki.arthus.net/assets/tp32-27c512.jpg" alt="tp32-27c512" /></p> <h2>Opérations</h2> <ul> <li>Insérer la puce au format Dip-28 dans le support ZIF.</li> <li>Connecter le programmateur via un câble USB à un ordinateur équippé d'un logiciel de terminal série (<a href="https://teratermproject.github.io/index-en.html">TeraTerm</a> sous Windows, <a href="https://salsa.debian.org/minicom-team/minicom">Minicom</a> sous Linux).</li> <li>Lancer le logiciel de terminal et ouvrir la connexion série vers le périphérique série (ex: <code>COM3</code> sous Windows, <code>/dev/ttyACM0</code> sous Linux).</li> <li>Configurer la connexion avec les paramètres suivants : 115200 baud, 8 bits, no parity, 1 stop bit.<br /> Pour ce faire, <strong>sous Windows</strong> dans Teraterm, menu 'Setup' &gt; 'Serial' puis entrer les bon paramètres.<br /> <img src="https://wiki.arthus.net/assets/teraterm-serial.jpg" alt="Config" /><br /> <strong>sous Linux</strong> dans minicom, Ctrl-A P, puis touches E, L, V, Q. </li> <li>En appuyant ensuite sur n'importe quelle touche, un menu doit apparaître:<br /> <img src="https://wiki.arthus.net/assets/teraterm-tp.jpg" alt="Menu" /> </li> </ul> <p>Toutes les commandes prennent la forme <code>Xsssss eeeee</code> ou <code>X</code> correspond à une commande, <code>sssss</code> l'adresse de débutet <code>eeeee</code> l'adresse de fin (en héxadécimal). </p> <h3>Lecture d'une valeur sur l'eprom</h3> <ol> <li>Enlever les jumpers aux emplacements J12 et J20</li> <li>Lancer une commande de lecture, par exemple <code>D0 ff</code> pour lire les valeurs des bits 0 jusqu'à 255.</li> </ol> <h3>Dump d'une eprom et transfert sur le disque dur</h3> <ol> <li>Enlever les jumpers aux emplacements J12 et J20</li> <li>Lancer une commande de lecture, par exemple <code>R0 10000</code> pour dumper les valeurs de 0 jusqu'à 65536 (64Kio). </li> <li><strong>sous Windows</strong> dans Teraterm :Lancer la réception des données en allant dans le menu 'File' &gt; 'Transfer' &gt; XMODEM &gt; Receive...<br /> <img src="https://wiki.arthus.net/assets/teraterm-xmod.jpg" alt="Menu" /><br /> <strong>sous Linux</strong> dans Minicom : Ctrl-A R, xmodem</li> <li>Sélectionner un emplacement pour sauver le fichier et valider.</li> </ol> <h3>Écriture d'une eprom</h3> <ol> <li>Placer les jumpers aux emplacements J12 et J20.</li> <li>Lancer une commande d'écriture, par exemple <code>W0</code> pour écrire les données à partir de l'adresse 0.</li> <li><strong>sous Windows</strong> dans Teraterm : Lancer l'envoi des données en allant dans le menu 'File' &gt; 'Transfer' &gt; XMODEM &gt; Send...<br /> <strong>sous Linux</strong> dans Minicom : Ctrl-A S, xmodem</li> <li>Sélectionner un fichier à écrire et valider.</li> </ol> <h2>Linux: Minicom et problème de transferts xmodem</h2> <p>Sous Linux, en cas de problème avec minicom et le transfert xmodem, il faudra peut-être installer le paquet <code>lrzsz</code> et configurer la commande de transfert dans minicom : </p> <p>Pour ouvrir le menu de configuration : Ctrl-A O, Protocoles de transfert, touche C pour xmodem, Entrée, puis éditer la commande suivante : </p> <p><code>lrzsz-sx -b -X</code> </p> <p>Laisser tout le reste par défaut, appuyer sur la touche Entrée jusqu'au retour dans le menu, puis sélectionner <code>Enregistrer config. sous dfl</code> </p> <h2>Références</h2> <p><a href="https://tomnisbet.github.io/TommyPROM/docs/tommyprom32-pcb#m27c256">https://tomnisbet.github.io/TommyPROM/docs/tommyprom32-pcb#m27c256</a><br /> <a href="https://media.digikey.com/pdf/data%20sheets/st%20microelectronics%20pdfs/m27c512.pdf">https://media.digikey.com/pdf/data%20sheets/st%20microelectronics%20pdfs/m27c512.pdf</a></p> Mon, 16 Sep 2024 02:00:00 +0200 https://wiki.arthus.net/?tommy-prom-32-27c512 https://wiki.arthus.net/?tommy-prom-32-27c512 Flasher ses roms Master System avec une Playstation <h1>Flasher ses roms Master System avec une Playstation</h1> <p>[toc]</p> <h2>Hein ?</h2> <p>En utilisant une cartouche de triche modifiée pour accueillir des circuits intégrés de type DIP-32 graçe à un support tulipe ou <a href="https://fr.wikipedia.org/wiki/Zero_insertion_force">ZIF</a>, on peut utiliser une Playstation équippée d'un port parallèle et d'un port série, exécutant le logiciel <a href="https://github.com/JonathanDotCel/unirom8_bootdisc_and_firmware_for_ps1">Unirom</a>, reliée à un ordinateur exécutant le logiciel <a href="https://github.com/JonathanDotCel/NOTPSXSerial">Nops</a>, pour flasher des modules mémoires de type AM29F0<em> ou SST39SF0</em> en variantes 10, 20 ou 40 (128 à 512KB). </p> <p>On peut ensuite utiliser un <a href="https://benryves.com/journal/3763154">cartmod</a> Master System pour exécuter une ROM fraichement flashée.</p> <h2>Matériel requis :</h2> <ul> <li>Une playstation équippée d'un port parrallèle ( SCPH-1000 à 7502)</li> <li>Une cartouche de triche Playstation type Game Hunter Lite/CD</li> <li>Un <a href="/?fabriquer_son_cable_usb_serie_pour_playstation">câble USB/série</a> pour la Playstation</li> <li>Une <a href="https://github.com/brad-lin/FreePSXBoot">carte mémoire avec Unirom installé</a></li> <li>Des modules de mémoire flash type AM29F0<em> ou SST39SF0</em> de 128 à 512 KB (1 à 4 Mb)</li> <li>Une cartouche Master Sytem <a href="https://benryves.com/journal/3763154">modifiée pour accueillir des modules mémoires modernes</a>.</li> </ul> <p>Pour la soudure :</p> <ul> <li>Un fer à souder</li> <li>De la tresse à dessouder</li> <li>Du flux et de l'étain</li> <li>Des supports tulipes ou zif DIP32</li> </ul> <h2>1. Création d'une carte mémoire Unirom pour la Playstation</h2> <p>Le logiciel qui permet de flasher des modules de mémoire côté Playstation s'appelle <a href="https://github.com/JonathanDotCel/unirom8_bootdisc_and_firmware_for_ps1">Unirom</a>. Ce logiciel peut être exécuté depuis un CD (sur une PSX équippée d'un modchip ou gràçe à l'astuce du <a href="http://www.playstation-gate.com/article-technique-le-swap-sur-playstation-1-lire-les-jeux-imports-61593345.html">swap CD</a>), depuis une cartouche de triche type AR ou depuis une carte mémoire <a href="https://github.com/brad-lin/FreePSXBoot">FreePSXboot</a>.<br /> Puisqu'on va changer régulièrement les modules mémoire de la cartouche de triche, et que le boot CD est un peu long, le plus simple est de créer une carte mémoire pour démarrer sous Unirom. </p> <p>Pour cela, il suffit de démarrer une première fois Unirom depuis le CD, avec une carte mémoire dans le port gauche de la PSX, puis de sélectionner l'option &quot;Install-&gt;&quot;, puis &quot;Install FreePSXboot to Memcard&quot;, puis &quot;Auto Install&quot;. </p> <p><img src="https://wiki.arthus.net/assets/unirom_splash.jpg" alt="Splashscreen" /><br /> <img src="https://wiki.arthus.net/assets/unirom_install.jpg" alt="Install" /><br /> <img src="https://wiki.arthus.net/assets/unirom_install_freepsxboot.jpg" alt="Install Freepsxboot to mc" /><br /> <img src="https://wiki.arthus.net/assets/unirom_autoinstall.jpg" alt="auto-install" /> </p> <p>Une fois l'installation terminée, il faut démarrer la PSX sans CD, puis ouvrir le menu de gestion des cartes mémoires pour lancer Unirom.</p> <h2>2. Modification d'une cartouche de triche</h2> <p><img src="https://wiki.arthus.net/assets/game_hunter_cd_version.jpg" alt="Un game hunter version cd" /></p> <p>Les cartouches de triche type &quot;Game Hunter&quot; (et peut-être d'autres modèles) avec une coque transparente on l'avantage d'avoir un circuit imprimé permettant l'adaptation de plusieurs types de modules (DIP, TSOP et PLCC).<br /> Ici, on voit clairement les trous permettant l'insertion d'un DIP32, et le module de format TSOP déjà en place (un AT29C010 de 1Mb/128KB) : </p> <p><img src="https://wiki.arthus.net/assets/game_hunter_cd_version_AT29C010.jpg" alt="Game Hunter avec AT29C010" /></p> <p>Il suffit de dessouder le module mémoire présent sur la cartouche avec de la tresse en faisant bien attention à ne pas abimer les traces (pas comme moi :P), puis d'installer un support tulipe ou ZIF pour pouvoir facilement changer de module par la suite. </p> <p><img src="https://wiki.arthus.net/assets/game-hunter-lite-naked.jpg" alt="Game hunter sans mémoire" /><br /> <img src="https://wiki.arthus.net/assets/game_hunter_dip_socket.jpg" alt="Game hunter avec tulipe" /> </p> <h2>3. Flasher la rom</h2> <ul> <li>Démarrer Unirom sur la PSX, avec la cartouche de triche équippée d'un module flash vide.</li> <li>Brancher la PSX à l'ordi via le cable USB/Série</li> <li>Sur l'ordinateur équippé du logiciel Nops, lancer dans un terminal une commande du type :</li> </ul> <pre><code>nops /fast /rom ROM.SMS /dev/ttyUSBx</code></pre> <p>Adapter &quot;ROM.SMS&quot; et &quot;/dev/ttyUSBx&quot; en fonction de votre configuration et du nom de votre rom MS.<br /> Un message apparaît : </p> <pre><code>Hey hey hey hey! This doesn't look like a ROM. Maybe an .exe? Are you sure you want to flash this?</code></pre> <p>C'est normal, on ne flash pas une rom pour action replay Playstation mais une rom Master System! </p> <p>Nops vous demande de valider l'opération en appuyant sur la touche 'y'. </p> <p><img src="https://wiki.arthus.net/assets/unirom_force.jpg" alt="nops" /> </p> <p>Une fois le module mémoire flashé, le monter dans votre cartmod, et c'est parti!</p> <h2>Sources et références</h2> <p>PSX :</p> <p><a href="https://github.com/JonathanDotCel/unirom8_bootdisc_and_firmware_for_ps1">https://github.com/JonathanDotCel/unirom8_bootdisc_and_firmware_for_ps1</a><br /> <a href="https://github.com/JonathanDotCel/NOTPSXSerial">https://github.com/JonathanDotCel/NOTPSXSerial</a><br /> <a href="https://github.com/brad-lin/FreePSXBoot">https://github.com/brad-lin/FreePSXBoot</a><br /> <a href="https://wiki.arthus.net/?fabriquer_son_cable_usb_serie_pour_playstation">https://wiki.arthus.net/?fabriquer_son_cable_usb_serie_pour_playstation</a> </p> <p>Cartmod MS :</p> <p><a href="https://benryves.com/journal/3763154">https://benryves.com/journal/3763154</a><br /> <a href="https://web.archive.org/web/20141210222820/http://cgfm2.emuviews.com/smsflash.php">https://web.archive.org/web/20141210222820/http://cgfm2.emuviews.com/smsflash.php</a> </p> Tue, 21 May 2024 02:00:00 +0200 https://wiki.arthus.net/?master_system_cartmod https://wiki.arthus.net/?master_system_cartmod Network setup for KVM guests <h1>Network setup for KVM guests</h1> <p>[toc]</p> <h2>Host</h2> <h3>Bridge setup</h3> <p>Install 'bridge-utils' :</p> <pre><code>sudo apt-get install bridge-utils 16h 7m</code></pre> <p>Add bridge device :</p> <pre><code># 'br0' can be watherver you like. brctl addbr br0</code></pre> <p>Edit '/etc/network/interfaces' to add a bridge device and configure it on startup :</p> <pre><code># The loopback network interface auto lo iface lo inet loopback # The primary network interface # Change eth0 to refelct your actual if name allow-hotplug eth0 # Disable DHCP on physical device and use it on br0 instead iface eth0 inet manual # Bridge setup iface br0 inet dhcp bridge_stp off bridge_maxwait 0 bridge_fd 0 # Add physical interface and all vnetX virtual interfaces (in 0-99 range) bridge_ports eth0 regex vnet[0-9]?[0-9] # You can set the bridge device MAC address with #bridge_hw XX:XX:XX:XX:XX:XX</code></pre> <p>If your DHCP server is configured to deliver fixed IP adresses based on MAC, replace eth0's MAC with br0's on your router in order to give it the same local IP. </p> <h3>Virsh : use bridge for network</h3> <p>Create an xml file with the following content : <code>nano /tmp/br0.xml</code></p> <pre><code class="language-xml">&lt;network&gt; &lt;name&gt;br0&lt;/name&gt; &lt;forward mode="bridge"/&gt; &lt;bridge name="br0" /&gt; &lt;/network&gt;</code></pre> <p>Then set it as network :</p> <pre><code>virsh net-define /tmp/br0.xml</code></pre> <p>and start/autostart it :</p> <pre><code>virsh net-start br0 virsh net-autostart br0</code></pre> <p>You can also use 'virt-manager' and set your network via the XML editor. </p> <h3>(Optional) Add a route to your public IP range</h3> <pre><code># Edit to reflect your actual IP range and bridge device name sudo ip route add 0.0.0.0/32 dev br0</code></pre> <p>See <a href="#optional-configure-a-local-and-public-ip">Configure a local and public IP</a> below for the matching configuration on the guest. </p> <h2>Guest</h2> <h3>(Optional) Basic nftables ruleset</h3> <p>The following ruleset accepts SSH and HTTP(s) by default. </p> <p>In your '/etc/nftables.conf': </p> <pre><code class="language-bash">#!/usr/sbin/nft -f flush ruleset table inet firewall { chain inbound_ipv4 { # accepting ping (icmp-echo-request) for diagnostic purposes. # However, it also lets probes discover this host is alive. # This sample accepts them within a certain rate limit: # # icmp type echo-request limit rate 5/second accept } chain inbound_ipv6 { # accept neighbour discovery otherwise connectivity breaks # icmpv6 type { nd-neighbor-solicit, nd-router-advert, nd-neighbor-advert } accept # accepting ping (icmpv6-echo-request) for diagnostic purposes. # However, it also lets probes discover this host is alive. # This sample accepts them within a certain rate limit: # # icmpv6 type echo-request limit rate 5/second accept } chain inbound { # By default, drop all traffic unless it meets a filter # criteria specified by the rules that follow below. type filter hook input priority 0; policy drop; # Allow traffic from established and related packets, drop invalid ct state vmap { established : accept, related : accept, invalid : drop } # Allow loopback traffic. iifname lo accept # Jump to chain according to layer 3 protocol using a verdict map meta protocol vmap { ip : jump inbound_ipv4, ip6 : jump inbound_ipv6 } # Allow SSH on port TCP/22 and allow HTTP(S) TCP/80 and TCP/443 # for IPv4 and IPv6. tcp dport { 22, 80, 443} accept # Uncomment to enable logging of denied inbound traffic # log prefix "[nftables] Inbound Denied: " counter drop } chain forward { # Drop everything (assumes this device is not a router) type filter hook forward priority 0; policy drop; } # no need to define output chain, default policy is accept if undefined. }</code></pre> <p><em>source:<a href="https://wiki.nftables.org/wiki-nftables/index.php/Simple_ruleset_for_a_server">Simple ruleset for a server</a></em></p> <h3>(Optional) Configure a local and public IP</h3> <p>Setup a guest with two network interfaces ; one for local IP and one for public IP.<br /> You should get two network interfaces in the host, <em>e.g ; enp1s0 and enp2s0</em>. </p> <p>In '/etc/network/interfaces' : </p> <pre><code>auto lo iface lo inet loopback # Use DHCP for enp1s0 to get a LAN IP auto enp1s0 iface enp1s0 inet dhcp # Set static public IP on enp2s0 auto enp2s0 iface enp2s0 inet static # Edit to fit your range address 0.0.0.1 broadcast 0.0.0.255 netmask 255.255.255.255</code></pre> <p>Then reboot the guest to apply these settings. </p> <h2>Links</h2> <h3>Sources</h3> <p><a href="https://wiki.debian.org/KVM#Setting_up_bridge_networking">https://wiki.debian.org/KVM#Setting_up_bridge_networking</a><br /> <a href="https://wiki.debian.org/BridgeNetworkConnections#Configuring_bridging_in_.2Fetc.2Fnetwork.2Finterfaces">https://wiki.debian.org/BridgeNetworkConnections#Configuring_bridging<em>in</em>.2Fetc.2Fnetwork.2Finterfaces</a><br /> <a href="https://wiki.debian.org/QEMU#Networking">https://wiki.debian.org/QEMU#Networking</a><br /> <a href="https://manpages.debian.org/bookworm/bridge-utils/bridge-utils-interfaces.5.en.html">https://manpages.debian.org/bookworm/bridge-utils/bridge-utils-interfaces.5.en.html</a><br /> <a href="https://wiki.libvirt.org/VirtualNetworking.html">https://wiki.libvirt.org/VirtualNetworking.html</a></p> <h3>Related discussions</h3> <p><a href="https://serverfault.com/questions/536114/libvirtd-getting-vps-to-use-existing-bridge">https://serverfault.com/questions/536114/libvirtd-getting-vps-to-use-existing-bridge</a><br /> <a href="https://unix.stackexchange.com/questions/245628/configure-public-ip-addresses-in-kvm-vms">https://unix.stackexchange.com/questions/245628/configure-public-ip-addresses-in-kvm-vms</a><br /> <a href="https://serverfault.com/questions/846834/how-to-assign-public-ip-to-kvm-virtual-machine-from-29-subnet#846986">https://serverfault.com/questions/846834/how-to-assign-public-ip-to-kvm-virtual-machine-from-29-subnet#846986</a><br /> <a href="https://serverfault.com/questions/461070/assign-public-and-private-ip-addresses-for-a-kvm-guest">https://serverfault.com/questions/461070/assign-public-and-private-ip-addresses-for-a-kvm-guest</a></p> Fri, 12 Apr 2024 02:00:00 +0200 https://wiki.arthus.net/?kvm-net-bridge https://wiki.arthus.net/?kvm-net-bridge GNU/Linux - Numériser une VHS SECAM/PAL avec le son et l'image sous Linux avec un Dazzle DVC90 <h1>Numériser une VHS SECAM/PAL avec le son et l'image sous Linux avec un Dazzle DVC90</h1> <h2>Résumé</h2> <p>Bien que ce périphérique soit bien supporté sous Linux, la plupart des logiciels de capture (guvcview, obs, xawtv...) auront du mal à capturer le son de vos sources.<br /> Il est pourtant possible d'enregistrer l'image <strong>et</strong> le son avec VLC et quelques options spécifiques V4L2. </p> <p>Cette solution devrait s'appliquer à toute la famille des Dazzle DVC80, DVC100, DVC110, etc. </p> <h2>Le périphérique</h2> <p>Le périphérique est un Pinnacle Dazzle DVC90 et utilise le pilote <a href="https://linuxtv.org/wiki/index.php/Em28xx_devices">em28xx</a>. </p> <h3>lsusb</h3> <pre><code>Bus 001 Device 007: ID 2304:0207 Pinnacle Systems, Inc. Dazzle DVC90 Video Device</code></pre> <h3>dmesg</h3> <pre><code> kernel: usb 1-1: new high-speed USB device number 127 using xhci_hcd kernel: usb 1-1: New USB device found, idVendor=2304, idProduct=0207, bcdDevice= 1.00 kernel: usb 1-1: New USB device strings: Mfr=2, Product=1, SerialNumber=0 kernel: usb 1-1: Product: DVC90 kernel: usb 1-1: Manufacturer: Pinnacle Systems GmbH mtp-probe[414253]: checking bus 1, device 127: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1" mtp-probe[414253]: bus: 1, device: 127 was not an MTP device kernel: em28xx 1-1:1.0: New device Pinnacle Systems GmbH DVC90 @ 480 Mbps (2304:0207, interface 0, class 0) kernel: em28xx 1-1:1.0: Video interface 0 found: bulk isoc kernel: em28xx 1-1:1.0: chip ID is em2710/2820 kernel: em28xx 1-1:1.0: EEPROM ID = 1a eb 67 95, EEPROM hash = 0x3cac3c11 kernel: em28xx 1-1:1.0: EEPROM info: kernel: em28xx 1-1:1.0: AC97 audio (5 sample rates) kernel: em28xx 1-1:1.0: 300mA max power kernel: em28xx 1-1:1.0: Table at offset 0x06, strings=0x0e98, 0x2e6a, 0x0000 kernel: em28xx 1-1:1.0: Identified as Pinnacle Dazzle DVC 90/100/101/107 / Kaiser Baas Video to DVD maker / Kworld DVD Maker 2 / Plextor ConvertX PX-AV100U (card=9) kernel: em28xx 1-1:1.0: analog set to isoc mode. kernel: em28xx 1-1:1.1: audio device (2304:0207): interface 1, class 1 kernel: em28xx 1-1:1.2: audio device (2304:0207): interface 2, class 1 kernel: usbcore: registered new interface driver em28xx kernel: em28xx 1-1:1.0: Registering V4L2 extension kernel: usbcore: registered new interface driver snd-usb-audio mtp-probe[414330]: checking bus 1, device 127: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1" mtp-probe[414330]: bus: 1, device: 127 was not an MTP device (udev-worker)[414336]: controlC2: Process '/usr/bin/alsactl restore 2' failed with exit code 99. systemd[1705]: Reached target Sound Card. kernel: saa7115 7-0025: saa7113 found @ 0x4a (1-1:1.0) kernel: em28xx 1-1:1.0: Config register raw data: 0x12 kernel: em28xx 1-1:1.0: AC97 vendor ID = 0xffffffff kernel: em28xx 1-1:1.0: AC97 features = 0x6a90 kernel: em28xx 1-1:1.0: Empia 202 AC97 audio processor detected kernel: em28xx 1-1:1.0: V4L2 video device registered as video1 kernel: em28xx 1-1:1.0: V4L2 extension successfully initialized kernel: em28xx: Registered (Em28xx v4l2 Extension) extension</code></pre> <h3>/proc/asound/cards</h3> <pre><code> 2 [DVC90 ]: USB-Audio - DVC90 Pinnacle Systems GmbH DVC90 at usb-0000:00:14.0-1, high speed </code></pre> <h2>Obtenir de la vidéo et de l'audio dans VLC</h2> <ol> <li>Dans VLC, choisir l'option &quot;Convertir/Enregistrer&quot; dans le menu &quot;Média&quot;.</li> <li>Dans la nouvelle fenêtre, passer dans l'onglet &quot;Périphérique de capture&quot; tab, choisir &quot;/dev/video1&quot; comme périphérique vidéo (à adapter en fonction de votre configuration).</li> <li>Choisir &quot;hw:2,0&quot; comme périphérique audio.</li> <li>Choisir &quot;SECAM L&quot; pour du SECAM en france.</li> <li>Cocher &quot;Montrer plus d'options&quot; en bas à gauche de la fenêtre.</li> <li>Dans le champ &quot;modifier les options&quot;, utiliser la ligne suivante <pre><code># La doc de ces options est dispo ici: https://wiki.videolan.org/Documentation:Modules/v4l2/ # Changer v4l2-input a 0 pour du composite, 1 pour du s-video. # Changer DVC90 to DVC80/100/110 en fonction de votre peripherique. # Changer v4l2-standard et v4l2-fps en fonction de la source. :v4l2-standard=SECAM :input-slave=alsa://plughw:DVC90 :v4l2-input=1 :v4l2-width=720 :v4l2-height=576 :v4l2-fps=25 :no-v4l2-audio-mute :live-caching=300</code></pre></li> <li>Cliquer sur le boutton &quot;Convertir/Enregistrer&quot;</li> <li>Cocher &quot;Afficher le flux de sortie&quot; et &quot;Désinterlacer&quot;, éditer les options des codecs si besoin, et choisir un fichier de sortie.</li> <li>Cliquer sur &quot;Démarrer&quot;.</li> </ol> <p>English version: <a href="https://gist.github.com/ABelliqueux/f5eef886b1fe09e78f12b590b119c1ec">https://gist.github.com/ABelliqueux/f5eef886b1fe09e78f12b590b119c1ec</a><br /> Source: <a href="https://debian-facile.org/viewtopic.php?id=25505">https://debian-facile.org/viewtopic.php?id=25505</a> </p> Sat, 22 Apr 2023 02:00:00 +0200 https://wiki.arthus.net/?numeriser_SECAM_PAL_VHS_Dazzle_DVC90_Linux https://wiki.arthus.net/?numeriser_SECAM_PAL_VHS_Dazzle_DVC90_Linux GNU/Linux - Udev & systemd - Running a graphic environment when a USB device is plugged in <h1>GNU/Linux - Udev &amp; systemd - Running a graphic environment when a USB device is plugged in</h1> <h2>Summary :</h2> <p>At a GNU/Linux console prompt, no GUI. When a USB device of type <a href="https://en.wikipedia.org/wiki/Human_interface_device">HID</a> (keyboard/mouse mainly) is plugged in, we want the X server to start and launch VLC's graphical interface, fullscreen, no borders. When this device is removed, VLC is shut down and the X server too, and we end up back at the console prompt.</p> <h3>Proposed solution:</h3> <ol> <li><a href="https://wiki.archlinux.org/title/Udev">Udev</a> rules are triggered when the USB device is plugged/unplugged to create a file in '/tmp' named '.vlc_gui'.</li> <li>A systemd <a href="https://wiki.archlinux.org/title/Systemd/User">user</a> service starts a script on startup.</li> <li>This script uses <a href="https://man.archlinux.org/man/inotifywait.1">inotifywait</a> to monitor a file's creation/deletion in the '/tmp' folder, and act accordingly;</li> <li>Start/close a minimal graphical environment with <a href="http://openbox.org/">openbox</a> running <a href="https://videolan.org">VLC</a>.</li> </ol> <h2>1. Udev configuration</h2> <h3>Run script on USB HID (mouse/kb) connect</h3> <p>We want a rule that triggers when a device has SUBSYSTEM==&quot;usb&quot; and DRIVER==&quot;usbhid&quot;. </p> <p>In '/etc/udev/rules.d/01-vlc_gui.rules' : </p> <pre><code># On plug ACTION=="add" SUBSYSTEM=="usb", DRIVER=="usbhid", RUN+="/usr/bin/touch /tmp/.vlc_gui" # On un-plug ACTION=="remove" SUBSYSTEM=="usb", RUN+="/usr/bin/rm -f /tmp/.vlc_gui"</code></pre> <p>The rules above create a '.vlc_gui' file in '/tmp' when a usbhid device is plugged in, and removes it when unplugged.</p> <h3>Change read permissions on tty7</h3> <p>By default, permissions on '/dev/tty*' are 0620 (<code>crw--w----</code>). So members of group <code>tty</code> can write, but not read to ttys. This will be a problem for the X server, so we need to change those permissions to have read writes for our group too. </p> <p>Let's change the permissions on the tty that we need to 0660 (<code>crw-rw----</code>) so that we can run our X session on it. </p> <p>Inspect how udev sees your TTY (tty7 here): </p> <p><code>udevadm info --attribute-walk --path=/sys/class/tty/tty7</code></p> <pre><code>looking at device '/devices/virtual/tty/tty7': KERNEL=="tty7" SUBSYSTEM=="tty" DRIVER=="" ATTR{power/control}=="auto" ATTR{power/runtime_active_time}=="0" ATTR{power/runtime_status}=="unsupported" ATTR{power/runtime_suspended_time}=="0</code></pre> <p>So we want a rule that matches 'KERNEL==&quot;tty7&quot;' and 'SUBSYSTEM==&quot;tty&quot;' and set it to mode '0660': </p> <p><code>SUBSYSTEM=="tty", KERNEL=="tty7", MODE:="0660"</code></p> <p>Notice the <a href="https://www.freedesktop.org/software/systemd/man/udev.html#Operators">immutable operator</a> &quot;:=&quot; for &quot;MODE&quot;; it makes shure this won't be changed by another rule. </p> <p><a href="https://forums.opensuse.org/t/udev-rules-priority-disallow-change-by-other-rules-with-operator/100210">Udev rules order read</a> </p> <p>Test which rules are triggered by a specific device with : </p> <p><code>udevadm test /class/tty/tty7</code></p> <p>Reload and apply the new rules with : </p> <pre><code>udevadm control --reload-rules udevadm trigger</code></pre> <p>Of course, don't forget to add your user to the 'tty' group :</p> <p><code>sudo adduser USERNAME tty</code></p> <p>On some system, you might have to use usermod :</p> <p><code>sudo usermod -a -G tty USERNAME</code></p> <p>then log out/in and check with <code>groups</code> that 'tty' appears in the listed groups. </p> <h2>2. Systemd user unit</h2> <p>We can create <a href="https://wiki.archlinux.org/title/systemd/User">user units</a> in '~/.config/systemd/user/', e.g : </p> <p><code>nano ~/.config/systemd/user/vlc_gui.service</code></p> <pre><code class="language-yaml">[Unit] Description=VLC GUI launcher service [Service] # %h specifier resolves to user home (~ equivalent) ExecStart="%h"/vlc_gui.sh Restart=always [Install] WantedBy=default.target</code></pre> <p>Reload the units with <code>systemctl --user daemon-reload</code><br /> and start/enable the service with<br /> <code>systemctl --user start vlc_gui.service</code> / <code>systemctl --user enable vlc_gui.service</code>. </p> <p>More about systemd specifiers:<br /> <a href="https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Specifiers">https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Specifiers</a> </p> <h3>Starting a user unit as root</h3> <p>If running <a href="https://github.com/systemd/systemd/blob/28795f2c138203fb700fc394f0937708af886116/NEWS#L2809">systemd version &gt;= 248 (2021-03)</a>, you can <a href="https://www.freedesktop.org/software/systemd/man/systemctl.html#-M">start a user unit as root</a>, i.e ;<br /> using <code>sudo systemctl</code> or in a root shell, with e.g: </p> <p><code>sudo systemctl --user --machine USERNAME@ start foo.service</code></p> <p>On prior versions, you have to use either<br /> <code>su - USERNAME -c 'systemctl --user start foo.service'</code> or<br /> <code>runuser -l USERNAME -c 'systemctl --user start foo.service'</code> instead. </p> <h2>3. inotifywait : watch for a file's creation/deletion</h2> <h3>Install the tool :</h3> <p><code>sudo apt-get install inotify-tools</code></p> <h3>Create the script :</h3> <p>In '~/vlc_gui.sh' :</p> <pre><code class="language-bash">#!/usr/bin/env bash inotifywait -m /tmp -e create -e delete | while read directory action file; do if [[ "$file" == ".vlc_gui" ]]; then if [[ "$action" == "CREATE" ]]; then echo "Starting VLC GUI." # Start X environment on tty7 DISPLAY=:0 startx -- vt7 &amp; elif [[ "$action" == "DELETE" ]]; then echo "Killing VLC GUI" pkill vlc fi fi done</code></pre> <p>Don't forget to set execution bit : <code>sudo chmod +x ~/vlc_gui.sh</code></p> <h2>4. Minimal X environment &amp; Launching VLC</h2> <p>Install the following packages : </p> <p><code>sudo apt-get install -y --no-install-recommends --no-install-suggests xinit xserver-xorg xserver-xorg-core xserver-xorg-input-evdev xserver-xorg-input-kbd openbox feh</code></p> <h3>Xinit config</h3> <p>We start the X environment with <code>startx</code>, which sources &quot;~/.xinitrc&quot;.<br /> Let's start openbox session there. </p> <p><code>cp /etc/X11/xinit/xinitrc ~/.xinitrc</code></p> <p>Then in &quot;~/.xinitrc&quot; : </p> <pre><code class="language-bash">#!/bin/sh # /etc/X11/xinit/xinitrc # # global xinitrc file, used by all X sessions started by xinit (startx) # invoke global X session script . /etc/X11/Xsession exec openbox-session</code></pre> <p>Set execution bit : </p> <p><code>sudo chmod +x ~/.xinitrc</code></p> <h3>Openbox configuration</h3> <p>Now Openbox config files are in '~/.config/openbox' and there are two of them :</p> <h4>autostart.sh</h4> <p>In '~/.config/openbox/autostart.sh' :</p> <pre><code class="language-bash">#!/bin/bash # Exit openbox when VLC is closed vlc --vout=gles2 &amp;&amp; openbox --exit # on rpi with 3d kms driver, can be --vout=drm_vout </code></pre> <p>Set execution bit : </p> <p><code>sudo chmod +x ~/.config/openbox/autostart.sh</code></p> <h4>rc.xml</h4> <p><code>cp /etc/xdg/openbox/rc.xml ~/.config/openbox/</code></p> <p>We want the VLC gui launching fullscreen, with no window decoration. In openbox's <a href="http://openbox.org/wiki/Help:Applications">&lt;applications></a> section of '~/.config/openbox/rc.xml', l.656, add: </p> <pre><code class="language-markup"> &lt;application name="vlc" role="vlc-main"&gt; &lt;decor&gt;no&lt;/decor&gt; &lt;maximized&gt;yes&lt;/maximized&gt; &lt;/application&gt;</code></pre> <h2>Troubleshooting</h2> <h3>Udev rules</h3> <p>You can increase udev's log verbosity with <code>sudo udevadm control --log-priority=debug</code><br /> then run <code>journalctl -f</code> to see if an error message comes up when plugging/unplugging the USB HID.</p> <h3>Xserver</h3> <p>You can see what's going on by launching <code>journalctl -f</code> in a SSH session, then plug/unplug the USB HID.<br /> If you encounter an error with the X server complaining about permission to tty7 like this </p> <pre><code>(EE) xf86OpenConsole: Cannot open virtual console 7 (Permission denied)</code></pre> <p>try rebooting. </p> <h3>Slow mouse cursor</h3> <p>If you experience laggy mouse cursor movements, you can try adding <code>usbhid.mousepoll=0</code> to '/boot/cmdline.txt'.</p> <p>Other values you might want to try are :</p> <table> <thead> <tr> <th style="text-align: center;">value</th> <th style="text-align: center;">speed</th> </tr> </thead> <tbody> <tr> <td style="text-align: center;">0</td> <td style="text-align: center;">device request</td> </tr> <tr> <td style="text-align: center;">X</td> <td style="text-align: center;">1000/X Hz</td> </tr> </tbody> </table> <p>source: <a href="https://peppe8o.com/fixing-slow-mouse-with-raspberry-pi-os/">https://peppe8o.com/fixing-slow-mouse-with-raspberry-pi-os/</a> </p> Thu, 19 Jan 2023 01:00:00 +0100 https://wiki.arthus.net/?UDEV_systemd_start_x_environment_usb_plugging https://wiki.arthus.net/?UDEV_systemd_start_x_environment_usb_plugging Rpi config.txt - Safe overclocking values <h1>Rpi config.txt - Safe overclocking values</h1> <p>To get a little boost out of your RPI while being conservative for applications where you need reliability and avoid data corruption, I found these values to do the job. </p> <p>This goes in '/boot/config.txt' : </p> <pre><code># SD card reader OC (expect 20% rio improvement) # Samsung Pro/Evo+ is recommended # default value : 50 # value needs to be an int divisor of core_freq # NEEDS A UHS-1/Class10 SD CARD ! # dtparam=sd_overclock=100 # To check the sd card clock once booted : cat /sys/kernel/debug/mmc0/ios | grep 'actual clock' [pi4] # Run as fast as firmware / board allows arm_boost=1 dtoverlay=disable-bt dtoverlay=vc4-kms-v3d max_framebuffers=2 # Apply to rpi3, rpi3+, cm3 [pi3] # Safe OC values # gpu_freq : Sets core_freq, h264_freq, isp_freq, v3d_freq and hevc_freq together # default values : # arm_freq 1200 # gpu_freq 400 # sdram_freq 450 arm_freq=1300 gpu_freq=462 sdram_freq=500 over_voltage=3 # NEEDS A UHS-1/Class10 SD CARD ! dtparam=sd_overclock=66 # Disable bluetooth dtoverlay=disable-bt # Enable DRM VC4 V3D driver dtoverlay=vc4-kms-v3d max_framebuffers=2 # Override OC values for 3+ models [pi3+] # Defaults values : # arm_freq 1400 # gpu_freq 400 # sdram_freq 500 arm_freq=1500 sdram_freq=550 [pi1] # default values # arm_freq 700 # gpu_freq 250 # sdram_freq 400 arm_freq=1000 gpu_freq=400 sdram_freq=500 over_voltage=6 [all] # This much is needed for 1080p playback gpu_mem=64 # Force HDMI Full HD hdmi_group=1 hdmi_mode=16 # fullHD@60 # Avoid SD card corruption boot_delay=1 # Disable rainbow splash and power warnings avoid_warnings=1 disable_splash=1</code></pre> <h2>Some links</h2> <ul> <li>RPI's official doc on overclocking : <a href="https://www.raspberrypi.com/documentation/computers/config_txt.html#overclocking-options">https://www.raspberrypi.com/documentation/computers/config_txt.html#overclocking-options</a></li> <li>SD overclocking guide : <a href="https://www.jeffgeerling.com/blog/2016/how-overclock-microsd-card-reader-on-raspberry-pi-3">https://www.jeffgeerling.com/blog/2016/how-overclock-microsd-card-reader-on-raspberry-pi-3</a></li> <li>SD card benchmarks : <a href="https://www.pidramble.com/wiki/benchmarks/microsd-cards">https://www.pidramble.com/wiki/benchmarks/microsd-cards</a></li> </ul> Thu, 12 Jan 2023 01:00:00 +0100 https://wiki.arthus.net/?Rpi_config_txt_safe_oc_values https://wiki.arthus.net/?Rpi_config_txt_safe_oc_values Rpi 3A+/3B+/4B wifi - BCM4345 and CTRL-EVENT-ASSOC-REJECT <h1>Rpi 3A+/3B+/4B wifi - BCM4345 and CTRL-EVENT-ASSOC-REJECT when using handshake offloading</h1> <p>I encountered an issue with the wifi on my 3A+/4B not willing to connect to my AP, while my 3B was perfectly happy with it. Turns out it's a driver issue with 'brcmfmac' and the BCM4345 chipset that's in newer RPI models.<br /> I'm using <strong>raspios bullseye (2022-09-22-raspios-bullseye-arm64-lite.img.xz)</strong>. </p> <p><code>wpa_supplicant</code> kept insisting that <code>CTRL-EVENT-ASSOC-REJECT</code>, i.e: </p> <pre><code>sudo wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0 Successfully initialized wpa_supplicant wlan0: Trying to associate with **:**:**:**:**:** (SSID='foo' freq=2417 MHz) wlan0: CTRL-EVENT-ASSOC-REJECT bssid=**:**:**:**:**:** status_code=16 wlan0: Trying to associate with **:**:**:**:**:** (SSID='foo' freq=2417 MHz) wlan0: CTRL-EVENT-ASSOC-REJECT bssid=**:**:**:**:**:** status_code=16 wlan0: Trying to associate with **:**:**:**:**:** (SSID='foo' freq=2417 MHz) wlan0: CTRL-EVENT-ASSOC-REJECT bssid=**:**:**:**:**:** status_code=16 [etc]</code></pre> <h2>Why is this happening ?</h2> <p>After a <strong>LOT</strong> of troubleshooting and tests, and web searching, I stumbled upon several interesting pages and bug reports : </p> <ul> <li>A wiki page in <a href="https://iwd.wiki.kernel.org/start">IWD</a>'s wiki kernel.org : <a href="https://iwd.wiki.kernel.org/offloading">https://iwd.wiki.kernel.org/offloading</a>- <a href="https://web.archive.org/web/20221129112439/https://iwd.wiki.kernel.org/offloading">mirror</a> with an explanation as to why this happens</li> <li>A bug report linked in the page above : <a href="https://lore.kernel.org/linux-wireless/e1ff2a8eef465eaa76e8d00503d04e0fdd61a878.camel@gmail.com/">https://lore.kernel.org/linux-wireless/e1ff2a8eef465eaa76e8d00503d04e0fdd61a878.camel@gmail.com/</a> - <a href="https://web.archive.org/web/20220704011121/https://lore.kernel.org/linux-wireless/e1ff2a8eef465eaa76e8d00503d04e0fdd61a878.camel@gmail.com/">mirror</a> </li> <li>Another bug report on launchpad.net <a href="https://bugs.launchpad.net/raspbian/+bug/1929746">https://bugs.launchpad.net/raspbian/+bug/1929746</a> - <a href="https://web.archive.org/web/20230107122421/https://bugs.launchpad.net/raspbian/%20bug/1929746">mirror</a></li> </ul> <p>From the wiki linked above :</p> <blockquote> <p>Certain drivers support offloading the 4-way handshake as well as SAE/WPA3 into the firmware. For drivers which do not support user space driven Authenticate/Associate frames this is the only way to enable features such as SAE/WPA3 or Fast Transition roaming. Handshake offloading (both WPA2 and WPA3) is enabled in IWD by default for drivers which advertise support. The driver support, however, can be disabled on brcmfmac which will be discussed further. Handshake offloading has only been tested on the brcmfmac driver, and this wiki page assumes this driver is being used. </p> <p>If you are using brcmfmac and are experiencing problems such as not being able to connect to a network which you previously could, you may want to disable handshake offloading.</p> <p>The brcmfmac driver has a module parameter called 'feature_disable'. It expects a hex value (bitmask) where each bit corresponds to a feature [...]. The features we care about here are 'SAE' and 'FWSUP'. These features (when enabled) are listed in /sys/kernel/debug/ieee80211/<phy>/features so you can first see if your card even supports these before trying to debug further. </p> </blockquote> <p>On the <strong>rpi 3A+ and 4B</strong>, here'is what <code>/sys/kernel/debug/ieee80211/&lt;phy&gt;/features</code> gives us : </p> <pre><code># cat /sys/kernel/debug/ieee80211/phy0/features Features: 001428d6 MCHAN PNO P2P TDLS SCAN_RANDOM_MAC MFP FWSUP DOT11H FWAUTH Quirks: 00000000</code></pre> <blockquote> <p>To turn off offloading you need to remove the brcmfmac module, then reinsert it with the feature_disable option:</p> </blockquote> <pre><code>sudo rmmod brcmfmac sudo modprobe brcmfmac feature_disable=0x82000</code></pre> <blockquote> <p>This will disable both SAE (0x80000) and FWSUP (0x02000). You could disable just one, but this is not suggested due to a bug which prevents EAPoL frames from being forwarded after offloading is used for the first time.</p> </blockquote> <h2>The workaround</h2> <p>You can resolve the issue by using only <code>feature_disable=0x02000</code> if you're sure you won't ever have a WPA3/SAE AP around, but due to the bug mentionned above, you might want to be on the safe side and disable SAE as well while this bug exists.</p> <pre><code>sudo rmmod brcmfmac sudo modprobe brcmfmac roamoff=1 feature_disable=0x82000</code></pre> <h2>Driver options on boot</h2> <p>If that fixes things for you and you want to make this setting persistent, you can create a file with these options in '/etc/modprobe.d', e.g ; </p> <pre><code>echo 'options brcmfmac roamoff=1 feature_disable=0x82000' | sudo tee /etc/modprobe.d/brcmfmac.conf</code></pre> <p>This will make sure the settings are applied when the driver loads. </p> <p>The 3A+/3B+/4B are equipped with a BCM4345 chipset so this should solve wifi issues with those models. </p> Sat, 07 Jan 2023 01:00:00 +0100 https://wiki.arthus.net/?Rpi_wifi_-_BCM4345_and_CTRL-EVENT-ASSOC-REJECT https://wiki.arthus.net/?Rpi_wifi_-_BCM4345_and_CTRL-EVENT-ASSOC-REJECT