# Wiimote on Rasplex

**URL:** <https://forums.plex.tv/t/wiimote-on-rasplex/163057>\
**Category:** Apps & Creations\
**Created:** [October 13, 2016, 6:38pm UTC](https://forums.plex.tv/t/wiimote-on-rasplex/163057 "2016-10-13T18:38:45Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![videotecaCNSU](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/videotecacnsu/32/17514_2.png) [@videotecaCNSU](https://forums.plex.tv/u/videotecaCNSU)\
**Post date:** [October 13, 2016, 6:38pm UTC](https://forums.plex.tv/t/wiimote-on-rasplex/163057/1 "2016-10-13T18:38:45Z")

</div>

So I´m having a serious bad time getting a wiimote to work on a Rp3. With the default option to add it as a bluetooth device it just works the crosshair but I can´t get any other button to work even after looking and editing some keymap.xml for them.

I then edited the squashfs SYSTEM and added support for cwiid and python cwiid modules and got them to work. I know they work and I can test it in ssh but the result isn´t passed to the GUI.

Does someone knows a way to debug the buttons presses on rasplex? Something like xev to debug what keys are pressed so I can remap them on XML or some wiki to pass the commands that I need from bash or python to the GUI? What module can I use to pass keys to the GUI?

Hope someone can help me.

---

<div class="post-metadata">

**Author:** ![benjaminwolf](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/benjaminwolf/32/4305_2.png) [@benjaminwolf](https://forums.plex.tv/u/benjaminwolf)\
**Post date:** [October 14, 2016, 3:47am UTC](https://forums.plex.tv/t/wiimote-on-rasplex/163057/2 "2016-10-14T03:47:42Z")

</div>

You can put the log into debug mode and tail it from SSH. That will show you what keys are being seen by Rasplex/OpenPHT.

---

<div class="post-metadata">

**Author:** ![videotecaCNSU](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/videotecacnsu/32/17514_2.png) [@videotecaCNSU](https://forums.plex.tv/u/videotecaCNSU)\
**Post date:** [October 14, 2016, 3:22pm UTC](https://forums.plex.tv/t/wiimote-on-rasplex/163057/3 "2016-10-14T15:22:31Z")

</div>

So, wminput isn´t passing keys right now but i can run libcwiid from a python script with it and get it to recognise all keys.

Only the dpad is recognized by rasplex if i connect the wiimote directly, of course I can get the code of the missing keys from the logs, but is there a way for remaping it without recompiling LinuxInputDevices.cpp?

UP  
Keyboard: scancode: 67, sym: 0111, unicode: 0000, modifier: 0  
OnKey: up (f080) pressed, action is Up

Down  
Keyboard: scancode: 6c, sym: 0112, unicode: 0000, modifier: 0  
OnKey: down (f081) pressed, action is Down

Right  
Keyboard: scancode: 6a, sym: 0113, unicode: 0000, modifier: 0  
OnKey: right (f083) pressed, action is Right

Left  
Keyboard: scancode: 69, sym: 0114, unicode: 0000, modifier: 0  
OnKey: left (f082) pressed, trying keyboard action 61570

A  
CLinuxInputDevice::KeyEvent: TranslateKey returned XBMCK\_UNKNOWN from code(304)

B  
CLinuxInputDevice::KeyEvent: TranslateKey returned XBMCK\_UNKNOWN from code(305)

- 

CLinuxInputDevice::KeyEvent: TranslateKey returned XBMCK\_UNKNOWN from code(407)

- 

CLinuxInputDevice::KeyEvent: TranslateKey returned XBMCK\_UNKNOWN from code(412)

home  
CLinuxInputDevice::KeyEvent: TranslateKey returned XBMCK\_UNKNOWN from code(316)

1  
CLinuxInputDevice::KeyEvent: TranslateKey returned XBMCK\_UNKNOWN from code(257)

2  
CLinuxInputDevice::KeyEvent: TranslateKey returned XBMCK\_UNKNOWN from code(258)

---

<div class="post-metadata">

**Author:** ![Valdhor](https://avatars.discourse-cdn.com/v4/letter/v/ebca7d/32.png) [@Valdhor](https://forums.plex.tv/u/Valdhor)\
**Post date:** [October 14, 2016, 6:34pm UTC](https://forums.plex.tv/t/wiimote-on-rasplex/163057/4 "2016-10-14T18:34:52Z")

</div>

This may or may not help - [forums.plex.tv/discussion/150209/cec-remote-buttons-how-do-i-find-out-which-button-has-been-pressed/p1](http://forums.plex.tv/discussion/150209/cec-remote-buttons-how-do-i-find-out-which-button-has-been-pressed/p1 "forums.plex.tv/discussion/150209/cec-remote-buttons-how-do-i-find-out-which-button-has-been-pressed/p1")

---

<div class="post-metadata">

**Author:** ![benjaminwolf](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/benjaminwolf/32/4305_2.png) [@benjaminwolf](https://forums.plex.tv/u/benjaminwolf)\
**Post date:** [October 14, 2016, 6:36pm UTC](https://forums.plex.tv/t/wiimote-on-rasplex/163057/5 "2016-10-14T18:36:01Z")

</div>

Not that I know of. Previous efforts on this front have always ended in the same recompile required to support the undefined codes. Personally, I would think all these codes should be in LinuxInputDevices.cpp with generic definitions so they could be remapped. I’m not sure why basic codes were the only ones defined in the Kodi upstream, and these big holes in remote support left open. Perhaps there is a good reason and I just haven’t looked into it very hard.

---

<div class="post-metadata">

**Author:** ![videotecaCNSU](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/videotecacnsu/32/17514_2.png) [@videotecaCNSU](https://forums.plex.tv/u/videotecaCNSU)\
**Post date:** [October 14, 2016, 8:28pm UTC](https://forums.plex.tv/t/wiimote-on-rasplex/163057/6 "2016-10-14T20:28:31Z")

</div>

Thanks Valdhor but I already checked that thread. While I get the code “CLinuxInputDevice::KeyEvent: TranslateKey returned XBMCK\_UNKNOWN” i wont be able to map them in any way.

Think I have 3 possible ways to solve it

1. Edit and recompile LinuxInputDevices.cpp
2. Find some framework to send python or bash instructions to the GUI
3. Use python to pass keypresses but most modules expect X to be present

---

<div class="post-metadata">

**Author:** ![videotecaCNSU](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/videotecacnsu/32/17514_2.png) [@videotecaCNSU](https://forums.plex.tv/u/videotecaCNSU)\
**Post date:** [October 20, 2016, 2:52pm UTC](https://forums.plex.tv/t/wiimote-on-rasplex/163057/7 "2016-10-20T14:52:15Z")

</div>

I’m sorry, which is the current manual to build Rasplex? All the manuals I find on the wiki seems outdated to commands that aren’t present anymore

---

<div class="post-metadata">

**Author:** ![videotecaCNSU](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/videotecacnsu/32/17514_2.png) [@videotecaCNSU](https://forums.plex.tv/u/videotecaCNSU)\
**Post date:** [October 20, 2016, 3:54pm UTC](https://forums.plex.tv/t/wiimote-on-rasplex/163057/8 "2016-10-20T15:54:02Z")

</div>

Ok, answering my own question I was able to control RasPlex from CLI with **xbmc-send --host=127.0.0.1 --port=9778 --action="(any key name from keyboard.xml)**"

Also because xbmc-send is a python script I can use it as an example to control everything from another python program. So I might be able to build a daemon script to control rasplex with the help of libcwiid

---

<div class="post-metadata">

**Author:** ![videotecaCNSU](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/videotecacnsu/32/17514_2.png) [@videotecaCNSU](https://forums.plex.tv/u/videotecaCNSU)\
**Post date:** [October 24, 2016, 7:11pm UTC](https://forums.plex.tv/t/wiimote-on-rasplex/163057/9 "2016-10-24T19:11:46Z")

</div>

Small questions

I already have my mod which should add full compatibility with any wiimote.  
My questions are:  
Where should the addons go on RasPlex?

And does RasPlex respect the non existant .profile file to search for new paths outside the squashfs? If so, how is this normaly integrated on the addons, does the user have to do a manual configuration with

`cd ~ touch .profile echo "export PATH=$PATH:/your/directory/here" >> .profile`  
?

---

<div class="post-metadata">

**Author:** ![benjaminwolf](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/benjaminwolf/32/4305_2.png) [@benjaminwolf](https://forums.plex.tv/u/benjaminwolf)\
**Post date:** [October 25, 2016, 4:45am UTC](https://forums.plex.tv/t/wiimote-on-rasplex/163057/10 "2016-10-25T04:45:16Z")

</div>

> @videotecaCNSU said:  
> Ok, answering my own question I was able to control RasPlex from CLI with **xbmc-send --host=127.0.0.1 --port=9778 --action="(any key name from keyboard.xml)**"
> 
> Also because xbmc-send is a python script I can use it as an example to control everything from another python program. So I might be able to build a daemon script to control rasplex with the help of libcwiid

Sweet. Glad you found a solution. Just note that OpenPHT Event Server port 9778 is reverting back the Kodi standard in OpenPHT 1.7 of port 9777.

---

<div class="post-metadata">

**Author:** ![videotecaCNSU](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/videotecacnsu/32/17514_2.png) [@videotecaCNSU](https://forums.plex.tv/u/videotecaCNSU)\
**Post date:** [October 25, 2016, 12:41pm UTC](https://forums.plex.tv/t/wiimote-on-rasplex/163057/11 "2016-10-25T12:41:42Z")

</div>

Thanks @benjaminwolf I will have it in mind so i don´t loose my mind after an update

---

<div class="post-metadata">

**Author:** ![videotecaCNSU](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/videotecacnsu/32/17514_2.png) [@videotecaCNSU](https://forums.plex.tv/u/videotecaCNSU)\
**Post date:** [November 14, 2016, 5:14pm UTC](https://forums.plex.tv/t/wiimote-on-rasplex/163057/12 "2016-11-14T17:14:07Z")

</div>

If anyone its interested I finished my plugin  
you can [find it here](https://forums.plex.tv/discussion/245052/wiimote-control-for-rasplex-addon-v0-4 "find it here")

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [January 8, 2020, 7:25pm UTC](https://forums.plex.tv/t/wiimote-on-rasplex/163057/13 "2020-01-08T19:25:50Z")

</div>


