I recently purchased an Atomic Pi on Amazon, for just $27.95. I think the original price of the Atomic Pi was $34 ($1 less then a Raspberry Pi), and they sold for as much as $45. I remember first hearing about the Atomic Pi around May 2019, so the APi has gone from its intro price to its highest price to its lowest price ever, in about 7 months. I resisted buying an APi when it came out, because I really didn't need one. However, at $27.95 its too good of a deal to turn down, despite all the great SBCs that have come out in the last 1/2 year.
The Atomic Pi comes with lots of
ports you can hook up stuff to; e.g., USB 2.0 port (a full USB 3.0 port with connector
is already mounted on the APi), (2) ports (ipex connectors) for wi-fi antennas, a port
(ipex connector) for bluetooth, speaker connectors (the APi ships with built in Mayfield
amplifiers). I've already hooked up antennas for wi-fi and bluetooth (I'm getting a good
wi-fi signal), so I decided to use bluetooth speakers instead of hooking up speakers
to the built-in amplifier. I brought up the Bluetooth Manager, and searched for nearby
bluetooth devices; my DOSS Traveler (bluetooth speakers) and Bobcat (a MS Surface Pro)
both showed up. I set the DOSS Traveler to a trusted device, and paired it to my APi.
However when I tried to connect I got the error message,
Connection Failed: blueman.bluez.errors.DBusFailedError: Protocol Not available
.
I googled the error, and found that it was because of a pulseaudio problem.
I checked out pulseaudio with the following command:
pulseaudio --check
No result, which means pulseaudio wasn't running. I tried starting up pulseaudio:
pulseaudio --start -v
and I got another error message; [pulseaudio] main.c: Daemon startup failed.
Fortunately, pulseaudio allows you to get detailed information on its startup details
pulseaudio -vvv
The number of errors I got was amazing. Usually when some startup process gets a bunch of
errors, it ends pretty fast, so you still don't see as many errors as you might expect
(like I got). I decided the best thing to do was build pulseaudio from source;
2019-09-13: PulseAudio 13.0 has been released. (download)
There's a webpage that
tells you how to build pulseaudio from source;
https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/Developer/PulseAudioFromGit/
As the link name implies, the webpage tells you how to build from the source available on git;
git clone https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
,
however, the instructions after that git command can still be used if you download the source from
https://freedesktop.org/software/pulseaudio/releases/pulseaudio-13.0.tar.gz,
which is what I did. The actual build instructions are really simple, but you should read everything
on that webpage, anyway;
After getting the source, go to the pulseaudio directory and run these commands:
sudo apt-get build-dep pulseaudio
./bootstrap.sh
make
sudo make install
sudo ldconfig
As you can see in the picture at the bottom of this webpage,
that worked, but not untill I did the following:
In /etc/pulse the only file that was there after the build was client.conf, but there
are three other files that are supposed to be there; goto the build directory and:
sudo cp src/daemon.conf /etc/pulse
sudo cp src/default.pa /etc/pulse
sudo cp src/system.pa /etc/pulse
edit default.pa and look for the line that says #Load audio drivers statically, and uncomment
the next 6 lines of code that start with load-module. Don't comment out the two lines of
code that use udev (like the comments in the code seem to imply you should do after loading
statically). ...but, my computer didn't recognize the command load-module, so I did the following:
cd /bin
edit a new file, and name it load-module, with the following contents:
sudo modprobe $1
make the file load-module, executable; e.g., sudo chmod 777 /bin/load-module
NOTE(afterthought): The default behavior of the sudo command is to query the user for a
password; you don't want this happening to your script. I'd already modified my system
for that not to happen to me, but after uploading this blog it occured to me that most
users probably needed to make that same modification to prevent load-module from querying
them.
The file that is input to the sudo command is called sudoers; it tells the sudo command
if you have permission to use the sudo command, and how it should behave - the default is
to query you for your password. You can change that behavior by:
sudo visudo
i
scroll to the bottom of the page
username ALL=(ALL) NOPASSWD:ALL
<esc>:w
:x
You need to replace username with your actual username (on my Atomic Pi that's atomicpi).
The visudo command edits the sudoers file using the vi editor. The vi editor comes up in
read-only mode, so you enter i
to enter insert mode (make it editable),
<esc>
to go back to read-only mode (so you can run commands without
editing the file), :w
tells the editor to write the file, :x
exits the editor. Now, the next time you enter the sudo command (e.g., by using the
load-command script/command) you won't be asked for a password.
(end of afterthought).
I read on the Internet that it's a good idea to have a copy of client.conf in your home directory,
so I also entered
cp ~/installation directory/src/client.conf ~/.config/pulse
and to make sure weren't any corrupted files left over in ~/.config/pulse I entered the following:
rm ~/.config/pulse/*.tdb
rm ~/.config/pulse/cookie
Almost there, because when I entered pulseaudio --start -v
, I still got a daemon failed to load error message.
I went ahead and ran pulseaudio -vvv
and it said that pulseaudio loaded, but right after
that it said it was unable to access database information for HDMI audio, and it went downhill from there.
Taking the easy road out, I blacklisted HDMI audio, by doing the following:
cd /etc/modprobe.d
edited the file blacklist-hdmi-lpe-audio.conf
entered the following code: blacklist snd_hdmi_lpe_audio
saved and exited the file, and then rebooted. ...and, as you can see in the picture below, I was
able to startup pulseaudio and then bluetooth, pair my bluetooth speaker and connect to it.
Almost forgot to mention this; you don't want the system trying to load pulseaudio at boot time. In client.conf you need to uncomment the autospawn line, and change yes to no. I'm not running the original copy of Lubuntu that my Atomic Pi shipped with, but the full copy of Ubuntu 18.04.1 LTS from the Digital Loggers website. That means I still boot off of a flash drive, but once booted I'm running off the copy of code I copied to the 16GByte emmc board on the APi. I edited the client.conf file on the emmc board (just plain old /etc/pulse/client.conf) and the client.conf file on the flash drive I boot off of.