Re: acpiconf -s 3 does not call acpi sleep event handlers

From: Conrad Meyer <cem_at_freebsd.org>
Date: Wed, 1 Aug 2018 14:55:32 -0700
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.

Best,
Conrad

On Wed, Aug 1, 2018 at 2:48 PM, Johannes Lundberg <johalun0_at_gmail.com> wrote:
>
>
> On Wed, Aug 1, 2018 at 9:15 PM Conrad Meyer <cem_at_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 uses
> acpiconf...) maybe something like this makes more sense to get the same
> 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
> _at__at_ -3700,7 +3700,8 _at__at_ acpiioctl(struct cdev *dev, u_long cmd, caddr_t addr,
> int flag, struct thread *t
>      case ACPIIO_REQSLPSTATE:
>         state = *(int *)addr;
>         if (state != 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 = EOPNOTSUPP;
>         break;
>
>
>>
>> Best,
>> Conrad
>>
>> On Wed, Aug 1, 2018 at 8:05 AM, Johannes Lundberg <johalun0_at_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_at_freebsd.org mailing list
>> > https://lists.freebsd.org/mailman/listinfo/freebsd-current
>> > To unsubscribe, send any mail to
>> > "freebsd-current-unsubscribe_at_freebsd.org"
Received on Wed Aug 01 2018 - 20:02:43 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:17 UTC