dAd’s Notes

dAd’s Raspberry Pi Fixes

A list of fixes (more like configuration settings) for Dad’s Raspberry Pi (ok Pis – plural). I needed a central location for these changes.

Shell tricks

Miscellaneous things to remember about the command line

  • Use history | grep <something> to find a command you have typed previously.  Then you can use the line number reported like this `!###` to re-execute that command
  • To find something, use `find / -name <something> 2>/dev/null`.  Remember that the last part redirects the error messages to the null device so they aren’t displayed.

Scratch

It realy ticks me off that Scratch is (rightfully) promoted as a convenient, introductory programming tool, but support on the Raspberry Pi is not straightforward. I have a simple question – make the fonts bigger. Most of the responses around the “interweb” go from “why would you want to do that [with the implied ‘moron’ unwritten]” to “change the resolution of your monitor”. Clearly, the latter group is of the bicycle-pants clan (you know, a bicycle seat is terribly uncomfortable, therefore, you need to buy special pants). What really bugs me is that the solution is, afterall, fairly straightforward and we just need a few steps.

To make the fonts in Scratch bigger

In a console/terminal window, head on over to /usr/share/scratch/locale. Here you will see a bunch of “.po” files for all sorts of languages, well, except for English. English is apparently the default, so if no “.po” file is applied, it will default to English. Let’s make a new one by doing this

sudo cp Scratch.pot bigfont.po
sudo vi bigfont.po

(If vi is not your editor of choice, replace it with “nano” or “leafpad”.) Now, in the template file you just opened, look for

msgid "Language-Name"
msgstr ""

Don’t change the msgid line, but add a useful line of text in msgstr. I used msgstr "English - Big" so that it will show up near the English option Now look for msgid "Font-Scale", and in the following “msgstr” line put a value such as 1.4 or 2. Now save this file and open Scratch. There is a world icon towards the top of the Scratch window. Click on it with the Mouse and you should now see one of the options is the same as what you put under “Language-Name” in the steps above. Choose that option and voila you now have a larger font. As far as I can tell, this selection is persistent, and you can change it by going back to the world icon and choosing another option. I have a couple English – XXX options, one for large (x1.4) and one for huge (x2) making it easier to see the text from the close chair or far-away couch.

That &*$(#?!@ sound

So, go ahead and connect that Raspberry Pi up to your HDMI TV and start playing some audio. Chances are, you will get a little bit of delay before it starts up. No big deal if you are playing a movie, but let’s say you are playing the 1-second long wav files in uhh, Scratch. Too bad for you. Good luck finding an answer. (Chances are, you’ll only find the bicycle pants folks who will tell you to create a longer wav file.) The problem as described here, and possibly coming from this source apparently has to do with how two systems set up a digital audio link. The process takes a few hundred milliseconds, and if you are playing a small wave file, the file may be over before the communication protocols are set up. The solution (or rather, workaround) is to keep the audio communication open by always playing something in the background. Don’t want to hear anything? Well, in the wonderful world of computers you can play “nothing” which will actually work. Run the following in a terminal:

aplay -c2 -r48000 -fS16_LE &

I don’t notice any obvious Raspberry Pi slowdown and now when I play short sounds in Scratch (for example, the meow), I hear the entire sound. I should probably have this started upon bootup, and once I find a good way to do so, I’ll update this section.