Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp971214imm; Wed, 6 Jun 2018 08:34:21 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLZLcV44Y8ttvAslQMdG109DETvzt0qXrB+Bfhzwe5pZq0GBen6zq7kxlkKx1LLI91qmrIr X-Received: by 2002:a17:902:9a06:: with SMTP id v6-v6mr3681417plp.21.1528299261848; Wed, 06 Jun 2018 08:34:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528299261; cv=none; d=google.com; s=arc-20160816; b=afdVL/9jdCmkvakcQovtuEJXr+bAPbpsLxtqjr0cHEphsefSeEPIZSswu7VekNxs0u p7F5HfOlURAqdPZp8NuRgDsnYjnwj8XfdoJ5l35Ue0QOZ9EdjgNmIBN4oEauYv4qxOwm 1p+8Z/vlPs9GmP7+WZrbVJ3966INCSu6OHT1mbHYEyJGd2dVjuzxPKvtZmgXetkMJZzZ ZaBJkggtL7O0bh3Yp9/FFoQnE5ybW3xMVgOa6/1HmdafcfA5a4Mf/q7NDN+OW95TNgwD GHRls9fEP8yrAqprwoxOgBA7Ca8/r9KBFzVAGRHZ5VlrcQn/w7+oIRDceWifSS8AMjt4 gPVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=VMkMbLVHLojKs9hx8wdA4pbi8ABC5M4ZyaupjBcrVpI=; b=XpnLqfb4TCs/Wamo5PaOnnokys7Lqae4KOX7CABTVVKSuFr5BaSFcqpnOLTWcLdGWo 5YSCw06BrQ+9+1Zz9DOJsn4JS0EiL5YJ+Y3ENG5Lrl3kjKaMfGOQYgRoyiXzz8HfWMVr FEQ6ZM78/B2tR+rQoQoIxPMNi+Dfgr5D3AAe288ooyt7E1enl2fIznCduY9XWzhVqVHA 8HX5go6EnUgj+bteqofWEusbAEfy+/z6pM/T7Jyw0qypGGISRrkBc22FvehdS5O3FFww WKDU7HaEfwG/E41uQQiFjmRIWzqg8PJd9XsSclxqfuzn7lPpVLJHBZGT742yt4Sz4nA5 KHKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z14-v6si10625530pgr.4.2018.06.06.08.34.07; Wed, 06 Jun 2018 08:34:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752685AbeFFPc5 (ORCPT + 99 others); Wed, 6 Jun 2018 11:32:57 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:38335 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752073AbeFFPcz (ORCPT ); Wed, 6 Jun 2018 11:32:55 -0400 Received: by mail-wm0-f66.google.com with SMTP id m129-v6so12828606wmb.3 for ; Wed, 06 Jun 2018 08:32:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=VMkMbLVHLojKs9hx8wdA4pbi8ABC5M4ZyaupjBcrVpI=; b=bM3xQmPGvAE5jgOcM+rAAsfHQagfS0kngPpFcuemEJdiQXeT9Lna+yDvyz3IMQyv4G Nw8BdltJlt2nSIFGxct3JX6sqKS9rDJauDg1qnyoFqUsQnJ/7zuxq8QdTvFmw1W55QE3 F2xtPsp4XqEGDiZXODdrgrzG4aWsXCpOndRSdCCMe6KBEnWRTlhOmPGsO6Db/0qOGTxK icCN1nc+D9D/QCrPX3Ic8O8Xu822UWa5rLuRrULmsCcrW13GlJBLNSAWN1t4+CMRxTLK zaDAx3pmJ9Zl9Gk+ZCigxEYuGXohnUuNd58npNefwn8nxnH8dd8tqw9+W2JqpAcxUqFR qzsA== X-Gm-Message-State: APt69E3QV8eXTUflT1eiZQnURB3TWwbPlqXxeIncxUhtdTBAR+zMcbhm m0iZ3yasuC9BqhNBugMUC78TT/waAbo= X-Received: by 2002:a50:98e2:: with SMTP id j89-v6mr4379796edb.8.1528299174039; Wed, 06 Jun 2018 08:32:54 -0700 (PDT) Received: from shalem.localdomain (546A5441.cm-12-3b.dynamic.ziggo.nl. [84.106.84.65]) by smtp.gmail.com with ESMTPSA id r10-v6sm4635179edo.77.2018.06.06.08.32.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jun 2018 08:32:53 -0700 (PDT) Subject: Re: [PATCH 1/2] platform/x86: asus-wmi: Call new led hw_changed API on kbd brightness change To: Benjamin Berg , Chris Chiu Cc: Bastien Nocera , Darren Hart , Daniel Drake , Corentin Chary , Andy Shevchenko , Linux Kernel , Platform Driver , acpi4asus-user , Linux Upstreaming Team References: <20180604123238.82200-1-chiu@endlessm.com> <20180605023124.GE47042@localhost.localdomain> <38cb3527-8480-bdb9-a5d9-b601bc494a5f@redhat.com> <71df09bc89619aba975147e6b07920f1dfc2f46f.camel@hadess.net> <94789b55b88ae5a296e1fca3b0311318e7b507ee.camel@hadess.net> <0443419b-3147-163b-374d-bb8651b08837@redhat.com> <362131bf-3b6b-58aa-bda6-003f5ffb5e8e@redhat.com> <33c55842c8d9ce199f0f8ef314dea85fb848b0be.camel@sipsolutions.net> From: Hans de Goede Message-ID: <173fdeb2-8129-57eb-fe2e-3ae16eec54b6@redhat.com> Date: Wed, 6 Jun 2018 17:32:52 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <33c55842c8d9ce199f0f8ef314dea85fb848b0be.camel@sipsolutions.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 06-06-18 16:27, Benjamin Berg wrote: > Hi, > > On Wed, 2018-06-06 at 10:50 +0800, Chris Chiu wrote: >> On Tue, Jun 5, 2018 at 7:06 PM, Hans de Goede >> wrote: >>> Hi, >>> >>> >>> On 05-06-18 12:46, Benjamin Berg wrote: >>>> >>>> Hey, >>>> >>>> On Tue, 2018-06-05 at 12:31 +0200, Hans de Goede wrote: >>>>> >>>>> On 05-06-18 12:14, Bastien Nocera wrote: >>>>>> >>>>>> On Tue, 2018-06-05 at 12:05 +0200, Hans de Goede wrote: >>>>>>> >>>>>>> On 05-06-18 11:58, Bastien Nocera wrote: >>>>>>>> >>>>>>>> [SNIP] >>>>>>> >>>>>>> >>>>>>> Ok, so what are you suggestion, do you really want to >>>>>>> hardcode >>>>>>> the cycle behavior in the kernel as these 2 patches are >>>>>>> doing, >>>>>>> without any option to intervene from userspace? >>>>>>> >>>>>>> As mentioned before in the thread there are several example >>>>>>> of the kernel deciding to handle key-presses itself, >>>>>>> putting >>>>>>> policy in the kernel and they have all ended poorly (think >>>>>>> e.g. rfkill, acpi-video dealing with LC brightnesskey >>>>>>> presses >>>>>>> itself). >>>>>>> >>>>>>> I guess one thing we could do here is code out both >>>>>>> solutions, >>>>>>> have a module option which controls if we: >>>>>>> >>>>>>> 1) Handle this in the kernel as these patches do >>>>>>> 2) Or send a new KEY_KBDILLUMCYCLE event >>>>>>> >>>>>>> Combined with a Kconfig option to select which is the >>>>>>> default >>>>>>> behavior. Then Endless can select 1 for now and then in >>>>>>> Fedora (which defaults to Wayland now) we could default to >>>>>>> 2. once all the code for handling 2 is in place. >>>>>>> >>>>>>> This is ugly (on the kernel side) but it might be the best >>>>>>> compromise we can do. >>>>>> >>>>>> >>>>>> I don't really mind which option is used, I'm listing the >>>>>> problems with >>>>>> the different options. If you don't care about Xorg, then >>>>>> definitely go >>>>>> for adding a new key. Otherwise, processing it in the kernel >>>>>> is the >>>>>> least ugly, especially given that the key goes through the >>>>>> same driver >>>>>> that controls the brightness anyway. There's no crazy cross >>>>>> driver >>>>>> interaction as there was in the other cases you listed. >>>>> >>>>> >>>>> Unfortunately not caring about Xorg is not really an option. >>>>> >>>>> Ok, new idea, how about we make g-s-d behavior upon detecting a >>>>> KEY_KBDILLUMTOGGLE event configurable, if we're on a Mac do a >>>>> toggle, otherwise do a cycle. >>>>> >>>>> Or we could do this through hwdb, then we could add a hwdb entry >>>>> for this laptop setting the udev property to do a cycle instead of >>>>> a toggle on receiving the keypress. >>>> >>>> If we are adding hwdb entries anyway to control the userspace >>>> interpretation of the TOGGLE key, then we could also add the new CYCLE >>>> key and explicitly re-map it to TOGGLE. That requires slightly more >>>> logic in hwdb, but it does mean that we could theoretically just drop >>>> the workaround if we ever stop caring about Xorg. >>> >>> Hmm, interesting proposal, I say go for it :) >>> >> >> So maybe the next stop is that I can follow Darren's suggestion to eliminate >> the is_kbd_led_event() and send a v2 for review? > > I believe the best compromise we have right now is to do what Hans > suggested in an earlier proposal. That is implementing the two separate > behaviours in the kernel > > 1) handle this in the kernel as if the hardware changed it, and > 2) send a new KEY_KBDILLUMCYCLE event [default]. I think you mean or, not and, depending on a module option the code should do either 1) or 2) not both :) Darren, Andy could you live with a module option for this? > Which one is used would be a compile time option for the kernel. > > Then we have three different choices for handling these devices from a > userspace/distribution point of view: > 1. Let the kernel handle these devices (quick fix) > 2. Assume we are on wayland and handle KEY_KBDILLUMCYCLE > (great if Xorg support is not a requirement) Ack, although 2 will require some work in userspace, teach all the layers like xkb about the new KEY_KBDILLUMCYCLE and teach g-s-d to listen to it and do the right thing. But long term 2. is the correct solution, so it would be good to start working towards this. > 3. For Xorg support: > - Add hwdb entry > - remap key to KEY_KBDILLUMTOGGLE > - set a flag on the keyboard > - detect the flag in userspace and handle KEY_KBDILLUMTOGGLE > as if KEY_KBDILLUMCYCLE was pressed > (yep, quite ugly) I would just use 1. for Xorg compat and not bother with this mess. Regards, Hans