#8827 closed Patches (Obsolete)

HAMA MCE event client

Reported by: AaYJFG Owned by: davilla
Priority: 4 - Normal
Component: Keymapping (Remote Control / Gamepad Controller) Version: GIT
Severity: Normal Keywords:
Cc: topfs2 Blocked By:
Blocking: Platform: All

Description

Hi, since the HAMA MCE remote control (sold under different brand names by different vendors) has a -- ermm, let's say: -- somewhat strange protocol, I decided to write an event client for this remote to bypass the OS driver and intermediate libraries (X11/Aqua/SDL etc.).

The attached source resolves the following issues, which I found annoying:

  • the remote registers 2 input devices, some keys register as mouse buttons, other as keyboard keys. This makes mapping in keymap.xml difficult. The attached event driver sends key and action events which are easy to map.
  • right mouse button and info key have the same keycode, but it is possible to distinguish them by counting the different number of key-up events. The attached code does this, so that we can use one key as "info" and the other as "right mouse button" (or "contextmenu").
  • a matching keymap is provided (contains only a single entry, since the event client already sends "intuitive" events to xbmc).
  • the event client is started by udev under linux, and stopped when the device is disconnected.
  • Keyrepeat and mouse works now as expected.

The code has only a single dependency to libusb-1.0, which is fetched, built and linked statically inside the event client. unpack the source and type "make install" to build and install.

The source has been tested on xbmc/linux and the 9.11 live release, but should work on every platform supported by libusb-1.0 (including MAC/OSX).

Maybe this is useful to others and could go into the event client source tree in SVN?

Attachments (10)

hama-mce.tar.gz (9.2 KB) - added by AaYJFG at 2010-02-20T13:05:18Z.
HAMA MCE event client
hama_mce-1.1.tar.gz (10.5 KB) - added by fyfe at 2010-09-14T11:47:08+01:00.
Updated with a few bug fixes.
hama_mce-1.2.tar.gz (10.7 KB) - added by fyfe at 2010-09-14T17:59:31+01:00.
fix bug that caused the system to hang for a couple of minutes during startup
hama_mce-v1.2.tar.gz (10.8 KB) - added by fyfe at 2010-09-14T20:04:25+01:00.
fix bug that caused the system to hang for a couple of minutes during startup
hama_mce-1.3.tar.gz (60.0 KB) - added by fyfe at 2010-09-16T12:29:31+01:00.
hama_mce-1.4.tar.gz (60.0 KB) - added by fyfe at 2010-10-15T17:07:30+01:00.
hama_mce-1.4.1.tar.gz (60.0 KB) - added by fyfe at 2010-10-31T15:33:33Z.
Fixed a mistake in the Makefile
hama_mce-1.5.tar.gz (60.0 KB) - added by fyfe at 2010-11-06T12:04:01Z.
Fix the info button
0001-Removed-a-couple-of-warning-messages-issued-by-udev-.patch (1.4 KB) - added by beppec56 at 2011-02-07T16:12:38Z.
A patch to remove udev warnings at boot time.
koribo_ilro_mce.tgz (8.4 KB) - added by yurac at 2011-05-02T17:55:48+01:00.
I changed hama_mce to work with Koribo Ilro remote control.

Change History (39)

comment:1 Changed at 2010-02-19T18:58:53Z by vdrfan

  • Cc topfs2 added

comment:2 Changed at 2010-02-19T22:38:51Z by AaYJFG

Since the question came up in the forum: it is easy to modify this code in order to support other MCE/HID USB remotes, only the vendor/device id and the keycode tables need to be adjusted.

comment:3 Changed at 2010-02-19T23:38:30Z by davilla

  • Owner set to davilla
  • Status changed from new to assigned

@AaYJFG, for us to include this into the event client source tree in SVN trunk, we would need a GPL license added to the source code files. You can use an existing xbmc source code file as a template. You can, at your option, retain the copyright or assign it to Team XBMC.

Thanks again for this.

comment:4 Changed at 2010-02-20T08:50:37Z by topfs2

Nice!

Changed at 2010-02-20T13:05:18Z by AaYJFG

HAMA MCE event client

comment:5 Changed at 2010-02-20T13:05:42Z by AaYJFG

I hereby re-release the code under BSD license, so that anyone is free to use it under whatever license he or she prefers -- BSD, X11, GPL, whatever you like.

Sorry that I forgot to add a LICENSE file. The updated, attached tarball contains a BSD LICENSE file.

comment:6 Changed at 2010-09-11T11:10:53+01:00 by slux

No hope to have this marvellous piece of code in Dharma?

Changed at 2010-09-14T11:47:08+01:00 by fyfe

Updated with a few bug fixes.

comment:7 Changed at 2010-09-14T11:47:45+01:00 by fyfe

I've been using this for a while and it's a great tool. I've attached an updated version with some bug fixes and created a git repository for any further development of the code.

Changed at 2010-09-14T17:59:31+01:00 by fyfe

fix bug that caused the system to hang for a couple of minutes during startup

Changed at 2010-09-14T20:04:25+01:00 by fyfe

fix bug that caused the system to hang for a couple of minutes during startup

comment:8 Changed at 2010-09-14T21:19:01+01:00 by Horscht

this works really nice so far, the only thing I noticed is that I can not put my PC to sleep.

When I press the power button on the remote, the remote or the event server sends the "power" key repeated endlesly which imidiatelly prevents the system from hibernating. I am running XBMC Live Dharma Beta 1. Is there any particular info I can provide?

comment:9 follow-up: Changed at 2010-09-14T22:48:57+01:00 by Neroo

Hi,

i've used this event client for a while and was very pleased with it. But today i reinstalled xbmc-live. When i tried to reinstall this hama mce event client using putty i got this error:

thx for your help

[email protected]:~/hama_mce$ sudo make install ( cd ./3rdparty && make -f Makefile.libusb-1.0 ) make[1]: Entering directory `/home/xbmc/hama_mce/3rdparty' ( mkdir -p src && cd src && wget -c http://downloads.sourceforge.net/project/libusb/libusb-1.0/libusb-1.0.8//libusb-1.0.8.tar.bz2 ) /bin/sh: wget: not found make[1]: * [src/libusb-1.0.8.tar.bz2] Error 127 make[1]: Leaving directory `/home/xbmc/hama_mce/3rdparty' make: * [3rdparty/include/libusb-1.0/libusb.h] Error 2

comment:10 in reply to: ↑ 9 Changed at 2010-09-14T22:58:46+01:00 by Neroo

ok found it! the solution was: sudo apt-get install -y wget

Changed at 2010-09-16T12:29:31+01:00 by fyfe

comment:11 Changed at 2010-09-22T17:36:12+01:00 by vdrfan

Dharma ping. Davilla, topfs2? ;)

comment:12 Changed at 2010-09-26T16:24:41+01:00 by slux

@fyfe: A little glitch that I have found: the 'title' key and the 'guide' key are bind to 'XINPUT_IR_REMOTE_TITLE' in ButtonTranslator.cpp. So they are the same key.You should change the name of one of them.For example you could use the 'display' key label instead of 'title' key.

Changed at 2010-10-15T17:07:30+01:00 by fyfe

Changed at 2010-10-31T15:33:33Z by fyfe

Fixed a mistake in the Makefile

comment:13 Changed at 2010-11-02T11:36:57Z by Juanjo

@fyfe: I have updated to v1.4 2 days ago, and i just noticed that while on fullscreen video the info key shows up the movie information but when you press it again the movie information closes and shows up again instantly, I will rollback tonight to 1.3 and check if its a new bug in hama_mce or if its a bug introduced by dharma beta4... i'll get back to you if you havent checked it out by then.

thanks again Juanjo

comment:14 Changed at 2010-11-06T00:36:54Z by Juanjo

I can confirm 1.3 does not show this behaviour, 1.4 does though.

this is a output of 1.4 select : 00 00 28 00 00 00 00 00 ## send key (R1) 'select' select : 00 00 28 00 00 00 00 00 ## send key (R1) 'select' select : 00 00 28 00 00 00 00 00 ## send key (R1) 'select' catching right click/info : 01 02 00 00 00 info : ## send info click ## send action 'info' (button) catching right click/info : 01 02 00 00 00 info : ## send info click ## send action 'info' (button) catching right click/info : 01 02 00 00 00 info : ## send info click ## send action 'info' (button) stop : 02 00 00 01 55 ## send key (R1) 'stop'

here is the output of the same key sequence send key 'select' send key 'select' send key 'select' send key 'info' send key 'info' send key 'info' send key 'stop'

is it calling 2 functions (emit info and send action) for the info button ?

Changed at 2010-11-06T12:04:01Z by fyfe

Fix the info button

comment:15 Changed at 2010-11-06T12:09:20Z by fyfe

Fixed, for some reason XBMC.SendAction behaves differently from XBMC.SendKey, I'll need to dig into the xbmc source when I get a chance.

The double message is because emit_info calls xbmc_key/xbmc_action.

comment:16 Changed at 2010-11-06T21:52:00Z by Juanjo

Thanks a lot, works like a charm

comment:17 Changed at 2010-11-21T13:49:20Z by Juanjo

hi Fyfe, ive come yet again to report back, i recently installed maverick 32bits, configured everything like in lucid, works awesome, but i get a seg fault when i kill the process to regain lirc control over the device, and since the dev/inpuots are not recreaded it gets stuck. is there anything i can give you to work with it ? any kind of log or something?

thanks as always Juanjo

comment:18 Changed at 2010-11-22T14:02:04Z by slux

Hi Juanjo,when you close the eventclient,you could try to execute "sudo udevadm trigger".It should fix your devices,if they are missing.

comment:19 Changed at 2010-11-25T01:57:33Z by Juanjo

Thanks a lot Slux, i will do that.

comment:20 Changed at 2010-12-05T13:24:31Z by Juanjo

well i managed to get my hands back on the box, i tries slux's tip, but it does not work, inputs are not restored..

Changed at 2011-02-07T16:12:38Z by beppec56

A patch to remove udev warnings at boot time.

comment:21 Changed at 2011-02-07T16:15:37Z by beppec56

Added a patch to correct a couple of warnings. Comment in the patch reads as follow:

Removed a couple of warning messages issued by udev while booting.

The following messages were issued at boot time:

udevd[388]: BUS= will be removed in a future udev version, \

please use SUBSYSTEM= to match the event device, \ or SUBSYSTEMS= to match a parent device, in /etc/udev/rules.d/hama_mce.rules:7

udevd[388]: SYSFS{}= will be removed in a future udev version, \

please use ATTR{}= to match the event device, \ or ATTRS{}= to match a parent device, in /etc/udev/rules.d/hama_mce.rules:7

Signed-off-by: Giuseppe Castagno <[email protected]…>

Patch is in git format-patch mode.

This being the first time with Trac, I'm not sure this is the right way of submitting patch.

comment:22 Changed at 2011-02-07T16:37:07Z by beppec56

I forgot to add that the warning were issued on my system:

[email protected]:~/hama_mce-usb-driver$ lsb_release -a; uname -m No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 10.10 Release: 10.10 Codename: maverick x86_64

Not sure what happens on older platforms.

comment:23 Changed at 2011-02-07T16:38:59Z by beppec56

Argh, a new one better formatted (I hope ;-) )

[email protected]:~/hama_mce-usb-driver$ lsb_release -a; uname -m

No LSB modules are available.

Distributor ID: Ubuntu

Description: Ubuntu 10.10

Release: 10.10

Codename: maverick

x86_64

Changed at 2011-05-02T17:55:48+01:00 by yurac

I changed hama_mce to work with Koribo Ilro remote control.

comment:24 Changed at 2011-05-04T10:28:45+01:00 by yurac

I tried a different approach with my Koribo Ilro remote control (which behaves similarly to hama). I patched the usb hid class driver (usbhid) to inspect events and translate the non-standard mouse events to keyboard keypresses.

Same will work for hama (with some key code changes). The advantage of that approach is that the remote is seen by the system as standard keyboard and mouse and all corner cases such as attach detach and suspends are handled automatically by the system. Moreover, the mouse and keyboard are available to every program and not just XBMS.

If someone is interested, see: http://www.cs.bgu.ac.il/~yurac/interests/koribo_ilro.tgz

comment:25 Changed at 2011-09-15T12:22:00+01:00 by oopepe

Hi,

i installed this on opensuse 11.4 64bit and its working nice, but after i every reboot hama_mce is not running. I always need to manually plug out and in again the ir receiver. What could be the problem here?

Thanks pepe

comment:26 Changed at 2011-12-02T01:04:32Z by Juanjo

Hi peeps I just installed pre eden... for some reason mouse movement is not working. i havent had much time to dig into, ill try to do some debuggin and post more info if i detect anything

Juanjo

comment:27 Changed at 2012-01-27T15:04:43Z by mbeyer

On ubuntu 12.04 with recent xbmc git, the event client dies on me now and again:

Jan 27 15:29:12 xbmc kernel: [ 6152.480522] ------------[ cut here ]------------
Jan 27 15:29:12 xbmc kernel: [ 6152.480535] kernel BUG at /build/buildd/linux-3.2.0/mm/slub.c:3422!
Jan 27 15:29:12 xbmc kernel: [ 6152.480542] invalid opcode: 0000 [#1] SMP
Jan 27 15:29:12 xbmc kernel: [ 6152.480549] CPU 0
Jan 27 15:29:12 xbmc kernel: [ 6152.480553] Modules linked in: joydev vesafb snd_emu10k1_synth snd_emux_synth snd_seq_virmidi snd_seq_midi_emul dell_wmi sparse_keymap nfsd nfs lockd fs$
Jan 27 15:29:12 xbmc kernel: [ 6152.480655]
Jan 27 15:29:12 xbmc kernel: [ 6152.480662] Pid: 501, comm: hama_mce Tainted: P           O 3.2.0-10-generic #18-Ubuntu Dell Inc. Latitude D830                   /0HN338
Jan 27 15:29:12 xbmc kernel: [ 6152.480675] RIP: 0010:[<ffffffff81161c15>]  [<ffffffff81161c15>] kfree+0x135/0x140
Jan 27 15:29:12 xbmc kernel: [ 6152.480695] RSP: 0018:ffff88010609bde8  EFLAGS: 00010246
Jan 27 15:29:12 xbmc kernel: [ 6152.480701] RAX: 0000000000000000 RBX: ffff880000000201 RCX: 00007fff01d270a8
Jan 27 15:29:12 xbmc kernel: [ 6152.480708] RDX: ffffffff7fffffff RSI: 00007fff01d270a8 RDI: ffff880000000201
Jan 27 15:29:12 xbmc kernel: [ 6152.480714] RBP: ffff88010609be18 R08: ffffea0000000000 R09: ffff8801073eec98
Jan 27 15:29:12 xbmc kernel: [ 6152.480720] R10: 0000000000000000 R11: 0000000000000246 R12: ffff88010712a3c0
Jan 27 15:29:12 xbmc kernel: [ 6152.480726] R13: ffff8801146cd8e8 R14: ffffffff8149ae8a R15: 000000004008550d
Jan 27 15:29:12 xbmc kernel: [ 6152.480734] FS:  00007f2af0d22740(0000) GS:ffff88011fc00000(0000) knlGS:0000000000000000
Jan 27 15:29:12 xbmc kernel: [ 6152.480741] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
Jan 27 15:29:12 xbmc kernel: [ 6152.480747] CR2: 00007f56f4f0d000 CR3: 000000010713d000 CR4: 00000000000006f0
Jan 27 15:29:12 xbmc kernel: [ 6152.480753] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
Jan 27 15:29:12 xbmc kernel: [ 6152.480760] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Jan 27 15:29:12 xbmc kernel: [ 6152.480767] Process hama_mce (pid: 501, threadinfo ffff88010609a000, task ffff8801060b0000)
Jan 27 15:29:12 xbmc kernel: [ 6152.480772] Stack:
Jan 27 15:29:12 xbmc kernel: [ 6152.480776]  ffff88010609be38 ffff8800ce9eb180 ffff88010712a3c0 ffff8801146cd8e8
Jan 27 15:29:12 xbmc kernel: [ 6152.480788]  ffff88011301b450 000000004008550d ffff88010609be38 ffffffff8149ae8a
Jan 27 15:29:12 xbmc kernel: [ 6152.480800]  ffff88011301b450 ffff8800ce9eb180 ffff88010609bec8 ffffffff8149d179
Jan 27 15:29:12 xbmc kernel: [ 6152.480812] Call Trace:
Jan 27 15:29:12 xbmc kernel: [ 6152.480823]  [<ffffffff8149ae8a>] free_async+0x3a/0x70
Jan 27 15:29:12 xbmc kernel: [ 6152.480832]  [<ffffffff8149d179>] usbdev_do_ioctl+0x5a9/0xd20
Jan 27 15:29:12 xbmc kernel: [ 6152.480841]  [<ffffffff81655d5e>] ? _raw_spin_lock_irqsave+0x2e/0x40
Jan 27 15:29:12 xbmc kernel: [ 6152.480850]  [<ffffffff8149d91e>] usbdev_ioctl+0xe/0x20
Jan 27 15:29:12 xbmc kernel: [ 6152.480860]  [<ffffffff8118943a>] do_vfs_ioctl+0x8a/0x340
Jan 27 15:29:12 xbmc kernel: [ 6152.480868]  [<ffffffff8118a69a>] ? poll_select_set_timeout+0x7a/0x90
Jan 27 15:29:12 xbmc kernel: [ 6152.480877]  [<ffffffff81189781>] sys_ioctl+0x91/0xa0
Jan 27 15:29:12 xbmc kernel: [ 6152.480885]  [<ffffffff8118b676>] ? sys_poll+0x76/0x110
Jan 27 15:29:12 xbmc kernel: [ 6152.480895]  [<ffffffff8165e002>] system_call_fastpath+0x16/0x1b
Jan 27 15:29:12 xbmc kernel: [ 6152.480900] Code: 89 da 4c 89 c6 e8 aa ff 4d 00 eb 94 49 f7 00 00 c0 00 00 74 16 4c 89 c7 e8 29 1c fc ff e9 7e ff ff ff 4d 8b 40 30 e9 27 ff ff ff <0f> $
Jan 27 15:29:12 xbmc kernel: [ 6152.480997] RIP  [<ffffffff81161c15>] kfree+0x135/0x140
Jan 27 15:29:12 xbmc kernel: [ 6152.481007]  RSP <ffff88010609bde8>
Jan 27 15:29:12 xbmc kernel: [ 6152.481080] ---[ end trace a076962115c44977 ]---

comment:28 Changed at 2012-09-17T17:21:45+01:00 by Martijn

  • Resolution set to Obsolete
  • Status changed from assigned to closed

closing as this is created a long time ago for an outdated version

comment:29 Changed at 2012-09-18T13:46:28+01:00 by Martijn

  • Milestone Future / Pending deleted
Note: See TracTickets for help on using tickets.