Wednesday, December 28, 2016

The dead (RadioShark) walks again!

One of the problems with Linux is that people cannot leave well enough alone. There's always someone that comes along, claiming that they have a "new and improved" method for performing a specfic task. It doesn't matter that their solution is non-universal. In this case, libhidapi (the replacement for libhid) is non-functional on Ubuntu (there's too many issues with using it). Since libhid was considered legacy, support for it was removed from Ubuntu.

For us not-really-a-good-programmer types, this can be a problem. In my case, the code for the inherited RadioShark is no longer compilable (even though the kernel recognizes the device and loads the proper kernel module for it).

Getting the RadioShark v1 working on Ubuntu 16.04.1 turned out to be a happy accident on my part. It shouldn't work but does. It relies heavily on the fact that people included compilied binaries with their code (as always, run at your own risk). I use this because it gives me a starting point at which I can sniff USB traffic and reverse engineer what needs to be sent to the RadioShark to control it. The bad news is that the provided source code still will not compile.


Following are the employed steps, just in case you're interested.

1) Grab libhid-dev_0.2.15+2006.325-2.2ubuntu1_i386.deb.tar.gz, which is attached to the forum post at:

2) Create a working folder, move the tarball into it, and untar the tarball. This creates three files:

  • libhid0_0.2.15+20060325-2.2ubuntu1_i386.deb
  • libhid-dev_0.2.15+20060325-2.2ubuntu1_i386.deb
  • python-hid_0.2.15+20060325-2.2ubuntu1_i386.deb

The third is not needed, unless you plan on using Python to control the RadioShark (and I doubt that it'll work in any case).

3) Use dpkg to install (first) the libhid0 file, then the libhid-dev files. Both will spit up errors about configuration but the libraries get installed. Note: you may need to run "apt-get install pkg-config" before using dpkg, and "apt-get -f install" afterwards.

4) Download the shark 1.0 tarball from:

5) Untar the tarball and cd to shark-1.0/bin/linux/i686. By default, the blue LEDs on the RadioShark should come on when you plug in the device. Run the following to see if you have control over the device:

  sudo ./shark -blue 0
  sudo ./shark -red 1

6) Tune a station by running:

  sudo ./shark -fm 98.7


1) If you hear nothing (not even static), open your PulseAudio volume control. Under "Input devices", you should see an entry for "Radio SHARK Analog Stereo", with a moving level meter underneath it. If the volume control is greyed out, hover your mouse to the left of the button with the lock on it. Another button should show up (this is the mute button). Click it to unmute the stream.

2) If there's no "Radio SHARK" entry in the PulseAudio Volume Control's "Playback" tab, run the following as your user:

  pactl load-module module-loopback

To make the above permanent, add the following to the end of /etc/pulse/

  load-module module-loopback

Update: The above does not work with USB 3.0 interfaces. Luckily, I have a computer with both USB 3 and USB 1.x/2.x buses.