Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Aug 2018 15:17:34 -0700
From:      Conrad Meyer <cem@freebsd.org>
To:        Johannes Lundberg <johalun0@gmail.com>
Cc:        freebsd-current <freebsd-current@freebsd.org>
Subject:   Re: acpiconf -s 3 does not call acpi sleep event handlers
Message-ID:  <CAG6CVpXet_qvEOVUihoOT7wrFoJWrrsAG%2BqDk6ynedF8iTZ4PQ@mail.gmail.com>
In-Reply-To: <CAECmPwvT-WcTPY7hKMxavbvk6orw3fanLe%2B7zZhqSU-5bkRCxw@mail.gmail.com>
References:  <CAECmPwt7sU4TUNiLuCvvJpkuO8WV_D7qTzK_fXtUzOQZzEijiQ@mail.gmail.com> <CAG6CVpVtzr=7rtVwPh6EDSk2=%2BH_dsSxb=HW=VvDO4t3NLpRew@mail.gmail.com> <CAECmPwu16DAh5kp=nOLjjSttVaEjZheNzfPkf0vO-U3-Xk0jtg@mail.gmail.com> <CAG6CVpUuRsjoN2vHHNMwFVgk54tYMoC457Q%2BjX_UK9%2BPt%2BqReA@mail.gmail.com> <CAECmPwvT-WcTPY7hKMxavbvk6orw3fanLe%2B7zZhqSU-5bkRCxw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
I don't understand the concern.  There is only one listener to the
event and it just invokes ReqSleepState, which is responsible for
performing all suspend behavior.  The behavior is identical between
lid close and acpiconf.

On Wed, Aug 1, 2018 at 3:00 PM, Johannes Lundberg <johalun0@gmail.com> wrot=
e:
>
>
> On Wed, Aug 1, 2018 at 22:55 Conrad Meyer <cem@freebsd.org> wrote:
>>
>> ReqSleepState is the routine that takes care of suspend, not the
>> eventhandler.  I'm not sure what difference the proposed change is
>> supposed to make.
>
>
> Listeners to acpi_sleep_event don=E2=80=99t get the event when suspending=
 with
> acpiconf (but they do when suspending via lid or sleep button).
>
> I think one would expect the same behavior when suspending via command li=
ne
> or physical switch.
>
>
>>
>>
>> Best,
>> Conrad
>>
>> On Wed, Aug 1, 2018 at 2:48 PM, Johannes Lundberg <johalun0@gmail.com>
>> wrote:
>> >
>> >
>> > On Wed, Aug 1, 2018 at 9:15 PM Conrad Meyer <cem@freebsd.org> wrote:
>> >>
>> >> It seems deliberate, although the commit message does not call it out
>> >> and the event is perhaps poorly named.  The event currently indicates
>> >> that the lid was closed.  And the final registered eventhandler for
>> >> the event calls ReqSleepState.
>> >>
>> >> The ReqSleepState routine, as well as the userspace ioctl that
>> >> 'acpiconf -s' uses (which just invokes ReqSleepState directly, rather
>> >> than invoking the acpi sleep event), were introduced together in
>> >> r170976.
>> >>
>> >
>> > Unless there's a way of calling suspend properly from the cli (zzz use=
s
>> > acpiconf...) maybe something like this makes more sense to get the sam=
e
>> > behavior on for example lid close as zzz or acpiconf -s 3? (untested)
>> >
>> > diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
>> > index c1bfd880c89..87b506d6bf5 100644
>> > --- a/sys/dev/acpica/acpi.c
>> > +++ b/sys/dev/acpica/acpi.c
>> > @@ -3700,7 +3700,8 @@ acpiioctl(struct cdev *dev, u_long cmd, caddr_t
>> > addr,
>> > int flag, struct thread *t
>> >      case ACPIIO_REQSLPSTATE:
>> >         state =3D *(int *)addr;
>> >         if (state !=3D ACPI_STATE_S5)
>> > -           return (acpi_ReqSleepState(sc, state));
>> > +               return ACPI_SUCCESS(AcpiOsExecute(OSL_NOTIFY_HANDLER,
>> > +                       acpi_invoke_sleep_eventhandler, &state)) ? 0 :
>> > ENXIO;
>> >         device_printf(sc->acpi_dev, "power off via acpi ioctl not
>> > supported\n");
>> >         error =3D EOPNOTSUPP;
>> >         break;
>> >
>> >
>> >>
>> >> Best,
>> >> Conrad
>> >>
>> >> On Wed, Aug 1, 2018 at 8:05 AM, Johannes Lundberg <johalun0@gmail.com=
>
>> >> wrote:
>> >> > Hi
>> >> >
>> >> > As the title says, callbacks registered with
>> >> > EVENTHANDLER_REGISTER(acpi_sleep_event, ....
>> >> > does not get called when calling acpiconf -s 3.
>> >> > They do however, when suspending with lid or sleep button.
>> >> >
>> >> > Is this deliberate or an oversight?
>> >> >
>> >> > Cheers
>> >> > _______________________________________________
>> >> > freebsd-current@freebsd.org mailing list
>> >> > https://lists.freebsd.org/mailman/listinfo/freebsd-current
>> >> > To unsubscribe, send any mail to
>> >> > "freebsd-current-unsubscribe@freebsd.org"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpXet_qvEOVUihoOT7wrFoJWrrsAG%2BqDk6ynedF8iTZ4PQ>