[libhid-discuss] how do I read events from a Hama MCE remote (keyboard+mouse)

Peter Stuge peter at stuge.se
Tue Oct 6 16:10:11 UTC 2009

Péter Szabó wrote:
> Thanks for the helpful and insightful answer.

You're welcome.

> > Another option could be to detach the kernel drivers from
> > the devices in your application.
> This does work. With a little modification of Bob Pwwer's detach
> program (original: http://www.linuxha.com/common/iplcd/detach.tgz ;
> modified: http://code.google.com/p/pts-mini-gpl/source/browse/#svn/trunk/pts-usb-detach
> ) I could detach the usbhid driver from the device.

You would do this in your own program, which will then drive the

> Unfortunately, /dev/input/event7 and event8 also disappeared.

Yes, that is to be expected. As I explained they are provided by the
kernel input layer, which is fed data by the kernel USB HID driver,
which you just disabled.

> Do I understand correctly that I can use libhid or libusb (which
> one? I think libusb would be more appropriate) at this point to
> talk to the remote?

Yes. libusb also has a function for detaching kernel drivers,
although it only works on Linux. libhid and libusb will both work.
Which you use is really up to you.

> Is there some library which makes parsing easy?

No. The reference USB HID keyboard driver exists in the kernel. I
don't believe there is a userspace keyboard driver. Maybe in Hurd?

> > Ideally you will find a way to not just use the kernel drivers.

Oops. That should be without "not" ^^^ there.

> > /dev/input/event data is very easy to consume, you only really have
> > to block the keyboard and mouse within the HID layer.
> > Maybe you can get that done easily in the kernel.
> Yeah, reading /dev/input/event* should be the easiest for me.
> Any idea how to block the kernel from using the remote in the
> keyboard and mouse subsystem?

"in the kernel" and "within the HID layer"

> Any idea who knows how to to do this.

Look for the Linux input layer developers. Ask them how you can make
a device accessible via the event interface but just not pool into
the "console" keyboard and mouse inputs. I'd be happy to learn what
they reply too.


More information about the libhid-discuss mailing list