From owner-freebsd-current@freebsd.org Wed Aug 1 21:49:02 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 8CBE0106A14A for ; Wed, 1 Aug 2018 21:49:02 +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 09E0D89B96; Wed, 1 Aug 2018 21:49:02 +0000 (UTC) (envelope-from johalun0@gmail.com) Received: by mail-wm0-x244.google.com with SMTP id o18-v6so239420wmc.0; Wed, 01 Aug 2018 14:49:01 -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=VJsoTYW5cciU+nWA2ojgW0VMCh2FcgIW+S+MUtZCeQo=; b=NEII1f0hKrnGCltoprBlvbcBApAZIAtdx03xYeN0EVoDnS7nRqf0+dyGfOjb+LD2DE MoHsUdnkHA9TZhrvlnhQ7KwiaV8cjmquu3uVcufzemGR5OHej0gLTHQjEQtRljP2bMVY er61N6Y7TNUIZWn7V+JFMKI3p68V5tf9hRWbRxugjQgDhRCu2HX7GncajVpgRQFn752N Hvbd2HN9GyS2S9PpNALrbTvalSrLN5kii1f9H78rvCnTnRytQr4FrPwo8HGj1+ekUnTT S4TT0gz++4JbY3henlw55Klx7KHZFQDAiNi/ulshjQk0nOZ4NwVHrNuurjlgVSNf99ny MeFA== 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=VJsoTYW5cciU+nWA2ojgW0VMCh2FcgIW+S+MUtZCeQo=; b=sddPneHPqM1ZfIa0jXUrhKYGByy+FhczQ1D57RHU1uLY+MFA+abOkUJ6rS2EJrT1iw tDs8NHONazWVyetabhmHAhBE4U6OXkO+JVaXY9R0gPALrdu1ADn1N9zC3l1BwSSd3Tro wEQv5vSqzRc4C6LkSARU4b7hsFMoUU9TRie7a6b+AZKSk7DZwyuYMpBLebxrG3mcuZVR eyXM1TfEcdNjObLTXnan/P6ENpsrT+63OGYTPCg3dPtv4oEb7WsnUknuie8Hq9FPy3zj witfpc11I9EvnWw+cSf58PNV+4T/ot2fpUSxrpA2ZAH8qLTiFBIeYMsJIScg/aPwoH3z EnDw== X-Gm-Message-State: AOUpUlFqzuuPklhJheOEQnXYTdFGZobiFQ4BiSexVDVLLtKqGhunx9Pn SOLT4LpOOXjtiioAddx4A24jUtVq5QlH09T+GVYUhHEy X-Google-Smtp-Source: AAOMgpcmEwDjP80Fm0we7hZxpLgfRjg1+YP3/tRxouNhewhchJpqy8RoqzYBBKE7G53hrRdO7wKR5BUPhQ+scA1A9wA= X-Received: by 2002:a1c:c912:: with SMTP id f18-v6mr155961wmb.73.1533160140889; Wed, 01 Aug 2018 14:49:00 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Johannes Lundberg Date: Wed, 1 Aug 2018 22:48: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" 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 21:49:02 -0000 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 = *(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 > 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" >