Wiimote on Rasplex

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.

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.

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)

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

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.

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

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

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

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
?

@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.

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

If anyone its interested I finished my plugin
you can find it here