! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
No choice for “hibernate” button in general settings
Status:
RESOLVED: WONTFIX
Product:
Xfce4-power-manager
Component:
General

Comments

Description Yves-Alexis Perez editbugs 2009-04-14 19:00:59 CEST
Created attachment 2293 
lshal for the system

Hey,

as said on -goodies ML, there's no choice for the “hibernate” button in the general tabs, while the hibernate button is correctly reported by hal.

lshal is attached.
Comment 1 Ali Abdallah editbugs 2009-04-14 19:19:56 CEST
(In reply to comment #0)
> Created an attachment (id=2293) [details]
> lshal for the system
> 
> Hey,
> 
> as said on -goodies ML, there's no choice for the “hibernate” button in the
> general tabs, while the hibernate button is correctly reported by hal.
> 
> lshal is attached.

I was expecting that, your hibernate button doesn't appear anywhere in hal device list, however it seems to send events, i don't know what to say here. you can see clearly in lshal output of your computer that all other buttons have udi with the specific type, but not for the hibernate button.

I could probably see if a not mapped button is producing events then enable it, what do you think?

Too much work-around for HAL.
Comment 2 Ali Abdallah editbugs 2009-05-20 14:18:41 CEST
(In reply to comment #1)
> (In reply to comment #0)
> > Created an attachment (id=2293) [details] [details]
> > lshal for the system
> > 
> > Hey,
> > 
> > as said on -goodies ML, there's no choice for the “hibernate” button in the
> > general tabs, while the hibernate button is correctly reported by hal.
> > 
> > lshal is attached.
> 

Yves, may i close this bug as i see no clean way of fixing this "HAL" bug.

BTW: did you try the latest HAL release?
Comment 3 Yves-Alexis Perez editbugs 2009-05-20 15:17:23 CEST
(In reply to comment #2)
> Yves, may i close this bug as i see no clean way of fixing this "HAL" bug.

My name is Yves-Alexis :)
> 
> BTW: did you try the latest HAL release?

Running 0.5.12~git20090406.46dc48-2 atm.
Comment 4 Ali Abdallah editbugs 2009-05-20 15:19:01 CEST
(In reply to comment #3)
> (In reply to comment #2)
> > Yves, may i close this bug as i see no clean way of fixing this "HAL" bug.
> 
> My name is Yves-Alexis :)
> > 

So Yves-Alexis :), can i close this ?
Comment 5 Yves-Alexis Perez editbugs 2009-05-20 23:31:06 CEST
It seems that the hibernate button is called “suspend” while the suspend button is called “sleep”, which may confuses hal and/or xfpm. Is it supposed to be that way? (when pressing it, it correctly sends the hibernation signal)
Comment 6 Ali Abdallah editbugs 2009-05-21 12:19:35 CEST
(In reply to comment #5)
> It seems that the hibernate button is called “suspend” while the suspend button
> is called “sleep”

Where they are called like that?

> which may confuses hal and/or xfpm. Is it supposed to be
> that way? (when pressing it, it correctly sends the hibernation signal)

I believe not, in X there is only SLEEP, HIBERNATE, POWER_OFF, there is not suspend, same for hal, in the spec they say "sleep" button press is the suspend event.

http://people.freedesktop.org/~david/hal-spec/hal-spec.html#device-properties-button
Comment 7 Yves-Alexis Perez editbugs 2009-05-21 12:27:29 CEST
(In reply to comment #6)
> (In reply to comment #5)
> > It seems that the hibernate button is called “suspend” while the suspend button
> > is called “sleep”
> 
> Where they are called like that?

In /usr/share/hal/fdi/information/10freedesktop/30-keymap-module-thinkpad-acpi.fdi
> 
> > which may confuses hal and/or xfpm. Is it supposed to be
> > that way? (when pressing it, it correctly sends the hibernation signal)
> 
> I believe not, in X there is only SLEEP, HIBERNATE, POWER_OFF, there is not
> suspend, same for hal, in the spec they say "sleep" button press is the suspend
> event.
> 
> http://people.freedesktop.org/~david/hal-spec/hal-spec.html#device-properties-button

Though, when I check for the buttons, I get:

corsac@hidalgo: lshal | grep button.type
  button.type = 'radio'  (string)
  button.type = 'lid'  (string)
  button.type = 'sleep'  (string)
  button.type = 'power'  (string)

Cheers,
Comment 8 Yves-Alexis Perez editbugs 2009-08-18 17:22:46 CEST
Hmmh, weird. I have a debian user reporting (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=542238) that on its R61 he doesn't even have the sleep button working.

I tried on a desktop box, and I can't set the action for “hibernate” (quite normal, I don't have any hibernate button on the desktop), but I *can* set an action for “suspend”. Which is weird, since I don't have any sleep button (and lshal doesn't report any button.type = sleep, only power.

I still think there are some weirdnesses on this topic :/
Comment 9 Ali Abdallah editbugs 2009-08-18 17:40:53 CEST
(In reply to comment #8)
> Hmmh, weird. I have a debian user reporting
> (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=542238) that on its R61 he
> doesn't even have the sleep button working.

I meat Maximilian few weeks ago to have a beer in Geneva, he showed me his laptop (i don't remember which model was) and neither sleep or hibernate buttons were working for him, they aren't detected by X neither by HAL, so i bet this is normal, could you ask the guy to post the content of lshal?

> 
> I tried on a desktop box, and I can't set the action for “hibernate” (quite
> normal, I don't have any hibernate button on the desktop), but I *can* set an
> action for “suspend”. Which is weird, since I don't have any sleep button (and
> lshal doesn't report any button.type = sleep, only power.

Could be that X is reporting a sleep button?, i just tried on my desktop computer, and seems that X has a Sleep button, but what is weired in my case that X is reporting two addition buttons, brightness_up and down???

You could try to compile with debug-full option and run it, it will print the keycode for you (i started to dislike this idea, i should always have debug options even if xfpm is not compiled with debug-full).

> 
> I still think there are some weirdnesses on this topic :/

Yes, that's weired, but i think part of the problem i that we have two sources, X and HAL.
Comment 10 Yves-Alexis Perez editbugs 2009-08-18 18:24:31 CEST
(In reply to comment #9)
> (In reply to comment #8)
> > Hmmh, weird. I have a debian user reporting
> > (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=542238) that on its R61 he
> > doesn't even have the sleep button working.
> 
> I meat Maximilian few weeks ago to have a beer in Geneva, he showed me his
> laptop (i don't remember which model was) and neither sleep or hibernate
> buttons were working for him, they aren't detected by X neither by HAL, so i
> bet this is normal, could you ask the guy to post the content of lshal?

lshal is at http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=15;filename=lshal.out;att=1;bug=542238

But in fact it's not the same bug. He can see the “sleep” button action in the preferences (but not hibernate), but when he presses it, nothing happens (while right click on the icon and asking for suspend does work. I'll investigate on that with him.
> 
> > 
> > I tried on a desktop box, and I can't set the action for “hibernate” (quite
> > normal, I don't have any hibernate button on the desktop), but I *can* set an
> > action for “suspend”. Which is weird, since I don't have any sleep button (and
> > lshal doesn't report any button.type = sleep, only power.
> 
> Could be that X is reporting a sleep button?, i just tried on my desktop
> computer, and seems that X has a Sleep button, but what is weired in my case
> that X is reporting two addition buttons, brightness_up and down???

Hmhm, how do you check that?
> 
> You could try to compile with debug-full option and run it, it will print the
> keycode for you (i started to dislike this idea, i should always have debug
> options even if xfpm is not compiled with debug-full).

Yeah, might be a good idea. Will try that and report back (here or on irc).
> 
> > 
> > I still think there are some weirdnesses on this topic :/
> 
> Yes, that's weired, but i think part of the problem i that we have two sources,
> X and HAL.

Yup. Thanks for your time.
Comment 11 Yves-Alexis Perez editbugs 2009-08-18 19:03:33 CEST
Ok, so the hibernate key absence is because of:

(xfce4-power-manager:623): xfce4-power-manager-CRITICAL **: could not map keysym 1008ffa8 to keycode
Comment 12 Yves-Alexis Perez editbugs 2009-08-18 21:36:25 CEST
HMh ok, so from kernel people, it seems that:

KEY_SLEEP = Suspend to ram
KEY_SUSPEND = Suspend to disk
KEY_HIBERNATE = Suspend to disk

And that my “sleep” button in hal comes from an input event I'm not sure about:

/dev/input/event5
   bustype : BUS_HOST
   vendor  : 0x0
   product : 0x3
   version : 0
   name    : "Sleep Button"
   phys    : "PNP0C0E/button/input0"
   bits ev : EV_SYN EV_KEY

and I don't have the according “Hibernate Button”.

So I needed to use the X way to do things, and for that to work I had to use attached patch.
Comment 13 Yves-Alexis Perez editbugs 2009-08-18 21:37:12 CEST
Created attachment 2510 
Correctly detect and handle hibernate
Comment 14 Yves-Alexis Perez editbugs 2009-08-19 07:42:47 CEST
Ok and it seems that there's no such thing as “ACPI Hibernate Button” in the kernel. I can only see the “lid switch”, “power button” and “sleep button”.

So I think there's no way for hal to report an “Hibernate button” (don't know about devicekit).

So I don't think there's a way to detect if there's an hibernate button or not, you'll only have to listen to the events and do the required action.

I don't know how gpm does, though.
Comment 15 Ali Abdallah editbugs 2009-08-19 09:11:31 CEST
(In reply to comment #14)
> Ok and it seems that there's no such thing as “ACPI Hibernate Button” in the
> kernel. I can only see the “lid switch”, “power button” and “sleep button”.
> 
> So I think there's no way for hal to report an “Hibernate button” (don't know
> about devicekit).

DeviceKit power has no handling for these buttons, gpm now relies on X to detect them, DeviceKit power has only lid event.

> 
> So I don't think there's a way to detect if there's an hibernate button or not,
> you'll only have to listen to the events and do the required action.
> 

I want to fix this by keeping compatibility with when we will move to have only X events, so i would say i can expose sleep suspend and hibernate buttons in the ui if they are detected by X.

Sleep : Suspend 
Suspend : Hibernate
Hibernate : Hibernate.

But i dunno about if i got Suspend and Hibernate buttons mapped by X what should i do? probably have all of these in the UI.

What do you think?
Comment 16 Yves-Alexis Perez editbugs 2009-08-19 09:30:24 CEST
Answer to your mail

>Dunno if i should ask the question here, now gpm relies completely on X 
> to map these buttons, in X there is:

> HAVE_XF86XK_SLEEP  (Suspend).

> HAVE_XF86XK_HIBERNATE
> HAVE_XF86XK_SUSPEND

> As i understood These two buttons are suspend two disk, okay, so they 
> should have the same keycode right?, or can they be two different keys?

Hmhm, looking at the logs xfpm generates on my thinkpad, no, they seem to be mapped to different keys.

I guess it might be possible to show the Hibernate configuration item if either XF86XK_HIBERNATE or XF86XK_SUSPEND gets correctly grabbed. In my case, that would fix the problem since (afair) XF86XK_SUSPEND is grabbed correctly. (and it makes sense since nothing sends KEY_HIBERNATE from the kernel).
Comment 17 Yves-Alexis Perez editbugs 2009-08-19 09:32:40 CEST
(In reply to comment #15)
> (In reply to comment #14)
> > Ok and it seems that there's no such thing as “ACPI Hibernate Button” in the
> > kernel. I can only see the “lid switch”, “power button” and “sleep button”.
> > 
> > So I think there's no way for hal to report an “Hibernate button” (don't know
> > about devicekit).
> 
> DeviceKit power has no handling for these buttons, gpm now relies on X to
> detect them, DeviceKit power has only lid event.

Ok, so I guess it's better to drop buttons support from hal too, and only use X? (that'd work only if the keycode are under 255 though, due to X problems)
> 
> > 
> > So I don't think there's a way to detect if there's an hibernate button or not,
> > you'll only have to listen to the events and do the required action.
> > 
> 
> I want to fix this by keeping compatibility with when we will move to have only
> X events, so i would say i can expose sleep suspend and hibernate buttons in
> the ui if they are detected by X.

I think we should go the X way directly. Why keeping hal stuff if it doesn't work anyway (for the buttons, not for the rest :) ).
> 
> Sleep : Suspend 
> Suspend : Hibernate
> Hibernate : Hibernate.
> 
> But i dunno about if i got Suspend and Hibernate buttons mapped by X what
> should i do? probably have all of these in the UI.
> 
> What do you think?

Like above, I guess a simple or will do. If both are mapped, fine, do Hibernate in both cases.
Comment 18 Ali Abdallah editbugs 2009-08-19 09:37:58 CEST
> Ok, so I guess it's better to drop buttons support from hal too, and only use
> X? (that'd work only if the keycode are under 255 though, due to X problems)
> 
> I think we should go the X way directly. Why keeping hal stuff if it doesn't
> work anyway (for the buttons, not for the rest :) ).

Hal is currently used in xfpm as a fallback for the power and sleep button only, will be removed completely soon.
 
> Like above, I guess a simple or will do. If both are mapped, fine, do Hibernate
> in both cases.

So exposing Hibernate configuration in the UI for both keys, if that what you means then we only need your path to fix it ;).
Comment 19 Ali Abdallah editbugs 2009-08-19 09:43:20 CEST
> So exposing Hibernate configuration in the UI for both keys, if that what you
> means then we only need your path to fix it ;).

I mean your patch, BTW, it seems that you remove the check for keycode == 0? i think just the critical should be changed to warning, but the check should be kept.
Comment 20 Yves-Alexis Perez editbugs 2009-08-19 09:49:50 CEST
(In reply to comment #19)
> > So exposing Hibernate configuration in the UI for both keys, if that what you
> > means then we only need your path to fix it ;).
> 
> I mean your patch, BTW, it seems that you remove the check for keycode == 0? i
> think just the critical should be changed to warning, but the check should be
> kept.

Yeah I removed the check because it fails on my box. But if the check if for HIBERNATE and SUSPEND, the SUSPEND will success and the config item will appear, so yeah it can be re-added :)

Cheers,
Comment 21 Ali Abdallah editbugs 2009-08-19 10:14:17 CEST
> 
> Yeah I removed the check because it fails on my box. But if the check if for
> HIBERNATE and SUSPEND, the SUSPEND will success and the config item will
> appear, so yeah it can be re-added :)
> 
> Cheers,

Applied and committed, thanks :).
Comment 22 Yves-Alexis Perez editbugs 2009-08-19 12:00:27 CEST
Cool, will try to test it tonight and report back :)
Comment 23 Yves-Alexis Perez editbugs 2009-08-19 17:15:55 CEST
Works fine, thanks!
Comment 24 Ali Abdallah editbugs 2009-08-26 10:45:44 CEST
What we are now doing is completely wrong.

According to XF86keysym.h

#define XF86XK_Suspend		0x1008FFA7   /* Sleep to RAM                */
#define XF86XK_Hibernate	0x1008FFA8   /* Sleep to disk               */

On my system, the settings dialog shows Hibernate button configuration, however i don't have a hibernate button.
Comment 25 Yves-Alexis Perez editbugs 2009-08-26 11:36:53 CEST
(In reply to comment #24)
> What we are now doing is completely wrong.
> 
> According to XF86keysym.h
> 
> #define XF86XK_Suspend        0x1008FFA7   /* Sleep to RAM                */
> #define XF86XK_Hibernate    0x1008FFA8   /* Sleep to disk               */

Hmhm, I will report that to people on the ACPI list to see what they say.
> 
> On my system, the settings dialog shows Hibernate button configuration, however
> i don't have a hibernate button.

Well, I'm not sure, I think it's because it manages to map the key even if there's none? In any case, I think it's better to have the button even if there's none than the opposite (not being able to configure it if present)
Comment 26 Ali Abdallah editbugs 2011-01-04 13:04:11 CET
I think you are running newer version of xfpm now, so i'll close this.

Bug #5230

Reported by:
Yves-Alexis Perez
Reported on: 2009-04-14
Last modified on: 2011-01-04

People

Assignee:
Ali Abdallah
CC List:
0 users

Version

Version:
Unspecified

Attachments

lshal for the system (130.26 KB, text/plain)
2009-04-14 19:00 CEST , Yves-Alexis Perez
no flags
Correctly detect and handle hibernate (1022 bytes, patch)
2009-08-18 21:37 CEST , Yves-Alexis Perez
no flags

Additional information