Using Git and GitHub with Embedded Linux Systems

I often need to clone a private Git repo from GitHub onto an embedded Linux system for native compilation. The only problem is that, to clone a private repo from GitHub, there must be a public key registered for each system. To do this for every embedded system is a total pain. However, a Linux machine that has the repo on it already can act as a local server very easily.

On the embedded system, clone the repo using this command:

git clone ssh://user@

For example,

git clone ssh://richard@

would clone the repo veryinterestingrepo from the directory /home/richard on the machine at using user name richard. At some point Git will ask for the password for user richard. Once this is entered, the clone should work as expected. Pulls and pushes will work as normal as they use the remote from which the repo was cloned.

Grabbing a screenshot from an Android device via adb

This blog entry has a very neat way of grabbing screenshots from Android mobile devices. It boils down to a one liner (reproduced here just in case that blog vanishes for some reason and so it’s easy to find):

adb shell screencap -p | sed 's/\r$//' > screen.png

on Linux and

adb shell screencap -p | perl -pe 's/x0Dx0A/x0A/g' > screen.png

on the Mac.

Works perfectly. Thanks!

Finding PCM audio devices in C/C++ on the BeagleBone Black (and other embedded Linux systems)

Finding PCM audio devices using the ALSA interface from software isn’t always completely trivial. On some builds for the BeagleBone Black, PCM audio devices appear as /dev/audio, /dev/audio1 etc. But this doesn’t seem to be generally true. Plus, this doesn’t definitively identify which device is which. A good way to find out is to open the pseudo file /proc/asound/pcm as it lists all the PCM devices in the system. To see what’s currently active, just cat the pseudo file:

UbuntuDev$ cat /proc/asound/pcm
 00-00: ALC889 Analog : ALC889 Analog : playback 1 : capture 1
 00-01: ALC889 Digital : ALC889 Digital : playback 1
 00-02: ALC889 Analog : ALC889 Analog : capture 2
 00-03: HDMI 0 : HDMI 0 : playback 1
 01-00: USB Audio : USB Audio : capture 1
 02-03: HDMI 0 : HDMI 0 : playback 1
 02-07: HDMI 0 : HDMI 0 : playback 1
 02-08: HDMI 0 : HDMI 0 : playback 1
 02-09: HDMI 0 : HDMI 0 : playback 1

The first two numbers are the plughw card and device numbers. So, if you wanted to connect to the USB audio source for example, you could do:

snd_pcm_open (&m_handle, "plughw:1,0", SND_PCM_STREAM_CAPTURE, 0);