From owner-freebsd-current@freebsd.org Wed Aug 1 22:02:43 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 2BF4F106A8E3 for ; Wed, 1 Aug 2018 22:02:43 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f65.google.com (mail-it0-f65.google.com [209.85.214.65]) (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 BCFAA8A77F for ; Wed, 1 Aug 2018 22:02:42 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f65.google.com with SMTP id g141-v6so380281ita.4 for ; Wed, 01 Aug 2018 15:02:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=sNWbDk4z+eP7pBcACPa5sojtvjkXqf1uXK0eshEUHQY=; b=pvmLT5z1CDt0Gx2HZ+hX1KNTf5tnkyHjoN8MoOjLGy+wB72GB1aTCoBtoUWWNzWxYP yLWxgpevIDLGJ2u6OqIHFYvFHtNpmecgsSh4GXyt/Ll7IY1KsanVdljtbaYaA6uUZUHA buv/guW264fqbkA0LqC+G6PIWXwx9h88ZqF1dDmRdIQaaFPUbkXOxrvLR18ofW8P0I2I cxoUfo3R13Sij9T+xCbuOodSg643NpNvA7Chcv5hm5pbZBHLQWAUIuNVVuqY6FfvxvYo 1p0esvOvbUo9NpAX24EHH4y3LF9ZZc0df+scfDu8oBxB/0LUA1J3EHXc/FjyOvJiVgEk 5Xcw== X-Gm-Message-State: AOUpUlE9V3pw1K7kpNgwQjkv6BnxbnTUFssg5OwTv6zpQ+i6UBT9Y5jD Mm431nroS3zYe5WuCW6vYs9BHBWZ X-Google-Smtp-Source: AAOMgpedI3AZYgr9mAv9ysEWOTwy/t3vpwu9dPdUlEmkBbtOHypCEF6Ll3JXSeR/h1e11zCbBLQfFw== X-Received: by 2002:a02:1103:: with SMTP id 3-v6mr110191jaf.144.1533160533598; Wed, 01 Aug 2018 14:55:33 -0700 (PDT) Received: from mail-io0-f176.google.com (mail-io0-f176.google.com. [209.85.223.176]) by smtp.gmail.com with ESMTPSA id a79-v6sm87617itc.33.2018.08.01.14.55.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Aug 2018 14:55:33 -0700 (PDT) Received: by mail-io0-f176.google.com with SMTP id q19-v6so83177ioh.11 for ; Wed, 01 Aug 2018 14:55:33 -0700 (PDT) X-Received: by 2002:a6b:4e04:: with SMTP id c4-v6mr107209iob.19.1533160533251; Wed, 01 Aug 2018 14:55:33 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 2002:a02:7e0a:0:0:0:0:0 with HTTP; Wed, 1 Aug 2018 14:55:32 -0700 (PDT) In-Reply-To: References: From: Conrad Meyer Date: Wed, 1 Aug 2018 14:55:32 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: acpiconf -s 3 does not call acpi sleep event handlers To: Johannes Lundberg Cc: freebsd-current Content-Type: text/plain; charset="UTF-8" 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:02:43 -0000 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 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 = *(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"