Add key mapping for the power button #2076

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
Member

jhsrennie commented Jan 15, 2013

On Ubuntu (I haven't tested other varients of Linux) pressing the power button while XBMC is fullscreen sends a keypress. At the moment keyboard.xml has no mapping for this keypress, so this commit adds a mapping to XBMC.Shutdown.

NB in XBMCBuntu the power button already shuts down the system. It's possible this mapping could interfere with this, but I have no way of testing this.

See http://trac.xbmc.org/ticket/10004 for the original problem report.

Member

jhsrennie commented Jan 15, 2013

Hmm, I wonder if it would be better to use ActivateWindow(shutdownmenu), or maybe leave things as they are.

I don't feel strongly about this: I'm just responding to the Trac report. Views from the team would be welcome.

Member

opdenkamp commented Jan 15, 2013

i've mapped it to shutdownmenu for the nyxboard a couple of days ago, but i don't mind changing it to xbmc.shutdown instead to match this default keymap.

Member

jhsrennie commented Jan 15, 2013

@Lars, you've used "<key id='61952'"> and 61952 is 0xF200 hex, which is generated for every unrecognised keypress. Assuming we're still talking about Linux, I've just tried my (Mk 1) Nyxboard with Ubuntu 12.10 and it generates scan code 0x96 and keysym.sym = 0x9F. This isn't recognised by XBMC, which is why you get an unknown key. To make this work we need to add a mapping for a new key e.g. "<sleep>".

Was it you added this key to the SymMappingsEvdev array in WinEventsSDL.cpp? Do you want me to add the sleep key to the keys XBMC knows about?

Member

opdenkamp commented Jan 15, 2013

right, that's wrong indeed :)

i've just checked openelec, and i'm getting another keysym value here:

Keyboard: scancode: 96, sym: 1008ff2f, unicode: 0000, modifier: 0
Member

FernetMenta commented Jan 15, 2013

Note that SDL on Linux will be history soon and it's already history for OE 3. WinEventsX11.cpp uses codes from X11/XF86keysym.h and does the mapping to XBMC_Keys. I think we don't have a XBMCK_SLEEP, do we?

define XF86XK_Sleep            0x1008FF2F
Member

jhsrennie commented Jan 15, 2013

@Lars: see https://github.com/jhsrennie/xbmc/commit/169be40560488d0e6ca9548dc694e7ca0005288e

@FernetMenta: as it stands SDL doesn't process many keys properly and we have to do a tacky fixup to convert the scan code to a keysym.sym value. The standard SDL headers don't (as far as I can see) define a constant for the sleep key so in the above commit I've just invented one. I'm not sure how this will play with OpenElec. Really, the sooner we can be rid of SDL the better, but for now we need something that works for Frodo.

Member

jhsrennie commented Jan 15, 2013

@FernetMenta: where do I find WinEventsX11.cpp? Is it in a branch or different repository? I can't see any such file in my repo here.

Member

FernetMenta commented Jan 15, 2013

@jhsrennie see #1175 SymMappingsX11[][2] in WinEventsX11.cpp

I was not aware that you are discussing this for Frodo.

Member

jhsrennie commented Jan 15, 2013

I assumed we'd want this in Frodo, or at least I assume Lars wants the Nyxboard fix in Frodo, but maybe it's too late and we should wait for 12.1.

Member

opdenkamp commented Jan 15, 2013

i'll test it and shout, so it can be included in frodo. cause i want this in for the nyxboard indeed. minor change and the power button doesn't work properly without.

Member

jhsrennie commented Jan 15, 2013

@Lars: I should probably remove the mapping from the sleep key from the Nyxboard file and put in system/keymaps/keyboard.xml as something like:

<sleep>ActivateWindow(shutdownmenu)</sleep>

Member

jhsrennie commented Jan 15, 2013

I'll close this pull request and create a new one that includes the handling of the Nyxboard sleep button

@jhsrennie jhsrennie closed this Jan 15, 2013

Member

opdenkamp commented Jan 15, 2013

indeed, already thought about that. and the one below can be changed to F4 too

Member

jhsrennie commented Jan 15, 2013

#2077

@Lars: this includes your change to the mapping for F4. can you test and let me know if this works for you.

Member

opdenkamp commented Jan 15, 2013

yeah i noticed, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment