{"id":4780,"date":"2025-11-01T08:43:54","date_gmt":"2025-11-01T07:43:54","guid":{"rendered":"https:\/\/workboot.fr\/ciela\/?page_id=4780"},"modified":"2025-11-07T12:10:58","modified_gmt":"2025-11-07T11:10:58","slug":"service-pour-rpi-sous-linux","status":"publish","type":"page","link":"https:\/\/workboot.fr\/ciela\/service-pour-rpi-sous-linux\/","title":{"rendered":"Service pour RPI \u00ab\u00a0GPIO17\u00a0\u00bb"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Pr\u00e9requis: <\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/workboot.fr\/ciela\/systemd-et-daemon\/\">systemd , service ,daemon<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Utilisation des GPIO (<a href=\"https:\/\/workboot.fr\/ciela\/libgpiod\/\">libgpiod<\/a>) version inf\u00e9rieure 2 (bookworm)<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">But:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Piloter Gpio17 (c&rsquo;est mon choix) , projet \u00e0 but p\u00e9dagogique pour les projets !<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Programmation syst\u00e8me Linux<\/strong>&nbsp;: Ma\u00eetrise des services systemd et gestion des d\u00e9mons<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Gestion des GPIO<\/strong>&nbsp;: Compr\u00e9hension approfondie du contr\u00f4le des entr\u00e9es\/sorties<\/li>\n\n\n\n<li><strong>Communication inter-processus<\/strong>&nbsp;: Utilisation des FIFO (named pipes) pour l&rsquo;\u00e9change de donn\u00e9es<\/li>\n\n\n\n<li><strong>Scripting shell avanc\u00e9<\/strong>&nbsp;: D\u00e9veloppement de scripts robustes pour l&rsquo;automatisation<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><br>Syst\u00e8mes embarqu\u00e9s : Contr\u00f4le de dispositifs \u00e9lectroniques via interface unifi\u00e9e<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>IoT et Domotique<\/strong> : Pilotage \u00e0 distance de capteurs et actionneurs<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Automation industrielle<\/strong> : Prototypage rapide de syst\u00e8mes de contr\u00f4le<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Interface Homme-Machine <\/strong>: Cr\u00e9ation d&rsquo;interfaces web ou mobiles pour le contr\u00f4le GPIO<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">va permettre de g\u00e9rer une led sur Gpio17 du RPI<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo 'a' &gt; \/tmp\/gpio_fifo  #allumer\necho 'e' &gt; \/tmp\/gpio_fifo  #eteint\necho 'c' &gt; \/tmp\/gpio_fifo  #clignote a 1 Hz\n\n<\/code><\/pre>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h3 class=\"wp-block-heading\">On dispose des sources du service ici <\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"\/Download\/Service\/gpio_service_V3.tar\">gpio_service_V3<\/a> au format .tar pour Debian <strong>Bookworm<\/strong><\/p>\n<\/div><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Projet gpio_service<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>bruno@work:~\/Works\/gpio_service_V3 $ tree\n.\n\u251c\u2500\u2500 control_gpio.sh\n\u251c\u2500\u2500 gpio_service\n\u251c\u2500\u2500 gpio-service.service\n\u251c\u2500\u2500 Makefile\n\u251c\u2500\u2500 README\n\u2514\u2500\u2500 src\n    \u2514\u2500\u2500 gpio_service.c\n\n2 directories, 6 files\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>gpio_service.c<\/strong><\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/*    ___  ____  __  __        ____  ____  ____  _  _  __  ___  ____ \n     \/ __)(  _ \\(  )\/  \\      \/ ___)(  __)(  _ \\\/ )( \\(  )\/ __)(  __)\n    ( (_ \\ ) __\/ )((  O )____ \\___ \\ ) _)  )   \/\\ \\\/ \/ )(( (__  ) _) \n     \\___\/(__)  (__)\\__\/(____)(____\/(____)(__\\_) \\__\/ (__)\\___)(____)\n(c)bogt 2025 \n*\/\n\/\/#define _GNU_SOURCE\n#include &lt;stdio.h>\n#include &lt;stdlib.h>\n#include &lt;unistd.h>\n#include &lt;fcntl.h>\n#include &lt;signal.h>\n#include &lt;string.h>\n#include &lt;sys\/stat.h>\n#include &lt;errno.h>\n#include &lt;time.h>\n#include &lt;syslog.h>\n#include &lt;sys\/select.h>\n#include &lt;gpiod.h>\n\n#define FIFO_PATH \"\/dev\/gpio_service\"\n\n\/\/ Variables GPIO\nstruct gpiod_chip *chip = NULL;\nstruct gpiod_line *line = NULL;\n\nvolatile sig_atomic_t keep_running = 1;\nint blink_enabled = 0;\nint current_state = 0;\ntime_t last_blink_time = 0;\n\n\/\/ Fonction de debug\n#ifdef DEBUG\n#define DEBUG_LOG(fmt, ...) syslog(LOG_DEBUG, \"DEBUG: \" fmt, ##__VA_ARGS__)\n#else\n#define DEBUG_LOG(fmt, ...) \n#endif\n\nvoid signal_handler(int sig) {\n    (void)sig;\n    DEBUG_LOG(\"Signal %d re\u00e7u\", sig);\n    syslog(LOG_INFO, \"Signal de terminaison re\u00e7u\");\n    keep_running = 0;\n}\n\n\/\/ Initialisation GPIO avec libgpiod\nint init_gpio() {\n    DEBUG_LOG(\"Initialisation GPIO...\");\n    \n    chip = gpiod_chip_open_by_name(\"gpiochip0\");\n    if (!chip) {\n        syslog(LOG_ERR, \"Erreur: Impossible d'ouvrir gpiochip0\");\n        return -1;\n    }\n    DEBUG_LOG(\"Chip GPIO ouvert\");\n    \n    line = gpiod_chip_get_line(chip, 17);\n    if (!line) {\n        syslog(LOG_ERR, \"Erreur: Impossible d'obtenir GPIO17\");\n        gpiod_chip_close(chip);\n        chip = NULL;\n        return -1;\n    }\n    DEBUG_LOG(\"Ligne GPIO17 obtenue\");\n    \n    if (gpiod_line_request_output(line, \"gpio_service\", 0) &lt; 0) {\n        syslog(LOG_ERR, \"Erreur: Impossible de configurer GPIO17 en sortie\");\n        gpiod_chip_close(chip);\n        chip = NULL;\n        line = NULL;\n        return -1;\n    }\n    DEBUG_LOG(\"GPIO17 configur\u00e9e en sortie\");\n    \n    syslog(LOG_INFO, \"GPIO17 initialis\u00e9e avec libgpiod\");\n    return 0;\n}\n\n\/\/ Nettoyage GPIO\nvoid cleanup_gpio() {\n    DEBUG_LOG(\"Nettoyage GPIO...\");\n    \n    if (line) {\n        gpiod_line_set_value(line, 0);\n        gpiod_line_release(line);\n        line = NULL;\n    }\n    if (chip) {\n        gpiod_chip_close(chip);\n        chip = NULL;\n    }\n    DEBUG_LOG(\"GPIO nettoy\u00e9e\");\n}\n\n\/\/ Version optimis\u00e9e avec libgpiod\nvoid set_gpio_state(int state) {\n    if (line) {\n        DEBUG_LOG(\"set_gpio_state(%d) appel\u00e9\", state);\n        int ret = gpiod_line_set_value(line, state);\n        \n        if (ret &lt; 0) {\n            syslog(LOG_ERR, \"Erreur \u00e9criture GPIO17: %d\", ret);\n        } else {\n            current_state = state;\n            syslog(LOG_INFO, \"GPIO17 \u2192 %s\", state ? \"ALLUM\u00c9\" : \"\u00c9TEINT\");\n            DEBUG_LOG(\"GPIO17 \u00e9crite: %d, retour: %d\", state, ret);\n        }\n    } else {\n        syslog(LOG_ERR, \"GPIO17 non initialis\u00e9e\");\n    }\n}\n\nint read_gpio_state() {\n    if (line) {\n        int state = gpiod_line_get_value(line);\n        DEBUG_LOG(\"Lecture GPIO17: %d\", state);\n        return state;\n    }\n    return -1;\n}\n\nvoid process_command(char cmd) {\n    DEBUG_LOG(\"Traitement commande: '%c' (ASCII: %d)\", cmd, cmd);\n    \n    switch(cmd) {\n        case 'a': \/\/ Allumer\n            blink_enabled = 0;\n            set_gpio_state(1);\n            break;\n        case 'e': \/\/ \u00c9teindre\n            blink_enabled = 0;\n            set_gpio_state(0);\n            break;\n        case 'c': \/\/ Clignotant\n            blink_enabled = 1;\n            last_blink_time = time(NULL);\n            syslog(LOG_INFO, \"GPIO17 \u2192 CLIGNOTANT\");\n            DEBUG_LOG(\"Mode clignotant activ\u00e9\");\n            break;\n        case 's': \/\/ Status\n            {\n                int state = read_gpio_state();\n                if (state >= 0) {\n                    syslog(LOG_INFO, \"GPIO17 \u00c9TAT: %s\", state ? \"ALLUM\u00c9\" : \"\u00c9TEINT\");\n                } else {\n                    syslog(LOG_ERR, \"Erreur lecture GPIO17\");\n                }\n            }\n            break;\n        case 'q': \/\/ Quitter\n            keep_running = 0;\n            syslog(LOG_INFO, \"ARR\u00caT demand\u00e9\");\n            break;\n        default:\n            syslog(LOG_WARNING, \"Commande inconnue: '%c'\", cmd);\n    }\n    \n    DEBUG_LOG(\"Commande '%c' trait\u00e9e - blink_enabled=%d, current_state=%d\", \n              cmd, blink_enabled, current_state);\n}\n\nint create_fifo() {\n    DEBUG_LOG(\"Cr\u00e9ation FIFO: %s\", FIFO_PATH);\n    \n    unlink(FIFO_PATH);\n    \n    if (mkfifo(FIFO_PATH, 0666) == -1) {\n        syslog(LOG_ERR, \"Erreur cr\u00e9ation FIFO: %m\");\n        return -1;\n    }\n    \n    if (chmod(FIFO_PATH, 0666) == -1) {\n        syslog(LOG_ERR, \"Erreur chmod FIFO: %m\");\n        unlink(FIFO_PATH);\n        return -1;\n    }\n    \n    DEBUG_LOG(\"FIFO cr\u00e9\u00e9 avec succ\u00e8s\");\n    syslog(LOG_INFO, \"FIFO cr\u00e9\u00e9: %s\", FIFO_PATH);\n    return 0;\n}\n\nint main() {\n    \/\/ Configuration syslog\n    openlog(\"gpio-service\", LOG_PID | LOG_CONS, LOG_DAEMON);\n    \n#ifdef DEBUG\n    syslog(LOG_INFO, \"=== D\u00c9MARRAGE SERVICE GPIO (DEBUG + libgpiod) ===\");\n    DEBUG_LOG(\"Compilation DEBUG activ\u00e9e\");\n#else\n    syslog(LOG_INFO, \"=== D\u00c9MARRAGE SERVICE GPIO (libgpiod) ===\");\n#endif\n    \n    \/\/ Configuration des signaux\n    signal(SIGINT, signal_handler);\n    signal(SIGTERM, signal_handler);\n    \n    \/\/ Initialisation GPIO\n    if (init_gpio() != 0) {\n        syslog(LOG_ERR, \"\u00c9chec initialisation GPIO\");\n        closelog();\n        return 1;\n    }\n    \n    \/\/ Cr\u00e9ation FIFO\n    if (create_fifo() != 0) {\n        cleanup_gpio();\n        closelog();\n        return 1;\n    }\n    \n    \/\/ Initialisation \u00e9tat\n    set_gpio_state(0);\n    syslog(LOG_INFO, \"Service initialis\u00e9 - En attente de commandes\");\n    \n    \/\/ Ouverture FIFO\n    int fifo_fd = open(FIFO_PATH, O_RDONLY | O_NONBLOCK);\n    if (fifo_fd == -1) {\n        syslog(LOG_ERR, \"Erreur ouverture FIFO: %m\");\n        cleanup_gpio();\n        closelog();\n        return 1;\n    }\n    \n    DEBUG_LOG(\"FIFO ouvert avec fd: %d\", fifo_fd);\n    \n    char buffer[10];\n    \n    \/\/ Boucle principale\n    while (keep_running) {\n        DEBUG_LOG(\"D\u00e9but boucle - blink_enabled=%d, current_state=%d\", \n                  blink_enabled, current_state);\n        \n        \/\/ Gestion du clignotement\n        if (blink_enabled) {\n            time_t now = time(NULL);\n            if (now - last_blink_time >= 1) { \/\/ 1 seconde\n                current_state = !current_state;\n                DEBUG_LOG(\"Changement \u00e9tat clignotement: %d\", current_state);\n                set_gpio_state(current_state);\n                last_blink_time = now;\n            }\n        }\n        \n        \/\/ Configuration select() pour lecture non-bloquante\n        fd_set readfds;\n        FD_ZERO(&amp;readfds);\n        FD_SET(fifo_fd, &amp;readfds);\n        \n        struct timeval timeout;\n        timeout.tv_sec = 0;\n        timeout.tv_usec = 100000; \/\/ 100ms\n        \n        int ready = select(fifo_fd + 1, &amp;readfds, NULL, NULL, &amp;timeout);\n        \n        if (ready > 0 &amp;&amp; FD_ISSET(fifo_fd, &amp;readfds)) {\n            \/\/ Donn\u00e9es disponibles\n            ssize_t bytes_read = read(fifo_fd, buffer, sizeof(buffer)-1);\n            if (bytes_read > 0) {\n                buffer[bytes_read] = '\\0';\n                DEBUG_LOG(\"%ld bytes lus: '%s'\", bytes_read, buffer);\n                \n                for (int i = 0; i &lt; bytes_read; i++) {\n                    if (buffer[i] != '\\n' &amp;&amp; buffer[i] != ' ' &amp;&amp; buffer[i] != '\\r') {\n                        syslog(LOG_INFO, \"Commande re\u00e7ue: '%c'\", buffer[i]);\n                        process_command(buffer[i]);\n                    }\n                }\n            }\n        } else if (ready == 0) {\n            DEBUG_LOG(\"Select timeout (pas de donn\u00e9es)\");\n        } else {\n            DEBUG_LOG(\"Select erreur: %s\", strerror(errno));\n        }\n    }\n    \n    \/\/ Nettoyage\n    DEBUG_LOG(\"D\u00e9but nettoyage...\");\n    close(fifo_fd);\n    unlink(FIFO_PATH);\n    cleanup_gpio();\n    syslog(LOG_INFO, \"Service arr\u00eat\u00e9\");\n    closelog();\n    \n    return 0;\n}<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>gpio-service.service<\/strong><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;Unit]\nDescription=GPIO Control Service (libgpiod)\nAfter=multi-user.target\nWants=network.target\n\n&#91;Service]\nType=simple\nExecStart=\/usr\/local\/bin\/gpio_service\nWorkingDirectory=\/usr\/local\/bin\nRestart=always\nRestartSec=5\nUser=root\nGroup=root\n\n# S\u00e9curit\u00e9\nNoNewPrivileges=yes\nPrivateTmp=yes\nProtectSystem=strict\nProtectHome=yes\n\n# Logging\nStandardOutput=journal\nStandardError=journal\nSyslogIdentifier=gpio-service\n\n&#91;Install]\nWantedBy=multi-user.target<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Makefile<\/strong><\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># Configuration\nCC=gcc\nCFLAGS=-Wall -Wextra -std=gnu99 -D_GNU_SOURCE\nRELEASE_FLAGS=-O2\nDEBUG_FLAGS=-g -O0 -DDEBUG\nLIBS=-lgpiod\nTARGET=gpio_service\nSRCDIR=src\nSOURCES=$(SRCDIR)\/gpio_service.c\nBINDIR=\/usr\/local\/bin\nSERVICEDIR=\/etc\/systemd\/system\n\n# Cible par d\u00e9faut (release)\n$(TARGET): $(SOURCES)\n\t$(CC) $(CFLAGS) $(RELEASE_FLAGS) -o $(TARGET) $(SOURCES) $(LIBS)\n\n# Cible debug\ndebug: CFLAGS += $(DEBUG_FLAGS)\ndebug: $(TARGET)\n\t@echo \"\ud83d\udd27 Version DEBUG compil\u00e9e (symboles: -g, optimisation: -O0)\"\n\n# Cible release\nrelease: CFLAGS += $(RELEASE_FLAGS)\nrelease: $(TARGET)\n\t@echo \"\ud83d\ude80 Version RELEASE compil\u00e9e (optimisation: -O2)\"\n\n# Installation\ninstall: $(TARGET)\n\t@echo \"\ud83d\udce6 Installation du service GPIO...\"\n\tsudo install -d $(BINDIR)\n\tsudo install -m 755 $(TARGET) $(BINDIR)\/\n\tsudo install -m 644 gpio-service.service $(SERVICEDIR)\/\n\tsudo systemctl daemon-reload\n\tsudo systemctl enable gpio-service\n\t@echo \"\u2705 Installation termin\u00e9e\"\n\n# Installation version debug\ninstall-debug: debug\n\t@echo \"\ud83d\udc1b Installation version DEBUG...\"\n\tsudo install -d $(BINDIR)\n\tsudo install -m 755 $(TARGET) $(BINDIR)\/\n\tsudo systemctl daemon-reload\n\t@echo \"\u2705 Version DEBUG install\u00e9e\"\n\n# D\u00e9sinstallation\nuninstall:\n\t@echo \"\ud83d\uddd1\ufe0f  D\u00e9sinstallation du service GPIO...\"\n\tsudo systemctl stop gpio-service 2>\/dev\/null || true\n\tsudo systemctl disable gpio-service 2>\/dev\/null || true\n\tsudo rm -f $(BINDIR)\/$(TARGET)\n\tsudo rm -f $(SERVICEDIR)\/gpio-service.service\n\tsudo systemctl daemon-reload\n\tsudo rm -f \/dev\/gpio_service\n\t@echo \"\u2705 D\u00e9sinstallation termin\u00e9e\"\n\n# Nettoyage\nclean:\n\trm -f $(TARGET)\n\t@echo \"\ud83e\uddf9 Fichiers de compilation nettoy\u00e9s\"\n\n# Installation et d\u00e9marrage\nsetup: install start\n\nstart:\n\tsudo systemctl start gpio-service\n\t@echo \"\ud83d\ude80 Service d\u00e9marr\u00e9\"\n\nstop:\n\tsudo systemctl stop gpio-service\n\t@echo \"\ud83d\uded1 Service arr\u00eat\u00e9\"\n\nrestart: stop start\n\nstatus:\n\tsudo systemctl status gpio-service --no-pager\n\nlogs:\n\tsudo journalctl -u gpio-service -f\n\n# Debug avec GDB\ngdb-debug: debug\n\t@echo \"\ud83d\udc1b Lancement avec GDB...\"\n\tsudo systemctl stop gpio-service 2>\/dev\/null || true\n\tsudo gdb --args .\/$(TARGET)\n\ngdb-attach:\n\t@echo \"\ud83d\udd17 Attachement GDB au processus...\"\n\tsudo gdb -p $(shell pgrep gpio_service)\n\n# Informations\ninfo:\n\t@echo \"\ud83d\udccb Informations de compilation:\"\n\t@echo \"   Cible: $(TARGET)\"\n\t@echo \"   Compilateur: $(CC)\"\n\t@echo \"   Flags: $(CFLAGS)\"\n\t@echo \"   Librairies: $(LIBS)\"\n\t@if file $(TARGET) | grep -q debug; then \\\n\t\techo \"   Type: DEBUG\"; \\\n\telse \\\n\t\techo \"   Type: RELEASE\"; \\\n\tfi\n\n.PHONY: all debug release install install-debug uninstall clean setup start stop restart status logs gdb-debug gdb-attach info<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">pour tester le service rapidement<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>control_gpio.sh<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#!\/bin\/bash\n\nFIFO=\"\/dev\/gpio_service\"\nSERVICE=\"gpio-service\"\n\nshow_help() {\n    echo \"Usage: $0 {on|off|blink|status|restart|stop|start|logs|debug|help}\"\n    echo \"\"\n    echo \"  on, a      - Allumer GPIO17 (libgpiod)\"\n    echo \"  off, e     - \u00c9teindre GPIO17 (libgpiod)\"  \n    echo \"  blink, c   - Mode clignotant (1s)\"\n    echo \"  status, s  - \u00c9tat GPIO17\"\n    echo \"  restart    - Red\u00e9marrer service\"\n    echo \"  stop       - Arr\u00eater service\"\n    echo \"  start      - D\u00e9marrer service\"\n    echo \"  logs       - Voir les logs\"\n    echo \"  debug      - Logs debug\"\n    echo \"  help       - Cette aide\"\n}\n\ncase \"$1\" in\n    \"on\"|\"a\")\n        echo \"a\" > $FIFO\n        echo \"\ud83d\udca1 GPIO17 ALLUM\u00c9 (libgpiod)\"\n        ;;\n    \"off\"|\"e\") \n        echo \"e\" > $FIFO\n        echo \"\u26ab GPIO17 \u00c9TEINT (libgpiod)\"\n        ;;\n    \"blink\"|\"c\")\n        echo \"c\" > $FIFO\n        echo \"\ud83d\udd01 GPIO17 CLIGNOTANT\"\n        ;;\n    \"status\"|\"s\")\n        echo \"s\" > $FIFO\n        sleep 0.5\n        sudo journalctl -u $SERVICE -n 5 --no-pager | grep -E \"(GPIO17 \u00c9TAT:|ALLUM\u00c9|\u00c9TEINT)\"\n        ;;\n    \"restart\")\n        sudo systemctl restart $SERVICE\n        echo \"\ud83d\udd04 Service red\u00e9marr\u00e9\"\n        ;;\n    \"stop\")\n        echo \"q\" > $FIFO 2>\/dev\/null || true\n        sleep 1\n        sudo systemctl stop $SERVICE\n        echo \"\ud83d\uded1 Service arr\u00eat\u00e9\"\n        ;;\n    \"start\")\n        sudo systemctl start $SERVICE\n        echo \"\ud83d\ude80 Service d\u00e9marr\u00e9\"\n        ;;\n    \"logs\")\n        sudo journalctl -u $SERVICE -n 15 --no-pager\n        ;;\n    \"debug\")\n        sudo journalctl -u $SERVICE -p debug --no-pager\n        ;;\n    \"follow\")\n        sudo journalctl -u $SERVICE -f\n        ;;\n    \"service-status\")\n        sudo systemctl status $SERVICE --no-pager\n        ;;\n    \"help\"|\"--help\"|\"-h\")\n        show_help\n        ;;\n    *)\n        echo \"\u274c Commande invalide: $1\"\n        show_help\n        exit 1\n        ;;\nesac<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Pr\u00e9requis: systemd , service ,daemon Utilisation des GPIO (libgpiod) version inf\u00e9rieure 2 (bookworm) But: Piloter Gpio17 (c&rsquo;est mon choix) , projet \u00e0 but p\u00e9dagogique pour les projets ! Programmation syst\u00e8me [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","_uag_custom_page_level_css":"","footnotes":""},"class_list":["post-4780","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Service pour RPI &quot;GPIO17&quot; - workboot<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/workboot.fr\/ciela\/service-pour-rpi-sous-linux\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Service pour RPI &quot;GPIO17&quot; - workboot\" \/>\n<meta property=\"og:description\" content=\"Pr\u00e9requis: systemd , service ,daemon Utilisation des GPIO (libgpiod) version inf\u00e9rieure 2 (bookworm) But: Piloter Gpio17 (c&rsquo;est mon choix) , projet \u00e0 but p\u00e9dagogique pour les projets ! Programmation syst\u00e8me [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/workboot.fr\/ciela\/service-pour-rpi-sous-linux\/\" \/>\n<meta property=\"og:site_name\" content=\"workboot\" \/>\n<meta property=\"article:modified_time\" content=\"2025-11-07T11:10:58+00:00\" \/>\n<meta name=\"twitter:label1\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/service-pour-rpi-sous-linux\\\/\",\"url\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/service-pour-rpi-sous-linux\\\/\",\"name\":\"Service pour RPI \\\"GPIO17\\\" - workboot\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/#website\"},\"datePublished\":\"2025-11-01T07:43:54+00:00\",\"dateModified\":\"2025-11-07T11:10:58+00:00\",\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/workboot.fr\\\/ciela\\\/service-pour-rpi-sous-linux\\\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/#website\",\"url\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/\",\"name\":\"workboot\",\"description\":\"Open Source, Open Minds \",\"publisher\":{\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-FR\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/#organization\",\"name\":\"workboot\",\"url\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/wp-content\\\/uploads\\\/2025\\\/05\\\/logo_ciel-dorian-1.png\",\"contentUrl\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/wp-content\\\/uploads\\\/2025\\\/05\\\/logo_ciel-dorian-1.png\",\"width\":1024,\"height\":950,\"caption\":\"workboot\"},\"image\":{\"@id\":\"https:\\\/\\\/workboot.fr\\\/ciela\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Service pour RPI \"GPIO17\" - workboot","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/workboot.fr\/ciela\/service-pour-rpi-sous-linux\/","og_locale":"fr_FR","og_type":"article","og_title":"Service pour RPI \"GPIO17\" - workboot","og_description":"Pr\u00e9requis: systemd , service ,daemon Utilisation des GPIO (libgpiod) version inf\u00e9rieure 2 (bookworm) But: Piloter Gpio17 (c&rsquo;est mon choix) , projet \u00e0 but p\u00e9dagogique pour les projets ! Programmation syst\u00e8me [&hellip;]","og_url":"https:\/\/workboot.fr\/ciela\/service-pour-rpi-sous-linux\/","og_site_name":"workboot","article_modified_time":"2025-11-07T11:10:58+00:00","twitter_misc":{"Dur\u00e9e de lecture estim\u00e9e":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/workboot.fr\/ciela\/service-pour-rpi-sous-linux\/","url":"https:\/\/workboot.fr\/ciela\/service-pour-rpi-sous-linux\/","name":"Service pour RPI \"GPIO17\" - workboot","isPartOf":{"@id":"https:\/\/workboot.fr\/ciela\/#website"},"datePublished":"2025-11-01T07:43:54+00:00","dateModified":"2025-11-07T11:10:58+00:00","inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/workboot.fr\/ciela\/service-pour-rpi-sous-linux\/"]}]},{"@type":"WebSite","@id":"https:\/\/workboot.fr\/ciela\/#website","url":"https:\/\/workboot.fr\/ciela\/","name":"workboot","description":"Open Source, Open Minds ","publisher":{"@id":"https:\/\/workboot.fr\/ciela\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/workboot.fr\/ciela\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-FR"},{"@type":"Organization","@id":"https:\/\/workboot.fr\/ciela\/#organization","name":"workboot","url":"https:\/\/workboot.fr\/ciela\/","logo":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/workboot.fr\/ciela\/#\/schema\/logo\/image\/","url":"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/05\/logo_ciel-dorian-1.png","contentUrl":"https:\/\/workboot.fr\/ciela\/wp-content\/uploads\/2025\/05\/logo_ciel-dorian-1.png","width":1024,"height":950,"caption":"workboot"},"image":{"@id":"https:\/\/workboot.fr\/ciela\/#\/schema\/logo\/image\/"}}]}},"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"admin","author_link":"https:\/\/workboot.fr\/ciela\/author\/admin\/"},"uagb_comment_info":0,"uagb_excerpt":"Pr\u00e9requis: systemd , service ,daemon Utilisation des GPIO (libgpiod) version inf\u00e9rieure 2 (bookworm) But: Piloter Gpio17 (c&rsquo;est mon choix) , projet \u00e0 but p\u00e9dagogique pour les projets ! Programmation syst\u00e8me [&hellip;]","_links":{"self":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages\/4780","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/comments?post=4780"}],"version-history":[{"count":32,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages\/4780\/revisions"}],"predecessor-version":[{"id":4980,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages\/4780\/revisions\/4980"}],"wp:attachment":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/media?parent=4780"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}