[LINUX] Power button ignored without HAL
#1
Hello,

I'm running xbmc 10.0 on an ArchLinux (x86), installed from the repository (Arch package version: 10.0-2). Since their last package upgrade they decided to go with upower instead of HAL for suspend and such and suspend is working fine when chosen from the menu with upower as well.

But I can't get the power button on my computer case to call the shutdown method (going to suspend for me) like it did before (with arch package version: 10.0-1, with HAL still enabled). When pressing the power button I get only this in the debug log is this:

DEBUG: SDLKeyboard: scancode: 124, sym: 0, unicode: 0, modifier: 0

Does anyone have an idea? Or is HAL required for this to work?

Kind regards,
Karsten
Reply
#2
no hal is not required (on ubuntu)

do you have policykit-1 and have added the needed permissions.
Reply
#3
https://wiki.archlinux.org/index.php/Shu...wer_Button

Doesn't work for you?
* MikroTik RB5009UG+S+IN :: ZyXEL GS1900-8HP v1 :: EAP615-Wall v1 :: Netgear GS108T v3 running OpenWrt 23.05
* LibreELEC 11:  HTPC Gigabyte Brix GB-BXA8-5545 with CEC adapter, Sony XR-64A84K :: Desktop AMD Ryzen 7 5800X / Sapphire Nitro+ Radeon 6700XT  / 27" Dell U2717D QHD
* Debian Bookworm x86_64: Celeron G1610, NFS/MariaDB/ZFS server
* Blog
Reply
#4
UPower does not emit any signal on power button press hence its not hooked up in xbmc, I'm sure its a way to do it outside xbmc though. When such a signal exist we will for sure hook it up.
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#5
in the past i have used acpid to shutdown the system. that works nice and stable but you can use only one command or shell script (see post from .:B:.). Because the power button is handled as an event input device from kernel my idea was to use eventlircd (openelec uses eventlircd as an lirc replacement) for this. it works also very great. The advantage is, because i have setup the power button with "KEY_POWER" i can use the powerbutton now to go in standby modus if i change the settings in xbmc to go to standby as poweroff method. (theoretical i can use the powerbutton now also as an play/pause button or whatever i like :-) ). i am sure it works too with lirc and /dev/input/eventX as devinput/linux-input device (without the possibility to map to *any* LIRC button code)
greetings, Stephan

Image

Image
Reply
#6
Is this maybe a more general problem? I have quite a lot of keys that I can't get to work. From xbmc.log i get:

Code:
DEBUG: SDLKeyboard: scancode: 139, sym: 0, unicode: 0, modifier: 0
DEBUG: SDLKeyboard: scancode: 144, sym: 0, unicode: 0, modifier: 0
DEBUG: SDLKeyboard: scancode: 142, sym: 0, unicode: 0, modifier: 0
DEBUG: SDLKeyboard: scancode: 141, sym: 0, unicode: 0, modifier: 0
DEBUG: SDLKeyboard: scancode: 143, sym: 0, unicode: 0, modifier: 0
DEBUG: SDLKeyboard: scancode: 220, sym: 0, unicode: 0, modifier: 0

But according to xmodmap these are all mapped to X events (from "xmodmap -pke"):
Code:
keycode 139 = Undo NoSymbol Undo
keycode 144 = Find NoSymbol Find
keycode 142 = SunOpen NoSymbol SunOpen
keycode 141 = XF86Copy NoSymbol XF86Copy
keycode 143 = XF86Paste NoSymbol XF86Paste
keycode 220 = XF86WebCam NoSymbol XF86WebCam

I suspect this actually have to do with the input parsing in libSDL but actually I have no clue!

My setup is XBMC (2:10.00~svn35648-maverick1 from the ppa) on a minimal ubuntu 10.10 install.
Reply
#7
sraue Wrote:in the past i have used acpid to shutdown the system. that works nice and stable but you can use only one command or shell script (see post from .:B:.). Because the power button is handled as an event input device from kernel my idea was to use eventlircd (openelec uses eventlircd as an lirc replacement) for this. it works also very great. The advantage is, because i have setup the power button with "KEY_POWER" i can use the powerbutton now to go in standby modus if i change the settings in xbmc to go to standby as poweroff method. (theoretical i can use the powerbutton now also as an play/pause button or whatever i like :-) ). i am sure it works too with lirc and /dev/input/eventX as devinput/linux-input device (without the possibility to map to *any* LIRC button code)

Your solution sounds very promising since I was looking for a xbmc-based solution rather than switching to acpid (which was my fallback option). Is it possible to use the lirc-based approach without changing xbmc code? I'm not sure if I understood completely what you're doing there... how do I get xbmc to handle the power button as an lirc input device? Thanks again.
Reply
#8
rocktale Wrote:Your solution sounds very promising since I was looking for a xbmc-based solution rather than switching to acpid (which was my fallback option). Is it possible to use the lirc-based approach without changing xbmc code? I'm not sure if I understood completely what you're doing there... how do I get xbmc to handle the power button as an lirc input device? Thanks again.

Dont know exactly if its really possible with lirc, because lirc is very limited with handling event devices from kernel.

thats why i use eventlircd (http://code.google.com/p/eventlircd/). let me try to explain how eventlircd works:

all lirc drivers are going now to the kernel and will be removed from lirc package in the future. with kernel 2.6.36/37 nearly all drivers are now in kernel, the most used are now IR core drivers who acts as event devices (/dev/input/eventX). only some very old drivers/ rarly used drivers are in the staging area as "old known lirc drivers".

lirc does not more then read scancodes from /dev/lircX and generates a lircd socket wich will be read from xbmc. eventlircd does in general the same, but eventlircd reads /dev/input/eventX and /dev/lircX devicenodes (the difference to lirc is eventlircd can read more then one of such devicenodes at the same time). now eventlircd translates the scancodes via an simple map file and creates an lircd socket too (which can be read from xbmc). such an mapfile looks like here: https://github.com/OpenELEC/OpenELEC.tv/...nfig/evmap. Via a udev rule i can setup the the event drivers to be used from eventlircd, eventlircd watches this devises, remaps the codes, send the information to the lircd socket - and xbmc will use them. in xbmc i only have a own "devinput" section in lircmap.xml they must not be changed. most remotes works out of the box with eventlircd (mceusb, nuvoton, imon, atiusb, atiusb2...) without much further setup.

in this way i can setup (via udev) that other /dev/input/eventX devices like the power button, the sleepbutton, an Lid switch etc... will be used with eventlircd (and with xbmc's lirc implementation).

actually in openelec lirc is not used but eventlircd will be merged soon with lirc, so in the future eventlircd will be lirc :-)
greetings, Stephan

Image

Image
Reply
#9
sraue Wrote:in this way i can setup (via udev) that other /dev/input/eventX devices like the power button, the sleepbutton, an Lid switch etc... will be used with eventlircd (and with xbmc's lirc implementation).

Thank you for the explanation. I tried building eventlircd from source but it didn't work (some linker error). Since, Arch has inputlircd already in the AUR I thought I'd give it a shot. As far as I understand, it should work as well in this case.

However, XBMC seems to ignore the device or anything I tried. At least it shows up in the debug log:

Code:
DEBUG: LIRC: Update - NEW at 175045:74 0 KEY_POWER event2 (KEY_POWER)
DEBUG: SDLKeyboard: scancode: 124, sym: 0, unicode: 0, modifier: 0

But XBMC does not react on it. I tried adding a remote section to my custom keymap, but it doesn't work either:

Code:
<remote device="event2">
      <power>XBMC.ShutDown()</power>
    </remote>

I suspect xbmc's lirc implementation does not understand the keyboard event (KEY_POWER). I also tried the "remote control sends keyboard presses" option in the xbmc settings without effect. I feel so close but not quite there... :-)
Reply
#10
Just for the record I use the acpid solution now which works fine. However, I'd like to see xbmc handling this again in the future without any *lirc tricks or whatever. The SDL event seems to be there and from what I've read there are only few pieces missing to get xbmc to recognize it as well. Maybe that would be an idea. :-) But besides that I still love what you guys are doing. And thanks again for the help.
Reply
#11
sraue Wrote:Dont know exactly if its really possible with lirc, because lirc is very limited with handling event devices from kernel.

thats why i use eventlircd (http://code.google.com/p/eventlircd/). let me try to explain how eventlircd works:
...
actually in openelec lirc is not used but eventlircd will be merged soon with lirc, so in the future eventlircd will be lirc :-)

Actually, might sound stupid, but .. how to build eventlircd ? tried to build it from svn , i can understand it might need some automake or such, but cant get it to work. Any helping hand would be appreciated Smile
Reply

Logout Mark Read Team Forum Stats Members Help
[LINUX] Power button ignored without HAL0