From owner-freebsd-current@freebsd.org Wed Aug 1 22:00:36 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB252106A6FE for ; Wed, 1 Aug 2018 22:00:35 +0000 (UTC) (envelope-from johalun0@gmail.com) Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6ECC78A3E7; Wed, 1 Aug 2018 22:00:35 +0000 (UTC) (envelope-from johalun0@gmail.com) Received: by mail-wm0-x244.google.com with SMTP id s12-v6so267513wmc.0; Wed, 01 Aug 2018 15:00:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jG81iVeJvAIaZ9DeYF6SyH1Boi3s/cp5TYO4tFXc/vI=; b=KezBZRQ8W0FlLYo84fKf6CW7K1P7tSMss9EBiBc+2QZ4XbZNg5Qd4rcgecLZ6plVJv nGzilAIU7h4Av8OnbkTFFe0JO458NsLzB87oF5RZJW2mG2C3UiYa0nImm6DkvOJBfGei iEZOV82kiHJ2qDWMIiA9pIuqkWKfNiHhICCSCPqXcpaOj3KOHxF+IEFyflspNCCksB+G vu5UVnylsu32pj6h8K8JMvGHsGnWbX9fgPTa5ZRuIp2TIqn+KerfVaTnFrXeq3u617K1 72L0aWj1/Gj7Cp0aH6CeqP3tJP/iymblexN6nXWTLsBqItyaJrl56v0lA8WqKPdsDRmR MVbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jG81iVeJvAIaZ9DeYF6SyH1Boi3s/cp5TYO4tFXc/vI=; b=sZPAuVJoXbpf/+3RV+vhbDQURSIc1BLlYP6Fj7ol7dCji8qzePHCPsQWf8Ztpa0zZ0 ESCTAw8q8W6hyNl7vHP5IwCjnRsln+3y8oHGg67AEzvfn9dbyfn68vtocycNPP8HlPUd Jtu54uYGIiLbnG5q9H8Srd1OlXAy2js/sHHEN7H+0ad52rOq0atFxefYi6DW3OReBIOd 8vznHm2RpzmisyPvPc49eMEYwHzT27+9hFMzwksOn18yg9BQwZjxRlLq85U/OfUq2cjo qzocamtKeRFXVek64HOO1jjE6Y3viJ1JAhSNB7M0LnBgN/xprJ5sLdBgsl9COVNeVgXK Dl5A== X-Gm-Message-State: AOUpUlEWoNEoneBM8baJi2F6CrRucq5oy5gqjBnBTLltIlGacfvH2bzo 9ZTmawrXeWMIR6JRBXmoxhoZ3IUxJk9gxd9Q2pjgqQ== X-Google-Smtp-Source: AAOMgpf4kdjWPF9OHf5L3Hn7R8/n5PquBQhUMoZJqcdeTuWU65ZC5WxD0s94SXb16NFS0uTxpjBkIbP0R/c3KzGAq4U= X-Received: by 2002:a1c:af53:: with SMTP id y80-v6mr159129wme.55.1533160834282; Wed, 01 Aug 2018 15:00:34 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Johannes Lundberg Date: Wed, 1 Aug 2018 23:00:23 +0100 Message-ID: Subject: Re: acpiconf -s 3 does not call acpi sleep event handlers To: cem@freebsd.org Cc: freebsd-current Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Aug 2018 22:00:36 -0000 On Wed, Aug 1, 2018 at 22:55 Conrad Meyer 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 w= ith acpiconf (but they do when suspending via lid or sleep button). I think one would expect the same behavior when suspending via command line or physical switch. > > Best, > Conrad > > On Wed, Aug 1, 2018 at 2:48 PM, Johannes Lundberg > wrote: > > > > > > On Wed, Aug 1, 2018 at 9:15 PM Conrad Meyer 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 > > @@ -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 > >> 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" >