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

Already on GitHub? Sign in to your account

Add support for the power and sleep buttons #2077

Merged
merged 4 commits into from Jan 17, 2013

Conversation

Projects
None yet
7 participants
Member

jhsrennie commented Jan 15, 2013

This applies to Linux (and presumably OSX):

The power button was already handled but there was no mapping for it in keyboard.xml. The sleep button on the Nyxboard remote (and presumably others) was not handled. This commit addresses both issues.

All this SDL nonsense will be gone when we merge elupus and FernetMenta's changes, but for Frodo we still need to patch up keys not properly handled by SDL.

Member

opdenkamp commented Jan 15, 2013

15:01:16 T:3046930944   DEBUG: Keyboard: scancode: 46, sym: 011d, unicode: 0000, modifier: 0
15:01:16 T:3046930944   DEBUG: OnKey: f4 (f093) pressed, action is ContextMenu

15:01:32 T:3046930944   DEBUG: Keyboard: scancode: 96, sym: 1008ff2f, unicode: 0000, modifier: 0
15:01:32 T:3046930944   DEBUG: GetActionCode: Trying Hardy keycode for 0xf200
15:01:32 T:3046930944   DEBUG: Previous line repeats 3 times.
15:01:32 T:3046930944   DEBUG: OnKey: 0 (f200) pressed, action is

so f4 works, power doesn't. this is on openelec's current master

Member

FernetMenta commented Jan 15, 2013

@opdenkamp OE has already dropped SDL. I add the mapping to WinEventsX11 once this is merged and XBMCK_SLEEP is available.

Member

opdenkamp commented Jan 15, 2013

hmm sdl was dropped from OE and xbmc wasn't updated after this? or did i miss some patch?

Contributor

davilla commented Jan 15, 2013

OE massively patches XBMC :)

Contributor

davilla commented Jan 15, 2013

Note that SDL nonsense will still be present until it's removed from OSX.

Member

jhsrennie commented Jan 16, 2013

Am I OK to merge this today?
If nothing crawls out of the woodwork I'll ask the commits to be merged into Frodo.

Contributor

davilla commented Jan 16, 2013

fixes only in frodo at this stage.

Member

jhsrennie commented Jan 16, 2013

Ah, OK. I'll merge anyway in case there is a 12.1 release. This code won't be needed when SDL is removed, which will presumably be in 13.0.

Member

opdenkamp commented Jan 16, 2013

works fine, and merge it into frodo 12.0 too please, or people with the nyxboard will have 2 buttons on the remote that don't work properly

Member

da-anda commented Jan 16, 2013

10:23:48 T:1584   DEBUG: Keyboard: scancode: 3e, sym: 011d, unicode: 0000, modifier: 0
10:23:48 T:1584   DEBUG: CApplication::OnKey: f4 (f093) pressed, action is
10:23:48 T:1584   DEBUG: Keyboard: scancode: 3d, sym: 011c, unicode: 0000, modifier: 0
10:23:48 T:1584   DEBUG: CApplication::OnKey: f3 (f092) pressed, action is
10:23:52 T:1584   DEBUG: Keyboard: scancode: 41, sym: 0120, unicode: 0000, modifier: 0
10:23:52 T:1584   DEBUG: CApplication::OnKey: f7 (f096) pressed, action is
...
10:24:22 T:1584   DEBUG: WM_POWERBROADCAST: PBT_APMSUSPEND event was sent

Somehow the nyxboard keymap is ignored for me. Might it be due to "remote sends keyboard presses" setting? Also the power button didn't trigger any keypress detection in XBMC but directly the WM_POWERBROADCAST above. Same line shows up when I press the power button on the mainboard. Windows 7x64 that is.

Member

opdenkamp commented Jan 16, 2013

nyxboard's custom keymap is another issue. @Memphiz mailed me about that

Member

Voyager1 commented Jan 16, 2013

just to double check: first, this doesn't apply to Windows power buttons, right? and second, why do we need the F4 mapping, as "c" does the same thing? I'm using F4 on Windows for another purpose through custom key map (shutdown xbmc, triggered from eventghost). EDIT - ignore the F4 thing, just saw it's Nyxboard specific...

Member

da-anda commented Jan 16, 2013

@Voyager1 <f4> is the [user] button on the Nyxboard and the f4 mapping only applies for it (or at least should)

Member

opdenkamp commented Jan 16, 2013

f4 only applies to nyxboard

Member

jhsrennie commented Jan 16, 2013

NB these changes only apply to Linux (and possibly OSX) because on Linux SDL does not properly handle the power and sleep keypresses.

@da-anda: it might be an idea to handle the Windows WM_POWERBROADCAST message and make it generate a keypress so it's handling can be customised by the user. However that's a patch for another day.

Owner

Memphiz commented Jan 16, 2013

+1 from - with this i'm able to fix the sleep button of the nyxboard on osx aswell. (if we get that keymap to load at some point :D )

Memphiz added a commit that referenced this pull request Jan 16, 2013

Member

jhsrennie commented Jan 17, 2013

Incidentally, this fix works with other remotes as well. For example it make the power button work on the VRC-1100, which is a popular low end remote.

jhsrennie pushed a commit that referenced this pull request Jan 17, 2013

Merge pull request #2077 from jhsrennie/sleepkey
Add support for the power and sleep buttons

@jhsrennie jhsrennie merged commit 7d4b8a8 into xbmc:master Jan 17, 2013

Owner

Memphiz commented Jan 17, 2013

For not loading the nyxboards custom keymap i have found out that the problem for me was a stale per-device-setting file (its located in userdata/peripheral_data or something). I deleted that xml file for my nyxboard (its called vid_pid.xml or so) and reset the nyxboard settings and it then started to load the custom keymap.

Member

jhsrennie commented Jan 17, 2013

Thanks, it's good to know it works on OSX as well. I've requested (on my knees :-) the commits be merged into Frodo.

Contributor

davilla commented Jan 17, 2013

stick it in the frodo backport list

Member

da-anda commented Jan 18, 2013

I think I have some issues with this commit. My Nyxboard is showing the shutdown menu now when I try to change the volume or play/pause the media. Will test with a nightly tomorrow, just to be sure. Windows this is.

Member

da-anda commented Jan 18, 2013

nvm, seems it was a broken build. Nightly is working fine. Sorry for wrong alert.

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