Linux: setting permissions for USB serial ports using udev rules

USBIt’s pretty annoying that, by default, USB serial devices come up with somewhat restricted permissions. Sometimes adding the user to the dialout  group works, sometimes it doesn’t. The most reliable way to fix this for all time is to add a udev rule but I can never remember the syntax, hence this post…

Continue reading “Linux: setting permissions for USB serial ports using udev rules”

Raspberry Pi I2C udev rules

Even when the I2C ports on the Raspberry Pi are enabled as described here, they are only accessible when running in supervisor mode, which is not terribly convenient. To fix that, it’s possible to add a udev rule to change the mode of the devices. The description here is borrowed from my friend at Jumpnow incidentally.

Create a file /etc/udev/rules.d/90-i2c.rules and add the line:


Reboot the Pi and then the I2C ports will be accessible without having to run stuff with sudo.

Using the scp command to copy files between Linux systems

scp is very handy for moving files between Linux systems, especially from desktops to embedded systems and vice versa. However, the syntax is always a challenge. For example, to copy a file from a remote system:

scp <username>@<machine>:<full path to file> .

would copy the specified file to the local directory. So for example:

scp pi@ fred

would copy some file called file into the local directory as a file called fred. The order can be reversed to send the file the other way.

It’s the ‘:’ that causes all the trouble…

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);