How do I use OSMC remote hardware device in other projects?

I am building a project using RASPBIAN Jessie, it needs a remote but isn’t a multimedia project so I won’t be using OSMC software.

Where can I find documentation that describes the OSMC Remote Control device sold in stores. I like the look of it and want to re-purpose it for my other project, written in Python.

I had scouted around but can’t find it, if it exists, it’s obscured by search results about the OSMC software system. I want to take a look before buying one, here is the unit http://www.modmypi.com/raspberry-pi/accessories/keyboards-and-mice/osmc-remote-control

Thanks in advance for any advice or information.
Regards
David

The receiver for the black OSMC remote presents itself as a standard HID keyboard, so any device that supports USB keyboards should be able to use it.

The only issue you might have is the context menu and info buttons use a “high” scan code that may not be readable on all operating systems.

It depends on the OS you’re using. One good thing about our remote over others (ahem Hama), is that we only send one key code per button, so it’s easily remappable.

On Windows I suspect you can use something like EventGhost to map the keys to actions.

Hello Sam,
I mention it in the post - I am programming Python / tkinter/tkk running on RASPBIAN Jessie

Is there dcumentation for the device?
Thanks
David

Hi DBMandrake,
It’s a Pi running RASPBIAN Jessie programmed in Python using tkinter/ttk - I want to navigate between onscreen buttons and press them.

Is there documentation for the device that I can read before buying?

Hence I like the simpler remote. Also the user is elderly so a simple remote is easier for them.
Thanks
Regards
David

The remote acts as a HID device and passes keys to uinput as if it were a keyboard. You can see where these key mappings come from here:

http://lxr.free-electrons.com/source/include/linux/input.h?v=2.6.38#L210

Fabulous,
Thank you.

Should do admirably, appreciate the rapid assistance.
Regards,
David

I also wanted to use the official OSMC remote for other projects. I bought the current version - the one with the vol up / vol down buttons - and mapped the keys using the python script below.

Two things I discovered:

  1. The following button codes have changed:
    info: KEY_I (23)
    context: KEY_C (46)
    vol down: KEY_MINUS (12)
    vol up: KEY_EQUAL (13)

  2. The receiver appears as 2 USB devices on my RPi 2B (Jessie):
    /dev/input/event0 (most KEYs)
    /dev/input/event1 (KEY_BACK, KEY_PLAYPAUSE, KEY_STOP)

Python code:

from evdev import InputDevice, categorize, ecodes
from select import select

devices = map(InputDevice, ('/dev/input/event0', '/dev/input/event1'))
devices = {dev.fd: dev for dev in devices}

#for dev in devices.values(): print(dev)

while True:
	r, w, x = select(devices, [], [])
	for fd in r:
		for event in devices[fd].read():
			if event.type == ecodes.EV_KEY and event.value == 1:
				data = categorize(event)
				print data
2 Likes

Hey, thx!
I just selected the appropriate input devices and worked perfectly for me.