{"id":2391,"date":"2017-04-15T13:59:31","date_gmt":"2017-04-15T11:59:31","guid":{"rendered":"https:\/\/www.fanjoe.be\/?p=2391"},"modified":"2017-04-15T13:59:31","modified_gmt":"2017-04-15T11:59:31","slug":"probleme-avec-wiringpi-lors-de-la-mise-a-jour-du-kernel-en-version-4-9-x","status":"publish","type":"post","link":"https:\/\/www.fanjoe.be\/?p=2391","title":{"rendered":"Probl\u00e8me avec WiringPi lors de la mise-\u00e0-jour du kernel en version 4.9.x"},"content":{"rendered":"<h1>Introduction<\/h1>\n<p>Lors de la mise \u00e0 jour de mon Raspberry Pi avec la commande <code>rpi-update<\/code>, toutes les interactions avec le <em>GPIO<\/em> utilisant <code>WiringPi<\/code> on cess\u00e9 de fonctionner.<\/p>\n<p>Clairement, il ne m&rsquo;\u00e9tait plus possible de contr\u00f4ler ma <a href=\"https:\/\/www.fanjoe.be\/?p=310\" target=\"_blank\">chaudi\u00e8re<\/a> ni mes <a href=\"https:\/\/www.fanjoe.be\/?p=2301\" target=\"_blank\">prises \u00e9lectriques<\/a>.<\/p>\n<h1>Sympt\u00f4mes<\/h1>\n<p>Lors de la mise \u00e0 jours, je suis pass\u00e9 du kernel 4.4.50 au 4.9.22 .<\/p>\n<p>\u00c0 partir de l\u00e0, toutes les commandes utilisant WiringPi retournaient une erreur comme ceci :<\/p>\n<pre>$ \/usr\/local\/bin\/gpio -g write 17 0\r\nUnable to determine hardware version. I see: Hardware\u00a0\u00a0 \u00a0: BCM2835\r\n,\r\n\u00a0- expecting BCM2708 or BCM2709.\r\nIf this is a genuine Raspberry Pi then please report this\r\nto projects@drogon.net. If this is not a Raspberry Pi then you\r\nare on your own as wiringPi is designed to support the\r\nRaspberry Pi ONLY.<\/pre>\n<p>Il y a tout un tas d&rsquo;exemples sur les forums qui remontent les m\u00eames sympt\u00f4mes comme celui-ci : <a href=\"https:\/\/github.com\/firsttris\/mfrc522-rpi\/issues\/1\" target=\"_blank\">https:\/\/github.com\/firsttris\/mfrc522-rpi\/issues\/1<\/a><\/p>\n<p>Ceci peut \u00eatre du \u00e0 2 choses :<\/p>\n<ul>\n<li><code>WiringPi<\/code>, distribu\u00e9 avec <code>apt<\/code>, est rest\u00e9 cal\u00e9 en version 2.32<\/li>\n<li>Vous avez install\u00e9 manuellement WiringPi et ne l&rsquo;avez pas mis-\u00e0-jour<\/li>\n<\/ul>\n<p>Le site de l&rsquo;\u00e9diteur propose actuellement la <a href=\"http:\/\/wiringpi.com\/wiringpi-updated-to-2-36\/\" target=\"_blank\">version 2.36<\/a> qui est sp\u00e9cifiquement compatible avec le kernel \u00e0 partir de sa version 4.8.x .<\/p>\n<h2>V\u00e9rifier la version de WiringPi<\/h2>\n<p>On peut v\u00e9rifier la version de <code>WiringPi<\/code> avec cette commande :<\/p>\n<pre>$ gpio -v<\/pre>\n<pre>gpio version: 2.32\r\nCopyright (c) 2012-2015 Gordon Henderson\r\nThis is free software with ABSOLUTELY NO WARRANTY.\r\nFor details type: gpio -warranty\r\n\r\nRaspberry Pi Details:\r\n Type: Pi 3, Revision: 02, Memory: 1024MB, Maker: Sony \r\n * Device tree is enabled.\r\n * This Raspberry Pi supports user-level GPIO access.\r\n -&gt; See the man-page for more details\r\n -&gt; ie. export WIRINGPI_GPIOMEM=1<\/pre>\n<h2>V\u00e9rifier la version du kernel<\/h2>\n<p>On peut v\u00e9rifier la version du kernel avec la commande : <code>uname -a<\/code><\/p>\n<p>Ce qui devrait nous donner quelque chose comme ceci :<\/p>\n<pre>$ uname -a\r\nLinux raspberrypi 4.9.22-v7+ #987 SMP Fri Apr 14 23:23:05 BST 2017 armv7l GNU\/Linux<\/pre>\n<p>Ici, c&rsquo;est bien la version 4.9.x du kernel qui est incompatible avec <code>WiringPi<\/code> 2.32 .<\/p>\n<h1>R\u00e9solution<\/h1>\n<p>Deux solutions s&rsquo;offrent \u00e0 nous :<\/p>\n<ol>\n<li>Revenir \u00e0 un kernel pr\u00e9c\u00e9dent (4.4.x) compatible avec WiringPi 2.32<\/li>\n<li>Mettre \u00e0 jour WiringPi \u00e0 la main vers la version 2.44 compatible avec le kernel 4.9.x<\/li>\n<\/ol>\n<h2>Solution 1 : Revenir \u00e0 un kernel pr\u00e9c\u00e9dent<\/h2>\n<p>Une premi\u00e8re solution consiste \u00e0 downgrader le kernel dans la derni\u00e8re version avant 4.9.x, c-\u00e0-d la version 4.4.50 .<\/p>\n<p>On se rend sur <a href=\"https:\/\/github.com\/Hexxeh\/rpi-firmware\/commits\/master\" target=\"_blank\">ce site<\/a>, on s\u00e9lectionne la version du kernel d\u00e9sir\u00e9e (ici : 4.4.50) et on clique sur le bouton avec les chiffres au bout de la ligne.<\/p>\n<p><a href=\"https:\/\/www.fanjoe.be\/wp-content\/uploads\/2017\/04\/WiringPi-Kernel4.9-01.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-2395\" src=\"https:\/\/www.fanjoe.be\/wp-content\/uploads\/2017\/04\/WiringPi-Kernel4.9-01-620x177.jpg\" alt=\"\" width=\"620\" height=\"177\" srcset=\"https:\/\/www.fanjoe.be\/wp-content\/uploads\/2017\/04\/WiringPi-Kernel4.9-01-620x177.jpg 620w, https:\/\/www.fanjoe.be\/wp-content\/uploads\/2017\/04\/WiringPi-Kernel4.9-01-175x50.jpg 175w, https:\/\/www.fanjoe.be\/wp-content\/uploads\/2017\/04\/WiringPi-Kernel4.9-01-300x86.jpg 300w, https:\/\/www.fanjoe.be\/wp-content\/uploads\/2017\/04\/WiringPi-Kernel4.9-01.jpg 987w\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" \/><\/a><\/p>\n<p>Sur la page qui s&rsquo;ouvre, on s\u00e9lectionne le num\u00e9ro du commit :<\/p>\n<p><a href=\"https:\/\/www.fanjoe.be\/wp-content\/uploads\/2017\/04\/WiringPi-Kernel4.9-02.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-2396\" src=\"https:\/\/www.fanjoe.be\/wp-content\/uploads\/2017\/04\/WiringPi-Kernel4.9-02-620x270.jpg\" alt=\"\" width=\"620\" height=\"270\" srcset=\"https:\/\/www.fanjoe.be\/wp-content\/uploads\/2017\/04\/WiringPi-Kernel4.9-02-620x270.jpg 620w, https:\/\/www.fanjoe.be\/wp-content\/uploads\/2017\/04\/WiringPi-Kernel4.9-02-175x76.jpg 175w, https:\/\/www.fanjoe.be\/wp-content\/uploads\/2017\/04\/WiringPi-Kernel4.9-02-300x131.jpg 300w, https:\/\/www.fanjoe.be\/wp-content\/uploads\/2017\/04\/WiringPi-Kernel4.9-02.jpg 1007w\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" \/><\/a><\/p>\n<p>Puis, on utilise cette commande en y ajoutant le commit trouv\u00e9 \u00e0 l&rsquo;\u00e9tape pr\u00e9c\u00e9dente :<\/p>\n<pre>$ sudo rpi-update 52241088c1da59a359110d39c1875cda56496764<\/pre>\n<pre> *** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom\r\n *** Performing self-update\r\n *** Relaunching after update\r\n *** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom\r\nThis update bumps to rpi-4.4.y linux tree\r\nBe aware there could be compatibility issues with some drivers\r\nDiscussion here:\r\nhttps:\/\/www.raspberrypi.org\/forums\/viewtopic.php?f=29&t=144087\r\n##############################################################\r\n *** Downloading specific firmware revision (this will take a few minutes)\r\n % Total % Received % Xferd Average Speed Time Time Time Current\r\n Dload Upload Total Spent Left Speed\r\n100 168 0 168 0 0 366 0 --:--:-- --:--:-- --:--:-- 367\r\n100 52.3M 0 52.3M 0 0 2192k 0 --:--:-- 0:00:24 --:--:-- 2346k\r\n *** Updating firmware\r\n *** Updating kernel modules\r\n *** depmod 4.4.50-v7+\r\n *** depmod 4.4.50+\r\n *** Updating VideoCore libraries\r\n *** Using HardFP libraries\r\n *** Updating SDK\r\n *** Running ldconfig\r\n *** Storing current firmware revision\r\n *** Deleting downloaded files\r\n *** Syncing changes to disk\r\n *** If no errors appeared, your firmware was successfully updated to 52241088c1da59a359110d39c1875cda56496764\r\n *** A reboot is needed to activate the new firmware<\/pre>\n<p>Pour approfondir cette man\u0153uvre je vous renvois vers l&rsquo;excellente page de Framboise314 :<br \/>\n<a href=\"http:\/\/www.framboise314.fr\/installer-une-version-anterieure-du-noyau-sur-raspberry-pi\/\" target=\"_blank\">http:\/\/www.framboise314.fr\/installer-une-version-anterieure-du-noyau-sur-raspberry-pi\/<\/a><\/p>\n<p>Une fois que c&rsquo;est termin\u00e9, on red\u00e9marre le RPi et tout devrait rentrer dans l&rsquo;ordre.<\/p>\n<h2>Solution 2 : Mise \u00e0 jour de WiringPi \u00e0 la main<\/h2>\n<h3>Depuis un paquetage standard<\/h3>\n<p>Si vous ne voulez pas attendre la mise \u00e0 jour du d\u00e9p\u00f4t <code>apt<\/code> ou si votre version de <code>WiringPi<\/code> a \u00e9t\u00e9 install\u00e9e \u00e0 la main et pas encore mise-\u00e0-jour, la seule solution est d&rsquo;effectuer les op\u00e9rations ci-dessous.<\/p>\n<p>On va suivre les instructions de <a href=\"http:\/\/wiringpi.com\/download-and-install\/\" target=\"_blank\">cette page<\/a> en anglais que je vais vous r\u00e9sumer ci-dessous :<\/p>\n<p>On commence par v\u00e9rifier la version de <code>WiringPi<\/code> :<\/p>\n<pre>$ gpio -v<\/pre>\n<p><span class=\"notranslate\">Si vous \u00eates sur cette page, c&rsquo;est que vous rencontrez un bug et que <code>WiringPi<\/code> est d\u00e9j\u00e0 install\u00e9.<\/span> <span class=\"notranslate\">La prochaine \u00e9tape consiste \u00e0 d\u00e9terminer si <code>WiringPi<\/code> est install\u00e9 via un paquetage standard ou depuis la source (<code>apt<\/code>).<\/span> <span class=\"notranslate\"> Si vous l&rsquo;avez install\u00e9 \u00e0 partir de la source, vous savez ce que vous faites &#8211; continuer &#8211; mais s&rsquo;il est install\u00e9 en tant que paquet, vous devez d&rsquo;abord supprimer le paquet.<\/span> <span class=\"notranslate\"> Pour ce faire, on va utiliser ces commandes :<\/span><\/p>\n<pre>$ sudo apt-get purge wiringpi\r\n$ hash -r<\/pre>\n<p><span class=\"notranslate\">Si vous n&rsquo;avez pas install\u00e9 GIT, vous pouvez l&rsquo;installer avec :<\/span><\/p>\n<pre>$ sudo apt-get update\r\n$ sudo apt-get upgrade<\/pre>\n<pre>$ sudo apt-get install git-core<\/pre>\n<p><span class=\"notranslate\">Pour obtenir WiringPi en utilisant GIT :<\/span><\/p>\n<pre>$ cd\r\n$ git clone git:\/\/git.drogon.net\/wiringPi<\/pre>\n<p><span class=\"notranslate\">Si vous avez d\u00e9j\u00e0 utilis\u00e9 l&rsquo;op\u00e9ration de clone une premi\u00e8re fois, alors :<br \/>\n<\/span><\/p>\n<pre>$ cd ~\/wiringPi\r\n$ git pull origin<\/pre>\n<p><span class=\"notranslate\">Vous trouverez une version mise \u00e0 jour puis vous pouvez relancer le script de construction ci-dessous.<\/span><\/p>\n<p><span class=\"notranslate\">Pour compiler \/ installer, il existe un nouveau script simplifi\u00e9 :<\/span><\/p>\n<pre>$ cd ~\/wiringPi\r\n$ .\/build<\/pre>\n<p><span class=\"notranslate\">Le nouveau script de compilation compile et installe tout pour vous &#8211; il utilise la commande sudo \u00e0 un point, afin que vous puissiez inspecter le script avant de l&rsquo;ex\u00e9cuter.<\/span><\/p>\n<p>Ce qui donne ceci :<\/p>\n<pre>$ .\/build\r\nwiringPi Build script\r\n=====================\r\n\r\n\r\nWiringPi Library\r\n[UnInstall]\r\n[Compile] wiringPi.c\r\n[Compile] wiringShift.c\r\n[Compile] wiringSerial.c\r\n[Compile] piHiPri.c\r\n[Compile] piThread.c\r\n[Compile] wiringPiSPI.c\r\n[Compile] wiringPiI2C.c\r\n[Compile] softPwm.c\r\n[Compile] softTone.c\r\n[Compile] mcp23008.c\r\n[Compile] mcp23016.c\r\nwiringPi.c:1247:21: warning: \u2018digitalRead8Dummy\u2019 defined but not used [-Wunused-function]\r\n\u00a0static unsigned int digitalRead8Dummy\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (UNU struct wiringPiNodeStruct *node, UNU int UNU pin)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 { return 0 ; }\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ^\r\nwiringPi.c:1248:21: warning: \u2018digitalWrite8Dummy\u2019 defined but not used [-Wunused-function]\r\n\u00a0static\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 void digitalWrite8Dummy\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (UNU struct wiringPiNodeStruct *node, UNU int pin, UNU int value) { return ; }\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ^\r\n[Compile] mcp23017.c\r\n[Compile] mcp23s08.c\r\n[Compile] mcp23s17.c\r\n[Compile] sr595.c\r\n[Compile] pcf8574.c\r\n[Compile] pcf8591.c\r\n[Compile] mcp3002.c\r\n[Compile] mcp3004.c\r\n[Compile] mcp4802.c\r\n[Compile] mcp3422.c\r\n[Compile] max31855.c\r\n[Compile] max5322.c\r\n[Compile] ads1115.c\r\n[Compile] sn3218.c\r\n[Compile] bmp180.c\r\n[Compile] htu21d.c\r\n[Compile] ds18b20.c\r\n[Compile] rht03.c\r\n[Compile] drcSerial.c\r\n[Compile] drcNet.c\r\n[Compile] pseudoPins.c\r\n[Compile] wpiExtensions.c\r\n[Link (Dynamic)]\r\n[Install Headers]\r\n[Install Dynamic Lib]\r\n\r\nWiringPi Devices Library\r\n[UnInstall]\r\n[Compile] ds1302.c\r\n[Compile] maxdetect.c\r\n[Compile] gertboard.c\r\n[Compile] piNes.c\r\n[Compile] piFace.c\r\n[Compile] lcd128x64.c\r\n[Compile] lcd.c\r\n[Compile] scrollPhat.c\r\n[Compile] piGlow.c\r\n[Link (Dynamic)]\r\n[Install Headers]\r\n[Install Dynamic Lib]\r\n\r\nGPIO Utility\r\n[Compile] gpio.c\r\n[Compile] readall.c\r\n[Compile] pins.c\r\n[Link]\r\n[Install]\r\n\r\nAll Done.\r\n\r\nNOTE: To compile programs with wiringPi, you need to add:\r\n\u00a0\u00a0\u00a0 -lwiringPi\r\n\u00a0 to your compile line(s) To use the Gertboard, MaxDetect, etc.\r\n\u00a0 code (the devLib), you need to also add:\r\n\u00a0\u00a0\u00a0 -lwiringPiDev\r\n\u00a0 to your compile line(s).<\/pre>\n<h3>Mise-\u00e0-jour du kernel apr\u00e8s celle de WiringPi<\/h3>\n<p>Si vous aviez d\u00e9cid\u00e9 de downgrader le kernel en 4.4.50 comme expliqu\u00e9 plus haut, vous pouvez maintenant le mettre \u00e0 jour dans sa derni\u00e8re version (4.9.x) sans crainte :<\/p>\n<pre>$ sudo rpi-update<\/pre>\n<pre>\u00a0*** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom\r\n\u00a0*** Performing self-update\r\n\u00a0*** Relaunching after update\r\n\u00a0*** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom\r\n#############################################################\r\nWARNING: This update bumps to rpi-4.9.y linux tree\r\nBe aware there could be compatibility issues with some drivers\r\nDiscussion here:\r\nhttps:\/\/www.raspberrypi.org\/forums\/viewtopic.php?f=29&t=167934\r\n##############################################################\r\nWould you like to proceed? (y\/N)\r\n\u00a0*** Downloading specific firmware revision (this will take a few minutes)\r\n\u00a0 % Total\u00a0\u00a0\u00a0 % Received % Xferd\u00a0 Average Speed\u00a0\u00a0 Time\u00a0\u00a0\u00a0 Time\u00a0\u00a0\u00a0\u00a0 Time\u00a0 Current\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Dload\u00a0 Upload\u00a0\u00a0 Total\u00a0\u00a0 Spent\u00a0\u00a0\u00a0 Left\u00a0 Speed\r\n100\u00a0\u00a0 168\u00a0\u00a0\u00a0 0\u00a0\u00a0 168\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0 376\u00a0\u00a0\u00a0\u00a0\u00a0 0 --:--:-- --:--:-- --:--:--\u00a0\u00a0 376\r\n100 53.8M\u00a0 100 53.8M\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0 0\u00a0 2304k\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0 0:00:23\u00a0 0:00:23 --:--:-- 3754k\r\n\u00a0*** Updating firmware\r\n\u00a0*** Updating kernel modules\r\n\u00a0*** depmod 4.9.22+\r\n\u00a0*** depmod 4.9.22-v7+\r\n\u00a0*** Updating VideoCore libraries\r\n\u00a0*** Using HardFP libraries\r\n\u00a0*** Updating SDK\r\n\u00a0*** Running ldconfig\r\n\u00a0*** Storing current firmware revision\r\n\u00a0*** Deleting downloaded files\r\n\u00a0*** Syncing changes to disk\r\n\u00a0*** If no errors appeared, your firmware was successfully updated to 0fc97389df97e239a6e09cb544f2789a3e1e9eb8\r\n\u00a0*** A reboot is needed to activate the new firmware<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Introduction <\/p>\n<p>Lors de la mise \u00e0 jour de mon Raspberry Pi avec la commande rpi-update, toutes les interactions avec le&#8230;<\/p>\n","protected":false},"author":1,"featured_media":2392,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[179,10,3,173,12],"tags":[138,270,135,123,269],"class_list":["post-2391","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-domotique","category-geek","category-informatique","category-linux","category-raspberrypi","tag-gpio","tag-kernel","tag-mise-a-jour","tag-update","tag-wiringpi","end"],"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/www.fanjoe.be\/wp-content\/uploads\/2017\/04\/WiringPi-Kernel4.9-00.png","_links":{"self":[{"href":"https:\/\/www.fanjoe.be\/index.php?rest_route=\/wp\/v2\/posts\/2391","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.fanjoe.be\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fanjoe.be\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fanjoe.be\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fanjoe.be\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2391"}],"version-history":[{"count":0,"href":"https:\/\/www.fanjoe.be\/index.php?rest_route=\/wp\/v2\/posts\/2391\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.fanjoe.be\/index.php?rest_route=\/wp\/v2\/media\/2392"}],"wp:attachment":[{"href":"https:\/\/www.fanjoe.be\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fanjoe.be\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fanjoe.be\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}