From owner-freebsd-questions@freebsd.org Mon Feb 17 00:04:39 2020 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 63233246E03 for ; Mon, 17 Feb 2020 00:04:39 +0000 (UTC) (envelope-from yuripv@yuripv.me) Received: from wnew1-smtp.messagingengine.com (wnew1-smtp.messagingengine.com [64.147.123.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 48LPP230pgz4Wnr for ; Mon, 17 Feb 2020 00:04:37 +0000 (UTC) (envelope-from yuripv@yuripv.me) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id D5B1947A; Sun, 16 Feb 2020 19:04:35 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sun, 16 Feb 2020 19:04:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yuripv.me; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type; s=fm1; bh=wrEb4YwsQPXho3NwmPqjfDxtCXw FeRmQ5EBBPDeEVik=; b=IcuaUPpdInCuUAI1MezHNrUnfcCcCPQJcP2Nj0XgmQH qyH+UrfhHmqFTPTj0IUK7/QgmieWNUujZfVAqyAx+vS+SNRLggGgN31/GsjUP3D4 DM3c6+CO96JxTsIoVyKcfk32oerzH3PePJstwy5nYUP+8CeQZ4IaAvZLm9lpXmUi 8IBAinidtSw0pay+Dtp1Z+Fk3dszmM4nUG+kIjt0cUMdRHWbNh+178rrMAtUCSWB FCO7TGOkjrqjM1n6Ixo4Gyo17Lj6hPmckkZaTd7xl3zx0dP9Y9HOMk4yFyks9HfD tUSeWUSOBflzjUSZn9rb4vK32ijpXN6NIbVSWQvBVMQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=wrEb4Y wsQPXho3NwmPqjfDxtCXwFeRmQ5EBBPDeEVik=; b=LlT+TeRwta/qzLYqVuLbhX Q6t+1lxvdJnqZidYojT+6+TTSIgU1MvpnFjRhvm4bk6vhE3ZAAjCdemXRMBhDhWr TahLL0kZfv2BXZoM3cgCDwQ5rqnWJEfZqIWUxdL44Fi8RqZg5uAeCIgeQH41qfs1 MdBeQowOMmOrNNLQJ3mZAMTgup1rNttiehk4YVM61UZW8jjgpRwKeLOQz5nmZ765 gznBA93W9iaLe0StIX3WoIRdzCn/bgxnVFCVkknPokDrvi7903SOhi2XJkngO8xQ dDBXbgNttbgS4ggB1+oFmm66U4iwtnqwZmzvWLSM8GJLpwFwfgoXB0qHdeghuAwQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrjeehgdduiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepuffvfhfhkffffgggjggtsehmtderre dtfeejnecuhfhrohhmpegjuhhrihcurfgrnhhkohhvuceohihurhhiphhvseihuhhrihhp vhdrmhgvqeenucffohhmrghinhepfhhrvggvsghsugdrohhrghenucfkphepudejkedrud ehhedrgedrfedunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhf rhhomhephihurhhiphhvseihuhhrihhpvhdrmhgv X-ME-Proxy: Received: from [192.168.1.6] (unknown [178.155.4.31]) by mail.messagingengine.com (Postfix) with ESMTPA id C3B683060C28; Sun, 16 Feb 2020 19:04:33 -0500 (EST) Subject: Re: Update X when laptop lip is closed To: Noah Palmer Cc: freebsd-questions@freebsd.org References: <2061301f-4f78-e50a-1864-f9a608b7c504@yuripv.me> <5fe7c2f2-9645-0c13-1878-7bbfa8f33487@yuripv.me> From: Yuri Pankov Message-ID: Date: Mon, 17 Feb 2020 03:04:32 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------48B82A192E22BF770C9228B6" Content-Language: en-US X-Rspamd-Queue-Id: 48LPP230pgz4Wnr X-Spamd-Bar: +++++++++++++ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=yuripv.me header.s=fm1 header.b=IcuaUPpd; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=LlT+TeRw; dmarc=none; spf=pass (mx1.freebsd.org: domain of yuripv@yuripv.me designates 64.147.123.26 as permitted sender) smtp.mailfrom=yuripv@yuripv.me X-Spamd-Result: default: False [13.39 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(0.00)[+ip4:64.147.123.26]; HAS_ATTACHMENT(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[yuripv.me:+,messagingengine.com:+]; CTYPE_MIXED_BOGUS(1.00)[]; RCPT_COUNT_TWO(0.00)[2]; MIME_BASE64_TEXT(0.10)[]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:+]; RCVD_IN_DNSWL_LOW(-0.10)[26.123.147.64.list.dnswl.org : 127.0.5.1]; ASN(0.00)[asn:11403, ipnet:64.147.123.0/24, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[31.4.155.178.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11]; ARC_NA(0.00)[]; RECEIVED_SPAMHAUS_XBL(5.00)[31.4.155.178.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.4]; R_DKIM_ALLOW(0.00)[yuripv.me:s=fm1,messagingengine.com:s=fm2]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain]; DMARC_NA(0.00)[yuripv.me]; NEURAL_SPAM_MEDIUM(1.00)[1.000,0]; BAD_REP_POLICIES(0.10)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(1.00)[1.000,0]; URIBL_BLACK(7.50)[yuripv.me.multi.uribl.com]; GREYLIST(0.00)[pass,meta]; IP_SCORE(-2.11)[ip: (-2.92), ipnet: 64.147.123.0/24(-4.92), asn: 11403(-2.68), country: US(-0.05)] X-Spam: Yes X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Feb 2020 00:04:39 -0000 This is a multi-part message in MIME format. --------------48B82A192E22BF770C9228B6 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Noah Palmer wrote: > On Sun, Feb 16, 2020 at 4:00 AM Yuri Pankov wrote: > >> Noah Palmer wrote: >>> On Sat, Feb 15, 2020 at 11:08 PM Yuri Pankov wrote: >>> >>>> Noah Palmer wrote: >>>>> is there a way to automatically remove or add the display to X when the >>>>> laptop lid is opened or closed. I have been using a script to read >>>>> dev.acpi_lid.0.state, but is there better way? >>>> >>>> If you are polling the dev.acpi_lid.0.state value, see /etc/devd.conf >>>> for examples of ACPI events notification, so you could invoke the need >>>> actions when lid is open/closed. >>>> >>> Okay that seems to be the solution. I also have an issue that >>> dev.acpi_lid.0.state is incorrect if the lid was open at boot. you have >> to >>> close and open the lid for the value to be correct. >> >> Interesting, I'm seeing the same on my lenovo laptop, something to look >> into. BTW, there's somewhat related PR filed: >> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240881. >> > Okay, I can use devd to run commands when the lid is opened and closed, but > they don't trigger if the laptop starts open or closed, there has to be a > change in state when the laptop is running. Just tried that with a simple /etc/devd/lid.conf file: notify 10 { match "system" "ACPI"; match "subsystem" "Lid"; action "logger Lid $notify"; }; I seem to be getting the event right after the first state change, booting both open and closed. For the initial lid state, please try the attached patch (if possible). --------------48B82A192E22BF770C9228B6 Content-Type: text/plain; charset=UTF-8; name="acpi_lid.diff" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="acpi_lid.diff" Y29tbWl0IDQ5ZTU3MTMyZGM4YjhkMmU1MTJjN2ZhNWVkNDI3ZTgzNDY4NzhkMmUKQXV0aG9y OiBZdXJpIFBhbmtvdiA8eXVyaXB2QEZyZWVCU0Qub3JnPgpEYXRlOiAgIE1vbiBGZWIgMTcg MDI6NDk6MjggMjAyMCArMDMwMAoKICAgIGFjcGlfbGlkOiBwcm92aWRlIGluaXRpYWwgTElE IHN0YXRlCgpkaWZmIC0tZ2l0IGEvc3lzL2Rldi9hY3BpY2EvYWNwaV9saWQuYyBiL3N5cy9k ZXYvYWNwaWNhL2FjcGlfbGlkLmMKaW5kZXggODBiYzM0NGQ2MDZkLi40MGZmMjU2Njg4OWIg MTAwNjQ0Ci0tLSBhL3N5cy9kZXYvYWNwaWNhL2FjcGlfbGlkLmMKKysrIGIvc3lzL2Rldi9h Y3BpY2EvYWNwaV9saWQuYwpAQCAtMTI0LDYgKzEyNCw5IEBAIGFjcGlfbGlkX2F0dGFjaChk ZXZpY2VfdCBkZXYpCiAgICAgaWYgKGFjcGlfcGFyc2VfcHJ3KHNjLT5saWRfaGFuZGxlLCAm cHJ3KSA9PSAwKQogCUFjcGlFbmFibGVHcGUocHJ3LmdwZV9oYW5kbGUsIHBydy5ncGVfYml0 KTsKIAorICAgIC8qIEdldCB0aGUgaW5pdGlhbCBsaWQgc3RhdHVzLCBpZ25vcmUgZmFpbHVy ZXMgKi8KKyAgICAodm9pZCkgYWNwaV9HZXRJbnRlZ2VyKHNjLT5saWRfaGFuZGxlLCAiX0xJ RCIsICZzYy0+bGlkX3N0YXR1cyk7CisKICAgICAvKgogICAgICAqIEV4cG9ydCB0aGUgbGlk IHN0YXR1cwogICAgICAqLwo= --------------48B82A192E22BF770C9228B6--