Outils pour utilisateurs

Outils du site


issue62:labo_linux

Hotfix Release available. [36.2] (what's this?) Hotfix Release available. [36.1] (what's this?) linuxlab Full Circle Magazine FR

Piste: • start • recapitulatif • linuxlab

Hackerspaces are awesome! In our city, we’re lucky enough to have a great hackerspace, Kwartzlab. I’ve visited Kwartzlab a few times to check out some of the cool equipment and projects members were working on: 3D printers, motherboard artwork, a large laser cutter, even an icosahedron flight simulator. One of the simpler items around the space that caught my eye was a small picture frame that displayed a twitter feed of tweets that include the @kwartzlab tag. I thought it would be interesting to have the same kind of device in our computer recycling shop - displaying tweets including our organization’s @ tag and tweets by other computer refurbishers. I considered doing this project with an Arduino and LCD, but it seemed more fitting to use one of the older notebooks donated to our project. After sorting through a bunch of notebooks missing parts I managed to build a functional IBM Thinkpad R31. The R31 is a vastly underpowered notebook by today’s standards, but Thinkpads were generally well-built notebooks. Our R31 had a Celeron 1066MHz CPU and 128MB of RAM - which we bumped to 512MB. A notebook with built-in wireless would have meant one less cable, but I chose the R31 because it was one of the few notebooks in salvageable condition.

Les hackerspaces [Ndt : espaces de créativité souvent axés sur l'informatique] sont impressionnants ! Dans notre ville, nous avons la chance d'avoir un hackerspace célèbre, Kwartzlab. Je suis allé quelques fois à Kwartzlab pour voir certains des équipements et des projets passionnants sur lesquels les membres travaillaient : des imprimantes 3D, des dessins réalisés au moyen de leurs cartes mères, un grand cutter laser, même un simulateur de vol icosaèdre. Une des choses parmi les plus simples qui a attiré mon attention dans cet espace était un petit cadre qui affiche un flux twitter qui montre les tweets ayant l'étiquette @kwartzlab.

J'ai pensé qu'il serait intéressant d'avoir le même genre de dispositif dans notre boutique de recyclage d'ordinateurs, affichant les tweets ayant l'étiquette de notre organisation et d'autres collègues remettant à neuf des ordinateurs. J'ai envisagé de faire ce projet avec un Arduino et un écran LCD, mais il me semblait plus approprié d'utiliser un des plus vieux portables qui a été donné à notre projet. Après avoir trié un tas de portables ayant des pièces manquantes, j'ai réussi à construire un IBM Thinkpad R31 fonctionnel. Le R31 est un ordinateur portable de puissance extrêmement faible selon les normes actuelles, mais les Thinkpads étaient des ordinateurs portables généralement bien construits. Notre R31 avait un Celeron 1066 MHz et 128 Mo de RAM, que nous avons boostés à 512. Un portable avec une carte wifi aurait signifié un câble de moins, mais j'ai choisi le R31, car c'était l'un des quelques portables récupérables.

Because we wanted the notebook to do one task, serve our twitter updates, choosing a lean OS was important. Lubuntu seemed a practical choice, it’s current, lightweight, and uses a modern browser, Chromium, as its default. It was also a snap to install since our project uses a PXE boot server to deploy Ubuntu, Lubuntu, and Xubuntu images. All of our Linux images are set to autologin, so I didn’t need to modify lxdm, but, for the sake of completeness, you can set an account to autologin in Lubuntu by finding the following line in /etc/lxdm/lxdm.conf and uncommenting it, then inserting the appropriate username: #autologin=username By default, most Linux distributions are set up to display a screen saver after a short period. This is a good practice for security, but not so great for our Twit Screen project. To disable the screensaver, click the Lubuntu button > Preferences > Screensaver, then select Disable Screen Saver from the Mode dropdown option.

Parce que nous voulions un portable pour faire une seule tâche - afficher nos mises à jour Twitter, c'était important de choisir un système d'exploitation léger. Lubuntu a semblé être un choix pratique, il est actuel, léger et utilise par défaut un navigateur moderne, Chromium.

Cela a également été un jeu d'enfant à installer puisque notre projet utilise un serveur d'initialisation PXE pour déployer les images Ubuntu, Lubuntu, et Xubuntu. L'autologin est réglé sur toutes nos images Linux, donc je n'ai pas eu besoin de modifier lxdm, mais, par souci d'exhaustivité, vous pouvez configurer un compte de connexion automatique dans Lubuntu en trouvant la ligne suivante dans /etc/lxdm/lxdm.conf et en enlevant le signe de commentaire, puis en insérant le nom d'utilisateur approprié :

#autologin=username

Par défaut, la plupart des distributions Linux sont configurées pour afficher un économiseur d'écran après une courte période. Il s'agit d'une bonne pratique en matière de sécurité, mais pas terrible pour notre projet d'écran twitter. Pour désactiver l'écran de veille, cliquez sur le bouton de Lubuntu > Preferences > Screensaver, puis choisir Disable Screen Saver dans l'option déroulante Mode.

I thought that Midori might be a tad lighter on memory than Chromium, but discovered when I ran cat /proc/meminfo | grep MemFree that Chromium was slightly lighter. The load process for Chromium also felt slightly faster, and, since Twit Screen should act like an appliance and the CPU is already slow, any extra speed was beneficial. The next step was figuring out how to display live Twitter feeds in a cool manner. For that I found Cameron Adams’ visibletweets.com. Visibletweets has a couple of nice features I like, a choice of 3 types of animated tweets, and, more importantly, you can use Twitter search operators. Visibletweets also doesn’t require a login. Since I already knew I wanted to search for multiple tags and twitter accounts, the OR operator came in handy. As a test I entered: @WorkingCentre OR @chaslinux OR @kwartzlab OR “Computer Recycling”

Je pensais que Midori serait éventuellement un peu plus léger en mémoire que Chromium, mais, quand j'ai lancé cat /proc/meminfo | grep MemFree, j'ai découvert que Chromium était un peu plus léger. Le processus de chargement pour Chromium me semblait un peu plus rapide aussi et, puisque l'écran Twitter devait agir comme un appareil et que le CPU est déjà lent, toute vitesse supplémentaire était bénéfique.

L'étape suivante a été de trouver comment afficher en direct le flux Twitter d'une manière sympa. Pour cela, j'ai trouvé visibletweets.com de Cameron Adams. Visibletweets a quelques fonctionnalités intéressantes que j'apprécie, un choix de 3 types de tweets animés et, plus important encore, vous pouvez utiliser des opérateurs de recherche Twitter. De plus, Visibletweets ne nécessite pas de login. Puisque je savais déjà que je voulais rechercher de multiples balises et comptes twitter, l'opérateur OR a été bien pratique. Comme test, j'ai entré : @WorkingCentre OR @chaslinux OR @kwartzlab OR “Computer Recycling”

Tweets started to appear beginning with Computer Recycling tweets. At the moment I typed in the search, one company’s tweets kept coming up with the same message in a really spam-like fashion. I learned that the minus operator (NOT seemed more appropriate but didn’t work) can be used to limit results and you shouldn’t include the @ sign when eliminating particular results from a twitter user, just -username. My revised test: @WorkingCentre OR @chaslinux OR @kwartzlab OR “Computer Recycling” -60IT This kept @60IT results from showing in the tweets. I also noticed that if I left off the quotation marks around “Computer Recycling”, visibletweets seemed to display only computer recycling tweets. Normally, it displays the most recent tweet. So, if you’re testing against multiple words, put them in quotation marks.

Les tweets ont commencé à apparaître, les tweets de Computer Recycling d'abord. Du moment où j'ai effectué la recherche, les tweets d'une société ne cessaient de revenir avec le même message, à la manière d'un véritable spam. J'ai appris que le signe moins (NOT semblait plus approprié, mais ne fonctionnait pas) peut être utilisé pour limiter les résultats et que vous ne devriez pas inclure le signe @ lors de l'élimination de résultats spécifiques d'un utilisateur de Twitter, juste -username. Mon test corrigé :

@WorkingCentre OR @chaslinux OR @kwartzlab OR “Computer Recycling” -60IT

Ceci empêchait les résultats de @60IT de venir dans les tweets. J'ai aussi remarqué que si je ne mettais pas Computer Recycling entre guillemets, visibletweets semblait afficher uniquement les tweets de Computer Recycling. Normalement, il affiche le tweet le plus récent. Donc, si vous testez plusieurs mots, mettez les entre guillemets.

Next, I took note of the URL that resulted when I typed in the query - it wasn’t pretty: http://visibletweets.com/#query=%40WorkingCentre%20OR%20%40chaslinux%20OR%20%40kwartzlab%20OR%20%22Computer%20Recycling%22%20-60IT&animation=2 The idea is that just after autologin, I’d start chromium in full-screen mode with the search URL. LXDE does have some applications that can be enabled just after logging in by clicking the LXDE button > Preferences > Desktop Session Settings, but, out of the box, it doesn’t seem to have a graphical way of adding applications to startup the way Gnome does. To start an application, its *.desktop file needs to be copied to ~/.config/autostart. When I changed into the ~/.config folder, I noticed there was no autostart folder, so I made one. At first I thought there was no chromium.desktop file until I remembered the full filename is chromium browser, so I needed to run locate chromium-browser.desktop. I then copied the file to the ~/.config/autostart directory: cp /usr/share/applications/chromium-browser.desktop ~/.config/autostart

Ensuite, j'ai noté l'URL qui s'est affichée lorsque j'ai entré la recherche, ce n'était pas très beau : http://visibletweets.com/#query=%40WorkingCentre%20OR%20%40chaslinux%20OR%20%40kwartzlab%20OR%20%22Computer%20Recycling%22%20-60IT&animation=2

L'idée est que, juste après la connexion automatique, je lançerais Chromium en mode plein écran avec l'URL de recherche. LXDE a quelques applications qui peuvent être activées juste après la connexion en cliquant sur le bouton LXDE > Preferences > Desktop Session Settings, mais, fraîchement installé, il ne semble pas disposer d'un moyen graphique pour ajouter des applications au démarrage comme le ferait Gnome. Pour lancer une application, son fichier *.desktop doit être copié dans ~/.config/autostart. Quand je suis allé dans dans le dossier ~/.config, j'ai remarqué qu'il n'y avait pas de dossier autostart, donc j'en ai créé un.

Au départ, je pensais qu'il n'y avait pas de fichier chromium.desktop jusqu'à ce que je me souvienne que le nom complet est chromium browser, donc je devais lancer locate chromium-browser.desktop. J'ai ensuite copié le fichier dans le répertoire ~/.config/autostart :

cp /usr/share/applications/chromium-browser.desktop ~/.config/autostart

But, I also wanted it to start with that nasty URL, so I changed into the ~/.config/autostart folder and changed the line that read: Exec=/usr/bin/chromium-browser %U I replaced the %U with the long URL from visibletweets. When I logged out and logged back in, visibletweets now started with the operators I wanted. Nice, but I could still see LXDE’s interface. As an appliance, I wanted this to disappear. The solution, run chromium-browser in full-screen mode. Full-screen mode is known in chromium parlance as kiosk mode, and starting in kiosk mode was as simple as appending –kiosk to the end of our arguments in the ~/.config/autostart/chromium-browser.desktop file: Exec=/usr/bin/chromium-browser <url> –kiosk Note that I’ve put <url> in place of where that nasty URL goes.

Mais, je voulais aussi qu'il démarre avec cette horrible URL et je suis donc allé dans le répertoire ~/.config/autostart et ai changé la ligne qui suit :

Exec=/usr/bin/chromium-browser %U

J'ai remplacé le U% avec la longue URL de visibletweets. Quand je me suis déconnecté et reconnecté, visibletweets a démarré avec les opérateurs que je voulais.

Pas mal, mais je pouvais encore voir l'interface de LXDE. Pour faire comme un appareil, je voulais que cela disparaisse. La solution était d'exécuter chromium-browser en mode plein écran. Le mode plein écran est connu dans le langage de Chromium comme étant le mode kiosque et le démarrage en mode kiosque a été aussi simple que d'ajouter –kiosk à la fin de nos arguments dans le fichier ~/.config/autostart/chromium-browser.desktop :

Exec=/usr/bin/chromium-browser <url> –kiosk

Notez que j'ai écrit <url> à l'endroit où va cette horrible URL.

With chromium loading the website in full-screen on autologin, the last step on the software side of things was to install SSH: sudo apt-get install ssh Since the keyboard was going to eventually be inaccessible behind the screen, I needed a way to remotely administer the system (to apply updates, and perhaps setting the system up for other functions at a later date), and SSH is my favoured method. Several years ago I built a similar system to display photographs. It was a success initially, but I learned the hard way that you have to be very careful about Electro Static Discharge (ESD). My photobox worked well, but the back end stuck out of the photo-frame. When I went to remove more components from the notebook I forgot to properly ground myself … and you probably know the rest of the story. Next month: Tweet Screen - Part 2 - Hacking the hardware

Avec Chromium chargeant le site web en plein écran sur autologin, la dernière étape côté logiciel était d'installer SSH :

sudo apt-get install ssh

Puisque le clavier allait finalement être inaccessible derrière l'écran, il me fallait un moyen pour administrer à distance le système (pour appliquer des mises à jour et peut-être configurer le système pour d'autres fonctions plus tard) et SSH est ma méthode préférée.

Il y a plusieurs années, j'ai construit un système similaire pour afficher des photos. Ce fut un succès au début, mais j'ai appris à mes dépens que vous devez être très prudent à propos des décharges électrostatiques. Ma boîte à photos a bien fonctionné, mais une partie à l'arrière est restée coincée hors du cadre photo. Quand je suis allé retirer plus de composants de l'ordinateur portable, j'ai oublié de bien me connecter à la terre… et vous devinez probablement le reste de l'histoire.

Le mois prochain : L'écran de Tweet - Partie 2 - Le « bidouillage » du matériel. Connecté en tant que : Bab (andre_domenech) issue62/linuxlab.txt · Dernière modification: 2012/08/30 18:17 par auntiee

Sauf mention contraire, le contenu de ce wiki est placé sous la licence suivante : CC Attribution-Share Alike 3.0 Unported Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki

issue62/labo_linux.txt · Dernière modification : 2012/09/11 10:41 de andre_domenech