<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Biosystems Engineering Blog (Posts about raspberry_pi)</title><link>https://kwk.systems/blog/</link><description></description><atom:link href="https://kwk.systems/blog/categories/raspberry_pi.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><copyright>Contents © 2024 &lt;a href="mailto:info@kwk.systems"&gt;Kurt Kremitzki&lt;/a&gt; 
&lt;a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/"&gt;
&lt;img alt="Creative Commons License BY-SA"
style="border-width:0; margin-bottom:12px;"
src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png"&gt;&lt;/a&gt;</copyright><lastBuildDate>Thu, 16 May 2024 22:41:32 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Linux Console Caps/Escape Swap</title><link>https://kwk.systems/blog/posts/linux-console-capsescape-swap/</link><dc:creator>Kurt Kremitzki</dc:creator><description>&lt;p&gt;Full-fledged Linux desktop environments like GNOME or Ubuntu's Unity often have built-in keyboard mapping tools to meet user needs.
At a lower level, &lt;code class="docutils literal"&gt;xmodmap&lt;/code&gt; can be used to directly modify the X11 server's keyboard mapping.
However, when working directly in the Linux console, things are a little more complicated without a display server.&lt;/p&gt;
&lt;p&gt;My particular need is to swap the &lt;code class="docutils literal"&gt;Caps Lock&lt;/code&gt; and &lt;code class="docutils literal"&gt;Escape&lt;/code&gt; keys; as a &lt;code class="docutils literal"&gt;vim&lt;/code&gt; user, I use &lt;code class="docutils literal"&gt;Escape&lt;/code&gt; constantly to return to Normal mode.
To be more efficient and avoid the possibility of repetitive strain injury from long-term pinky stretching to reach &lt;code class="docutils literal"&gt;Escape&lt;/code&gt;, the following line
can be added to the file &lt;code class="docutils literal"&gt;/etc/rc.local&lt;/code&gt;, before the final line &lt;code class="docutils literal"&gt;exit 0&lt;/code&gt;.&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code bash"&gt;&lt;a id="rest_code_b4b55f64b8124f2498fbadc5b7d4d46c-1" name="rest_code_b4b55f64b8124f2498fbadc5b7d4d46c-1" href="https://kwk.systems/blog/posts/linux-console-capsescape-swap/#rest_code_b4b55f64b8124f2498fbadc5b7d4d46c-1"&gt;&lt;/a&gt;/usr/bin/dumpkeys&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;/bin/sed&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'s/CtrlL_Lock/Escape/'&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;/usr/bin/loadkeys
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If you aren't familiar with Bash, a little explanation might be in order. First, note that this single-line command is actually three
commands separated by the pipe character &lt;code class="docutils literal"&gt;|&lt;/code&gt;.
A detailed explanation can be found in the &lt;a class="reference external" href="http://www.tldp.org/LDP/abs/html/io-redirection.html"&gt;Advanced Bash Scripting Guide's chapter on I/O Redirection&lt;/a&gt;, but in short,
piping &lt;code class="docutils literal"&gt;cmd1 | cmd2&lt;/code&gt; sends the output of &lt;code class="docutils literal"&gt;cmd&lt;/code&gt; as input for &lt;code class="docutils literal"&gt;cmd2&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The programs &lt;code class="docutils literal"&gt;/usr/bin/dumpkeys&lt;/code&gt; and &lt;code class="docutils literal"&gt;/usr/bin/loadkeys&lt;/code&gt; are fairly self-explanatory: they output keymaps for the console
at the kernel level, and update that keymap if a valid file is input, respectively.
The middle command, &lt;code class="docutils literal"&gt;sed&lt;/code&gt;, is a powerful, general-purpose stream editor, and the source of much Linux wizardry. To understand what it's doing,
take a look at its argument: the string &lt;code class="docutils literal"&gt;'/s/CtrlL_Lock/Escape/'&lt;/code&gt;. This tells &lt;code class="docutils literal"&gt;sed&lt;/code&gt; to &lt;em&gt;s&lt;/em&gt; ubstitute the first instance of &lt;code class="docutils literal"&gt;CtrlL_Lock&lt;/code&gt;
with &lt;code class="docutils literal"&gt;Escape&lt;/code&gt; on any matching line from its input (adding &lt;code class="docutils literal"&gt;g&lt;/code&gt; after the last slash makes it a truly global substitution and not linewise.)
The &lt;code class="docutils literal"&gt;sed&lt;/code&gt; command then passes along the modified stream to &lt;code class="docutils literal"&gt;loadkeys&lt;/code&gt;. Because this line is added to &lt;code class="docutils literal"&gt;/etc/rc.local&lt;/code&gt;, it will be executed
every boot, swapping &lt;code class="docutils literal"&gt;Caps Lock&lt;/code&gt; and &lt;code class="docutils literal"&gt;Escape&lt;/code&gt; in the Linux console.&lt;/p&gt;</description><category>linux</category><category>raspberry_pi</category><guid>https://kwk.systems/blog/posts/linux-console-capsescape-swap/</guid><pubDate>Wed, 18 May 2016 03:40:12 GMT</pubDate></item><item><title>Connecting a Raspberry Pi to Texas A&amp;M Wifi via Command Line</title><link>https://kwk.systems/blog/posts/connecting-a-raspberry-pi-to-texas-am-wifi/</link><dc:creator>Kurt Kremitzki</dc:creator><description>&lt;div&gt;&lt;p&gt;The recommended flavor of Linux on the Raspberry Pi, Raspbian, uses the LXDE desktop environment, and using its GUI tools to set up wifi is not immediately successful.
Command-line setup involves editing two files, &lt;code class="docutils literal"&gt;/etc/network/interfaces&lt;/code&gt; and &lt;code class="docutils literal"&gt;/etc/wpa_supplicant/wpa_supplicant.conf&lt;/code&gt;. Since these are system files, they won't be writable by a normal user. The command &lt;code class="docutils literal"&gt;sudo &lt;span class="pre"&gt;-e&lt;/span&gt; &amp;lt;filename&amp;gt;&lt;/code&gt; can be used to edit system files with superuser privileges, using the default editor. Normally, this is the program &lt;code class="docutils literal"&gt;nano&lt;/code&gt;, which is fairly self-explanatory; make your changes using the keyboard and save the file with &lt;code class="docutils literal"&gt;&lt;span class="pre"&gt;Ctrl-X&lt;/span&gt;&lt;/code&gt;. For advanced users, this can be changed via something like &lt;code class="docutils literal"&gt;export EDITOR=vi&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The first file, &lt;code class="docutils literal"&gt;/etc/network/interfaces&lt;/code&gt;, needs to have the following:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://kwk.systems/blog/posts/connecting-a-raspberry-pi-to-texas-am-wifi/"&gt;Read more…&lt;/a&gt; (1 min remaining to read)&lt;/p&gt;&lt;/div&gt;</description><category>linux</category><category>raspberry_pi</category><guid>https://kwk.systems/blog/posts/connecting-a-raspberry-pi-to-texas-am-wifi/</guid><pubDate>Thu, 21 Apr 2016 23:46:17 GMT</pubDate></item></channel></rss>