This is my Dockerized control for RadioShark v1 (the white version). I'm still tweaking the code but it appears to work. It is unknown if it'll work for RadioShark v2 (the black version).
- The code is based on the older libhid-devel package, which was last supported in Fedora 25. Thus, this container uses the older distro to host the binary.
- I've modified the original source code slightly, to work around a couple warnings generated by the by GCC.
- There's still some tweaking needed to get PulseAudio to recognize the new source. Notes on a work-around are below.
Run the following:
git clone https://github.com/packetgeek/docker-radioshark/
cd docker-radioshark
docker build -t pg/shark .
#!/usr/bin/perl
$freq=$ARGV[0];
system("sudo docker run --rm --privileged shark /shark-1.0/bin/linux/x86_64/shark -fm $freq");
The above causes a temporary container to be created, calls the binary with the desired frequency, and then destroys the container. If you want to listen to AM radio, change the "-fm" to "-am". If you want to control the blue LEDs, change "-fm" to "-blue" followed by a "1" or "0". If you want to control the red LEDs, change the "-fm" to "-red", followed by a "1" or "0". Example: "-red 1". Note: the LED calls can be run in the same command line as the "-fm" or "-am" calls.
Note: above assumes that you have sudo configured to allow calling the Docker container from a user account.
If the above is saved to ~/bin/shark, the Radioshark can be tuned to WNOR by running:
shark 98.7
Note: following are notes on manually configuring PulseAudio to recognize the RadioShark. The "radio_config.pl" script (above) automates this process.
One you plug in the RadioShark, Pulseaudio should recognize it as an audio source. However, the GUI for PulseAudio doesn't always list it. You can force the issue by determining the appropriate sink and source numbers for the devices.
Find the sink number by running:
pactl list|grep "Sink \#" -A 3
The output should look something like:
root@desk:~# pactl list|grep "Sink \#" -A 3
Sink #0
State: IDLE
Name: alsa_output.pci-0000_01_00.1.hdmi-stereo
Description: Cape Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series] Digital Stereo (HDMI)
--
Sink #1
State: IDLE
Name: alsa_output.usb-Samson_Technologies_Samson_Meteor_Mic-00.analog-stereo
Description: Meteor condenser microphone Analog Stereo
--
Sink #2
State: RUNNING
Name: alsa_output.pci-0000_00_14.2.analog-stereo
Description: Built-in Audio Analog Stereo
In the above example, Sink #2 is connected to the sound bar on my desk.
The source number can be determined by running:
pactl list|grep "Sink \#" -A 3
The output should look something like:
root@desk:~# pactl list|grep "Source \#" -A 3
Source #0
State: RUNNING
Name: alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor
Description: Monitor of Cape Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series] Digital Stereo (HDMI)
--
Source #1
State: RUNNING
Name: alsa_input.usb-Griffin_Technology__Inc._RadioSHARK-00.analog-stereo
Description: Radio SHARK Analog Stereo
--
Source #2
State: RUNNING
Name: alsa_output.usb-Samson_Technologies_Samson_Meteor_Mic-00.analog-stereo.monitor
Description: Monitor of Meteor condenser microphone Analog Stereo
--
In the above, the RadioShark is source #1.
We can then configure Pulseaudio to recognize the RadioShark and pipe it's output to the soundbar by running:
pactl load-module module-loopback source=1 sink=2
The above causes the proper controls to show up in the pavucontrol GUI. I'll develop a more permanent solution in the future.
The RadioShark can then be tuned by running the above command line.