From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] battery.el, upower fixes Date: Tue, 04 Feb 2020 18:10:58 -0500 Message-ID: References: <83lfpsoj1v.fsf@gnu.org> <87ftfq3y7p.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="130857"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Andreas Schwab , Eli Zaretskii , Evgeny Zajcev , emacs-devel To: Michael Albinus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Feb 05 00:11:42 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iz7M6-000XvH-1E for ged-emacs-devel@m.gmane-mx.org; Wed, 05 Feb 2020 00:11:42 +0100 Original-Received: from localhost ([::1]:39394 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iz7M5-0004dd-23 for ged-emacs-devel@m.gmane-mx.org; Tue, 04 Feb 2020 18:11:41 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38869) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iz7Lc-0004C5-5m for emacs-devel@gnu.org; Tue, 04 Feb 2020 18:11:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iz7La-0003cd-Cy for emacs-devel@gnu.org; Tue, 04 Feb 2020 18:11:11 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:51834) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iz7LS-0002sA-EL; Tue, 04 Feb 2020 18:11:02 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 50183441A30; Tue, 4 Feb 2020 18:11:01 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id B76DE44118C; Tue, 4 Feb 2020 18:10:59 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1580857859; bh=0GXQ6BuQfLuWC1n9odYtO+y6r138EsTgZsVGEmRnQvE=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=Px9xGiOJVcTzdo1nB5ThrftQ2jP6NkQ2KAi9JESIYTl0ihoTd9fqtOQFH91IuJTv+ a7t92vacSzPXLcwQtwQeXEJNHmLTNMQ2ZyZgdTcr4HYKHbB26N9X3U2WBZpshqfBmm 8ojL2hhSqwPdMfpKew9EqmyhbF937WVXjoxz8oVVGvO/Xgme/TQsN1sy1smWyUekRE WK4Zo5sJd2ggWLnNoiyECnP2uxYbomMHimvqDI9SsouF6n6NzdsGWi52kn2l/Z6D6H 6OSoK+n7a+w4TGvKXQ1m4qUGCw0t5CcJJkJMInOJA1b3vNVtStfXfFkZCxVAhxPOgg McfTPxaQCE5cA== Original-Received: from alfajor (modemcable157.163-203-24.mc.videotron.ca [24.203.163.157]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 7A994120284; Tue, 4 Feb 2020 18:10:59 -0500 (EST) In-Reply-To: <87ftfq3y7p.fsf@gmx.de> (Michael Albinus's message of "Tue, 04 Feb 2020 21:16:10 +0100") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 132.204.25.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:244850 Archived-At: >>> +(defcustom battery-upower-device >>> + (dbus-ignore-errors >>> + (battery-upower-device-autodetect :battery)) >> >> I think there's a possibility that the set of devices changes over time >> (e.g. on my machine (battery-upower-device-list) currently only shows >> battery_BAT0, but I can insert a second battery and I'd expect the list >> to then include a battery_BAT1 as well). So maybe we should instead >> allow a special value (e.g. nil) to mean "autodetect" and then do the >> autodetection dynamically. WDYT? > > Usually, D-Bus services send a signal when a device is added/removed. IIUC > https://upower.freedesktop.org/docs/UPower.html, > org.freedesktop.UPower.DeviceAdded and org.freedesktop.UPower.DeviceRemoved > serve for that purpose. So you shall subscribe to those signals and > handle them accordingly. Sure, but you wouldn't want to set a `defcustom` in response to that, so the `defcustom` should have a separate setting to mean "autodetect". Stefan