Date: Tue, 6 Mar 2012 18:35:17 -0800 From: George Hartzell <hartzell@alerce.com> To: freebsd-usb@freebsd.org Subject: radioSHARK, libusbhid and 'Device not configured' Message-ID: <20310.51557.331624.617177@gargle.gargle.HOWL>
next in thread | raw e-mail | index | archive | help
Long story short, I'm running into 'Device not configured' errors while trying to use libusbhid to control a Griffin radioSHARK. I'm not sure what I'm doing wrong or what to try next and am hoping that someone can help me get going again. There are links to various diagnostic material near the end of this message. I've been trying to make a Griffin radioSHARK USB AM/FM radio work. My long term goal is to use it from within the Squeezebox world but it has become something of a challenge in its own right. I was initially working on a Mac OS X system (to avoid building a recent Logitech Media Server [LMS, new name for the squeezebox server software] on my FreeBSD 9 system until later). There is an LMS plugin for the radioSHARK which uses an small C program called shark2 to set frequencies etc... Shark2 did not work on OS X 10.6, and after much gnashing of teeth and digging through the libhid and libusb world I finally found out that it can't be made to work (Apple's USB drivers grab the device exclusively and the pre OS X 10.6 trick of using a kext to protect it no longer works). The authors of libusb recommended using a library called hidapi. I got that working and discovered that the bytes that shark2 sends down the usb connection don't work on my device (possibly because I have a radioSHARK v1). A bit more googling and I found some old notes in Japanese that described the protocol (Google translate to the rescue, more or less...) and I am now able to turn the LEDs on and off and tune to FM and AM (crappy reception) at will. So, I've convinced myself that I have a sufficient understanding of how the thing works. On to FreeBSD. When I plug the device into my 9.0-STABLE system it seems to be recognized: ugen1.2: <Griffin Technology, Inc.> at usbus1 uaudio0: <Griffin Technology, Inc. RadioSHARK, class 0/0, rev 1.10/0.01, addr 2> on usbus1 uaudio0: No playback! uaudio0: Record: 48000 Hz, 2 ch, 16-bit S-LE PCM format uaudio0: No midi sequencer pcm1: <USB audio> on uaudio0 uhid0: <Griffin Technology, Inc. RadioSHARK, class 0/0, rev 1.10/0.01, addr 2> on And I can do the cheap and easy test of > cat /dev/dsp1.0 > /dev/dsp0.1 and listen to what ever channel it happens to be set to. The mixer command let me set the volume with "-f mixer1" and I was very hopeful. It seemed like I should be able to recreate my OS X/hidapi version using FreeBSD libusbhid. The meat of the hidapi version is a call to hid_write, which in turn does the following call into the OS X libraries. set_report(dev, kIOHIDReportTypeOutput, data, length); which seems to map straightforwardly to something like this (cribbed from various things in /usr/src): hid_init(NULL); f = open("/dev/uhid0", O_RDWR); if (f < 0) err(1, "%s", "/dev/uhid0"); // red LED memset(buf, 0x00, sizeof(buf)); buf[0] = 0xA9; /* red on */ r = hid_set_report(f, hid_output, buf, 7); if (r != 0) warn("hid_set_report"); But it consistently tells me > sudo ./shark shark: hid_set_report: Device not configured A bit of poking around led me to [blindly] try usbhidctl and to discover that it also runs into 'Device not configured' errors. > sudo usbhidctl -f /dev/uhid0 -v -a Password: usbhidctl: hid_get_report(rid 0): Device not configured Got input report 0 (6 bytes): Consumer:Consumer_Control.Consumer:Consumer_Control= Consumer:Consumer_Control.Consumer:Consumer_Control= Consumer:Consumer_Control.Consumer:Consumer_Control= Consumer:Consumer_Control.Consumer:Consumer_Control= Consumer:Consumer_Control.Consumer:Consumer_Control= Consumer:Consumer_Control.Consumer:Consumer_Control= usbhidctl: hid_get_report(rid 0): Device not configured Got output report 0 (6 bytes): Consumer:Consumer_Control.Consumer:Consumer_Control= Consumer:Consumer_Control.Consumer:Consumer_Control= Consumer:Consumer_Control.Consumer:Consumer_Control= Consumer:Consumer_Control.Consumer:Consumer_Control= Consumer:Consumer_Control.Consumer:Consumer_Control= Consumer:Consumer_Control.Consumer:Consumer_Control= I have output from setting hw.usb.uhid.debug=15 then plugging the radioSHARK in here: http://shrimp.alerce.com/radioSHARK/usb-sysctl-output.txt and the output from usbconfig -d ugen1.2 dump_device_desc dump_curr_config_desc here: http://shrimp.alerce.com/radioSHARK/usbconfig-output.txt And output from using usbdump while I tried to toggle the red led on/off here: http://shrimp.alerce.com/radioSHARK/usbdump-output-red-off.txt http://shrimp.alerce.com/radioSHARK/usbdump-output-red-on.txt I'm open to suggestions about what to try next. Thanks (double if you've made it this far), g.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20310.51557.331624.617177>