philipp’s weblog header image

Introducing libspeechmike

June 14th, 2009 · 3 Comments · other stuff

I recently got a Philips Speechmike device. It seems Philips has a Linux SDK for it, but I was unable to obtain it. I thought it wouldn’t be impossible to write a Linux driver for those couple buttons, so I gave it a try.

First the good things:

  • The speaker and microphone work perfectly out-of-the-box with zero configuration using the snd_usb_audio Linux kernel module.
  • The same thing is true for the trackball and scrollwheel as well as the mouse buttons. They are recognized as regular USB mouse and instantly usable.

Not working out-of-the-box are the buttons on top and the status LEDs.

Now there are a couple different layers where you could start writing a driver for these buttons:

  1. the kernel. Make it work like a keyboard device.
  2. X11. Make it work like a keyboard device, too.
  3. create a library that an application could like if it wants to provide support for the SpeechMike.

After some discussion on the linux-usb mailing list it became clear that the SpeechMike is not a usual USB HID device that could be easily supported by the existing code.

I then thought about the idea of the device being a keyboard a bit more: which keyboard events would you assign to the buttons? Use e.g. KEY_PLAY for the “Play” button? That would mean pressing the “Play” button on the SpeechMike would have the same meaning as pressing the “Play” button on your multimedia keyboard. Didn’t sound like a good idea to me. Use the more general events like F23? Doesn’t look like a good solution either.

I also found out that you can press an arbitrary number of buttons at the same time, like modifier keys (CTRL, …) on your normal keyboard. I wasn’t sure how that would work with a kernel driver or a X11 driver, so I finally decided to write a simple library which I could use in my application.

So here it is: libspeechmike. You can get the source code from my Mercurial (hg) repository at

http://philipp.wagner.name/hg/libspeechmike.

The source code includes a example program, speechmike_dump, that shows you which keys you pressed and can serve as a reference if you want to build your own application with it. It uses the hiddev interface, which is really easy to use without the need of another library (like libhid or libusb). You only need to make sure you have read permissions for the device file.

The LEDs are currently not working, I guess I’ll need to do some USB sniffing with the original Philips driver on Windows to get those working.

Tags:

3 responses so far ↓

  • 1 Martin // May 18, 2011 at 21:45

    Hi,

    thanks for your library. It works rather nicely. However, for recent Linux kernels the path is “/dev/usb/hiddev0″ instead of “/dev/hiddev0″.

  • 2 Kaan // Oct 7, 2011 at 16:38

    Hi ,
    If you couldn’t find a way to work sppechmike’s leds i think i can help you.

  • 3 Philipp // Oct 8, 2011 at 00:08

    Hi Kaan,

    I started working on this as well, but didn’t get around to finish it yet. So I’d thankful if you could share what you have to get the LEDs working.

    Philipp

Leave a Comment