[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Problem with systemd-sleep in Jessie



Am 24.10.2014 um 14:46 schrieb ~Stack~:
> On 10/23/2014 11:06 PM, Michael Biebl wrote:
>> That looks all fine.
>> Can you remove the settings again from logind.conf and restart
>> systemd-logind while monitoring what evtest logs and and also what
>> systemd-logind logs.
>> For the latter, you can either run systemd-logind in the foreground (as
>> I described) or use Joey's method to filter journal entries via
>> "journalctl -u systemd-logind -f"
> 
> I did as you asked. I had the F1 terminal set to start systemd-login, F2
> terminal was watching journalctl, F3 was watching evtest for input 4 (I
> also retested with the others, but similar results).
> 
> The /only/ thing that journalctl prints out is "Suspending...".
> Everything else is related to when I press the button to wake it back up.
> 
> As for the evtest, I get this message over and over again:
> Event: time <timestamp>, type 1 (EV_KEY), code 116 (KEY_POWER), value 1

So, it doesn't look like you get spurious SW_LID events.
We discussed that on #debian-systemd, and it's likely that this is
because of the change that was committed in [1]:

"logind is now a lot more aggressive when suspending the machine due to
a closed laptop lid. Instead of acting only on the lid close action, it
will continuously watch the lid status and act on it."

We suspect, that either your laptop reports an incorrect lid state or
the heuristic to determine the lid state is not correct.

I extracted the lid state switch into a small test program.
Can you compile the attach test program (make switch). I hard-coded the
lid switch button to /dev/input/input1. You'll need to change that if
that's different on your system (check with evtest). You need to run
that binary as root.

What do you get if your that program when your lid is closed/opened?

It should return 0 if the lid is open and 1 if closed.



[1]
http://cgit.freedesktop.org/systemd/systemd/commit/?id=ed4ba7e4f652150310d062ffbdfefb4521ce1054
-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
#include <stdio.h>
#include <stdint.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <linux/input.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>



int main(int argc, char **argv) {
	int fd;
	int lid_closed;
	uint8_t switches[SW_MAX/8+1] = {};

	fd = open("/dev/input/event1", O_RDONLY);
        if (fd < 0)
                return -EINVAL;

        if (ioctl(fd, EVIOCGSW(sizeof(switches)), switches) < 0)
                return -errno;

        lid_closed = (switches[SW_LID/8] >> (SW_LID % 8)) & 1;

	printf("State: %i\n", lid_closed);

	return(0);
	
}

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: