Mouse keymapping not working
#1
Hello everyone,

I am running Kodi Leia on a Raspberry Pi and would llike to map my mouperly.
I would like my wheel to work lllllike the normal left/right on a remote control and also use my buttons 4 & 5 as left and right.
I would also like to prevent mouse movement from showing the OSD and would like to use my mouse wheel button as play/pause.

I created a mouse.xml based on the wiki but it seems that this Mouse.xml is being ignored.

I placed it in /home/pi/.kodi/userdata and in /home/pi/.kodi/userdata/keymaps, but both were ignored. I tried calling it keeeeeeeeymap.xml and Mouse.xml. Both were ignored. Am I doing something wrong?
I also instlled comput as peripheral in the settings menu and set my button 4 and 5.

Here is my xml
xml:
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file contains the mapping of mouse keys to actions within Kodi.                 -->
<!--                                                                                      -->
<!-- The format is:                                                                       -->
<!--  <window>                                                                            -->
<!--    <device>                                                                          -->
<!--      <button>action</button>                                                         -->
<!--    </device>                                                                         -->
<!--  </window>                                                                           -->
<!--                                                                                      -->
<!-- The <global> section is a fall through - they will only be used if the button is     -->
<!-- not used in the current window's section.                                            -->
<!--                                                                                      -->
<!-- Actions can be built-in functions.                                                   -->
<!--  eg <middleclick>ActivateWindow(Music)</middleclick>                                 -->
<!-- would automatically go to Music on the press of the middle mouse button.             -->
<!--                                                                                      -->
<!--                                                                                      -->
<!-- An empty action removes the corresponding mapping from default and parent keymaps.   -->
<!-- This is different from a "noop" action, which disables a button.                     -->
<!--                                                                                      -->
<!--  Button Ids:                                                                         -->
<!--    0: left                                                                           -->
<!--    1: right                                                                          -->
<!--    2: middle                                                                         -->
<!--    3/4/5/6: extra                                                                    -->
<!--                                                                                      -->
<!-- More documentation on keymaps can be found on http://kodi.wiki/view/keymaps          -->
<keymap>
  <global>
    <mouse>
      <leftclick>leftclick</leftclick>
      <rightclick>rightclick</rightclick>
      <middleclick>pause</middleclick>
      <doubleclick id="0">doubleclick</doubleclick>
      <longclick id="0">contextmenu</longclick>
      <longclick id="2">Menu</longclick>  <!-- access to the blade menu via long right-click -->
      <wheeldown>wheeldown</wheeldown>
      <wheelup>wheelup</wheelup>
      <mousedrag>mousedrag</mousedrag>
      <mousedragend>mousedragend</mousedragend>
      <mousemove>mousemove</mousemove>
      <click id="4">left</click id="4">
      <click id="5">right</click id="5">
    </mouse>
  </global>
  <FullScreenVideo>
    <mouse>
      <mousedrag>noop</mousedrag>
      <mousemove>noop</mousemove>
      <wheeldown>left</wheeldown>
      <wheelup>right</wheelup>
      <click id="4">left</click id="4">
      <click id="5">right</click id="5">
    </mouse>
  </FullScreenVideo>
  <VideoMenu>
    <mouse>
      <wheeldown>left</wheeldown>
      <wheelup>right</wheelup>
      <click id="4">left</click id="4">
      <click id="5">right</click id="5">
    </mouse>
  </VideoMenu>
  <VideoOSD>
    <mouse>
      <wheeldown>left</wheeldown>
      <wheelup>right</wheelup>
      <click id="4">left</click id="4">
      <click id="5">right</click id="5">
    </mouse>
  </VideoOSD>
</keymap>
Reply
#2
If you're running Kodi under user Pi, then /home/pi/.kodi/userdata/keymaps would be the appropriate place for it. The file naming doesn't actually strictly matter, as any valid xml file in that folder should be read in. The only point about file naming is that any and all keymaps in that folder should be read, and will be done so in alphabetical order, so if there are assignments to the same key in two or more of the maps, the last one will "win" (as it's the last one loaded, all the others will be overwritten by it).

First thing to do is grab a debug log (wiki), upload it to the paste site linked below and post the link here. That shows all keymaps that are being loaded, so it can be confirmed if the file is indeed being loaded or if there's an issue there.
|Banned add-ons (wiki)|Forum rules (wiki)|VPN policy (wiki)|First time user (wiki)|FAQs (wiki) Troubleshooting (wiki)|Add-ons (wiki)|Free content (wiki)|Debug Log (wiki)|

Kodi Blog Posts
Reply
#3
And here is the Mouse.xml from /home/pi/.kodi/userdata/addon_data/peripheral.joystick/resources/buttonmaps/xml/application
xml:
<?xml version="1.0" ?>
<buttonmap>
    <device name="Mouse" provider="application">
        <controller id="game.controller.mouse">
            <feature name="button4" mouse="button4" />
            <feature name="button5" mouse="button5" />
            <feature name="left" mouse="left" />
            <feature name="middle" mouse="middle" />
            <feature name="right" mouse="right" />
            <feature name="wheeldown" mouse="wheeldown" />
            <feature name="wheelup" mouse="wheelup" />
        </controller>
    </device>
</buttonmap>
Reply
#4
Upload the requested debug log (wiki), then we can see what's being loaded from where and in what order.

Once we know that then hopefully we can get things sorted for you.
|Banned add-ons (wiki)|Forum rules (wiki)|VPN policy (wiki)|First time user (wiki)|FAQs (wiki) Troubleshooting (wiki)|Add-ons (wiki)|Free content (wiki)|Debug Log (wiki)|

Kodi Blog Posts
Reply
#5
Thank you

https://paste.kodi.tv/saqibowudi.kodi
Reply
#6
Your file is invalid, see lines 507-522:

Code:
2021-01-03 17:09:43.952 T:2973047904    INFO: load keymapping
2021-01-03 17:09:43.954 T:2973047904    INFO: Loading special://xbmc/system/keymaps/appcommand.xml
2021-01-03 17:09:43.954 T:2973047904    INFO: Loading special://xbmc/system/keymaps/customcontroller.AppleRemote.xml
2021-01-03 17:09:43.955 T:2973047904    INFO: Loading special://xbmc/system/keymaps/customcontroller.Harmony.xml
2021-01-03 17:09:43.957 T:2973047904    INFO: Loading special://xbmc/system/keymaps/gamepad.xml
2021-01-03 17:09:43.958 T:2973047904    INFO: Loading special://xbmc/system/keymaps/joystick.xml
2021-01-03 17:09:43.960 T:2973047904    INFO: Loading special://xbmc/system/keymaps/keyboard.xml
2021-01-03 17:09:43.965 T:2973047904    INFO: Loading special://xbmc/system/keymaps/mouse.xml
2021-01-03 17:09:43.966 T:2973047904    INFO: Loading special://xbmc/system/keymaps/remote.xml
2021-01-03 17:09:43.969 T:2973047904    INFO: Loading special://xbmc/system/keymaps/touchscreen.xml
2021-01-03 17:09:43.970 T:2973047904    INFO: Loading special://masterprofile/keymaps/Mouse.xml
2021-01-03 17:09:43.971 T:2973047904   ERROR: Error loading keymap: special://masterprofile/keymaps/Mouse.xml, Line 43
                                            Error reading end tag.
2021-01-03 17:09:43.972 T:2973047904    INFO: Loading special://profile/keymaps/Mouse.xml
2021-01-03 17:09:43.973 T:2973047904   ERROR: Error loading keymap: special://profile/keymaps/Mouse.xml, Line 43
                                            Error reading end tag.
2021-01-03 17:09:43.973 T:2973047904    INFO: GUI format 1360x768, Display 1360x768 @ 60.000000 Hz

I can't see anything wrong in the file structure as you posted it here originally, but maybe check you don't have any hidden characters or incorrect carriage return/line feed entries in it or anything like that.

Edited to add - something to test, try changing all the lines like <click id="4">left</click id="4"> to <click id="4">left</click> . You don't need the id in the closing braces, and it might be confusing things.
|Banned add-ons (wiki)|Forum rules (wiki)|VPN policy (wiki)|First time user (wiki)|FAQs (wiki) Troubleshooting (wiki)|Add-ons (wiki)|Free content (wiki)|Debug Log (wiki)|

Kodi Blog Posts
Reply
#7
Hi,
I was just about to reply that the /click was wrong.

Now I have two issues left:
1. ERROR: Keymapping error: no such action 'mousedragend' defined

2. More importantly: 
xml:
      <wheeldown>left</wheeldown>
      <wheelup>right</wheelup>
      <middleclick>pause</middleclick>
      <click id="4">left</click>
      <click id="5">right</click>
The "left" and "right" command do not do the same as  a remote control would do, i.e. jump by the amount of  seccnds defined in the settings (e.g. 10 sec, 60 sec, 3min, 10 min).

3. MiddleClick does not work in VideoFullscreen, only when OSD/Videoplayer Keys is shown
Reply
#8
If you look in the default remote keymap, you'll see

Code:
<left>StepBack</left>
<right>StepForward</right>

Left and right are keypresses, not actions, hence why they won't work with a mouse. Try replacing your left and right with StepBack and StepForward.

Not sure about mousedragend, as it's certainly valid (see the line <mousedragend>mousedragend</mousedragend> in the default mouse keymap (here).

But if your definition is the same as the one in the default keymap then you can remove it. As noted before, the keymaps are loaded in sequence (defaults and then user defined ones), with the any duplication of commands meaning that the earlier loaded definitions are overwritten by the later ones (this is why default is loaded first, so that the user maps are basically extensions and changes to it).
|Banned add-ons (wiki)|Forum rules (wiki)|VPN policy (wiki)|First time user (wiki)|FAQs (wiki) Troubleshooting (wiki)|Add-ons (wiki)|Free content (wiki)|Debug Log (wiki)|

Kodi Blog Posts
Reply

Logout Mark Read Team Forum Stats Members Help
Mouse keymapping not working0