Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Picade-HAT from Pimoroni not being detected by Kodi 17+ #90

Closed
Zurkeyon opened this issue Mar 10, 2017 · 8 comments
Closed

Picade-HAT from Pimoroni not being detected by Kodi 17+ #90

Zurkeyon opened this issue Mar 10, 2017 · 8 comments

Comments

@Zurkeyon
Copy link

Zurkeyon commented Mar 10, 2017

After Trying to Edit the Keymappings in multiple locations I am hitting a dead end.
The Picade-HAT acts like a keyboard and emulates keyboard commands, and for some reason its just totally inactive in Kodi.

I am assuming it needs a config file or a Profile.

I have tried the cat /proc/bus/input/devices and the Device Name is shown as "Picade-HAT" and I have tried to add this device to all the keymappings I could find.

Still no luck.

when I try to map any of the buttons or axis in Kodi it just fails to see the Picade at all. :-(

@garbear
Copy link
Member

garbear commented Mar 10, 2017

Can you press a few buttons while Kodi is running and upload the complete log?

@Zurkeyon
Copy link
Author

Zurkeyon commented Mar 10, 2017

Here is my Log, Thanks for taking a look :-)
HTTPS://PASTE.UBUNTU.COM/24152189

I opened Kodi, Pressed a few buttons on my RII Bluetooth Keyboard, (Shows as Mini Keyboard in devices) and then pressed every key on the picade hat.

I also moved the Joystick in all directions. Just to see if its showing anything.

Additionally, last night I tried mapping by key ID, and that also did not work. As I can get the Key IDs from showkey no problem.

Map of my Key IDs:

Up = 103
Down = 108
Left = 105
Right = 106

A = 56
B = 42
X = 29
Y = 57
L = 44
R = 45
LT = 28
RT = 1
Select/Coin = 6
Start = 2

So I Tried:

<?xml version="1.0" encoding="UTF-8"?>
<keymap>
  <global>
    <keyboard name="Picade-HAT">
      <key id="29">Select</key>
      <key id="56">Back</key>
      <key id="106">Right</key>
      <key id="105">Left</key>
      <key id="103">Up</key>
      <key id="108">Down</key>
    </keyboard>
  </global>
</keymap>

But that got me nowhere. As All controls stopped working. Even on my other keyboard. So I replaced those maps with the backups.

That is where I am now. RII works fine, Picade controls using the exact same key IDs are not being recognized.

Also, here are the results of cat /proc/bus/input/devices

I: Bus=0003 Vendor=0001 Product=0001 Version=0001
N: Name="Picade-HAT"
P: Phys=py-evdev-uinput
S: Sysfs=/devices/virtual/input/input2
U: Uniq=
H: Handlers=sysrq fbd event2
B: PROP=0
B: EV=3
B: KEY=1680 0 3003400 30000046

Please let me know if you need anything removed from the image, or if you need any additional information. I have tried to remove all repos and addons, as this was a downloaded Attract mode image from the web.

Also I have tried deleting the /home/pi/.kodi and /home/pi/kodi and the /home/pi/krypton folders to try and get a cleaner install.

Happy to do whatever is needed.

Thank you Very much in Advance for any assistance you can provide!

-Z-

@Zurkeyon
Copy link
Author

https://paste.ubuntu.com/24153977/

Cleaner log.

Removed the .kodi folder and installed from command line.

Nice and Clean. Same Result though :-(

Thanks for adding it to the list for 17.1. Much appreciated.

:-)

@garbear
Copy link
Member

garbear commented Apr 8, 2017

@Zurkeyon I've chewed through the bugs above yours on the list, and now I'm able to get your Picade-HAT working in RetroPlayer.

Keyboard handling is tricky in Kodi. The legacy system, using the keyboard.xml keymap, only works for GUI actions. When a game is fullscreen, unless the game supports keyboard (like DOSBox), Kodi intercepts keyboard input and translates it to an emulated joystick.

To enable this, there's a section in Settings -> Games -> Keyboard for configuring devices that use keyboard drivers. The configuration is stored in the peripheral.joystick add-on at resources/buttonmaps/xml/application.

Later today, I'm going to add keyboard button maps to match the RetroArch default keyboard buttons. I wouldn't be surprised if the Picade-HAT was configured to use RetroArch controls by default. If so, then our work is done. If not, then we could change the key mapping in the Picade config so that the Picade can work in Kodi without additional configuration.

EDIT: If you just want Picade-HAT to work in Kodi (without RetroPlayer) then you'll need to fix your keyboard.xml keyboard. Try removing the name="Picade-HAT"> part.

@Zurkeyon
Copy link
Author

Zurkeyon commented Apr 9, 2017

Thank you for looking into this. I very much appreciate it!

I am not actually 100% sure how to generate that keyboard.xml and I cannot remember where it is located.

Does it just need to contain what i wrote above and edit out the part you suggested?

Was I really that close?

I'm still new to linux and editing config files, but I am learning my way around a bit.

If I was that close to a working solution I could kick myself :-)

(Or is/was it some change you needed to make that makes what I was doing work? I'm sorry I'm just trying to better understand why what I was doing didn't get me working.)

Thank you a TON! Seriously.

-Z-

@garbear
Copy link
Member

garbear commented Apr 9, 2017

have you tried to configure the picade hat to match the existing keyboard.xml keymap? It looks like you can configure the hat with these scripts. You can set each button to send the key press corresponding to the Kodi action you want.

Your xml should look like the existing keyboard.xml keymap, e.g.:

<keymap>
  <global>
    <keyboard>
      <return>Select</return>
      <left>Left</left>
      <right>Right</right>
      <up>Up</up>
      <down>Down</down>
      <key id="65446">Back</key>
    </keyboard>
  </global>
</keymap>

You can see that each action uses the key name for its tag, except for keys that don't have a key name. If you need to find the key id, search your log for the word "key".

@ecdsa521
Copy link

ecdsa521 commented Dec 19, 2018

Just found out how to fix it, but have no idea why it fixes it. Thought I have to share. Nothing else worked.

If you read from /dev/input/event2 (eg. cat) it will suddenly start working in kodi.

So I just added something like this on top of /usr/bin/kodi script

head -n1 /dev/input/event2 > /dev/null &

Then its detected as normal keyboard and you can configure it with eg. keymap editor addon.

@garbear
Copy link
Member

garbear commented Dec 26, 2018

Thanks for returning with your solution!

@garbear garbear closed this as completed May 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants