|
From: Hans de G. <hde...@re...> - 2012-05-08 10:08:18
|
Hi,
On 05/07/2012 05:10 PM, Deron wrote:
> Hello,
>
> I hope this is an appropriate things to post here. I have an AlertFM usb
> radio that is "windows only" that I want to use on my Ubuntu server. The
> plan is to set it up to listen for EAS warnings on our local radio
> station. (We live a long way from civilization and don't always have the
> TV on). If I can get the audio stream, I can do the rest easy enough
> (I've got that part written and tested using recordings of EAS audio
> messages).
>
> Anyway, I have a windows computer and captured some channel changing
> data using their software, and digging around I found this software
> which actually recommends hidapi for HID devices. No problem, I have
> that installed along with libusb and I think I even have it changing
> channels (one report sets the channel, and another reads back the
> current channel. Still an input report I can't seem to grab which gives
> signal strength data etc, but I could live without that.)
>
> What I don't have now is the audio stream. I'm not very familiar with
> USB, so this is a really basic question, but what do I do to read that
> data? I'm guessing that hidapi won't be able to read that data, and
> somehow need to mix in calls with libusb? I've not had much luck finding
> sample applications for hidapi, and if someone could just nudge me in
> the correct direction I would appreciate it or even basic info on USB
> that would fluff out my knowledge without have to read an encyclopedia
> on USB.
I see that you've already gotten several useful replies further in the
thread. So it looks like getting the audio from the device is a solved
problem, which only leaves the tuning. Tuning normally is handled
by v4l2 kernel driver.
Chances are that your device is using the si470x chipset, as that uses
a usb-audio class interface for the audio and a hid interface for
tuning...
To test this you would need to do the following (as root):
1) plug in the device
2) do dmesg, you should see something like this in there:
usb 2-1.5: New USB device found, idVendor=12cf, idProduct=7111
Note the 2-1.5
3) "cd /sys/bus/usb/drivers/usbhid"
4) "ls"
You should see a symlink in there starting with the same prefix as in the
dmesg, followed by :1.2, ie: "2-1.5:1.2", then do:
5) "echo '2-1.5:1.2' > unbind"
Replacing 2-1.5:1.2 with the address string for your device
6) "modprobe radio-usb-si470x"
7) "cd /sys/bus/usb/drivers/radio-si470x"
8) "echo '0x12cf 0x7111' > new_id"
9) ls, now the 2-1.5:1.2 like string should be there, if not
see "dmesg" for errors :|
10) "ls /dev/radio*"
If there is a radio device there things seem to be working!
Now start a program recording / looping back sound from
the alsa device for the usb-stick, and then start a radio
tuning program, for example the very simple "radio" app
from xawtv.
###
If the above does not work, it looks like you do need to write
some software to drive the device yourself after all. IMHO the end
result of this project would be to write a v4l2 kernel driver.
For starters we can write a little libusb program, but once we've
put in that effort why not go all the way and make it usable as a
normal/standard radio device under Linux?
The first step would be to catch some USB-traces of windows setting
the frequency, or iow windows doing some tuning to a radio station.
The way to do that now a days is to start windows inside a vm under Linux
and then redirect the usb device to the windows vm.
When you've the device working inside a windows vm, then:
-figure out on which usb bus the device sits (lsusb will tell you this)
-shutdown the windows vm
-unplug the device
-start wireshark as root and ignore the security warning, it is not really
relevant when using wireshark to monitor usb devices
-tell wireshark to record usb transfers on the bus the device was on
-re-plug in the device, this needs to happen after starting wireshark,
so that wireshark sees the usb device descriptors come past and can
thus automatically load the right protocol dissectors
-write down where in the log wireshark now is, as everything up till this
point was send by the standard linux hid and audio drivers
-start the vm and redirect the device to it
-write down where in the log wireshark now is, as everything up till this
was windows initialization which is likely not interesting
-start the windows radio app, look in the wireshrak log for any HID messages,
these are likely doing the tuning
-tune to a certain frequency if possible (ie no auto tuning, but pick a fixed freq.),
write down where in the log you are, and what frequency you tuned to
-tune to a another frequency if possible (ie no auto tuning, but pick a fixed freq.)
write down where in the log you are, and what frequency you tuned to
-stop the windows radio app
-stop wireshark capturing usb packets
-save the capture in wireshark!
And then you can go and try to figure things out from the capture. Note besides
a libusb developer I'm also a v4l2 developer and have reverse engineered quite
a few usb devices. This sounds like a fun little project and I would like to help,
which requires me getting my hands on such a device...
Regards,
Hans
|