From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A940CC19F2D for ; Tue, 9 Aug 2022 08:53:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241126AbiHIIxA (ORCPT ); Tue, 9 Aug 2022 04:53:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240092AbiHIIw7 (ORCPT ); Tue, 9 Aug 2022 04:52:59 -0400 Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C787C38B7; Tue, 9 Aug 2022 01:52:58 -0700 (PDT) Received: by mail-qk1-x72a.google.com with SMTP id u24so582794qku.2; Tue, 09 Aug 2022 01:52:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=kj+IBIcvmD9Bocwc77ln5rMdqZQ+fPOnDWWREVnTls0=; b=JrTJM90XjLXeMYorJpV2SEmeQpEzqiDpYQCbkZD4M7ibiGDL36UGezTp5dUhT5eoI5 xQbHIqoJ/f3dasXBlCzMJ4/uwfOUHTRlQeP0BztvhkmW5rmBjEjlw2wV8vhG9dfh2Kkz dS6vdNS27YlaK2pQLSWbsQDyVDik3wGNMxtxyGEjZ8V3jThDiJ61U1ulgiRMuGbxnXQd LSMNzQOlSBc0NwjiUTO7TUiHeY+jXj5HjFP3HuYBIVyINOViXfNQdN+GVQHQG0Gnj+NZ 1pKMGcwoMssxSveLrS91JMxB7sorjt6rsETSrS47cFUsqgSyCIXnM/BmCX5REYqhzlLy Uokg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=kj+IBIcvmD9Bocwc77ln5rMdqZQ+fPOnDWWREVnTls0=; b=kaUwdLeBRu+rHzr27tyY7UfL3uk0KuXn5wLJF6SGDGYNC07N7ZGvWfgXICAKAGHtaq t5g7pveCUfbJtHqFoQT4Dc4EtGgpRsagzGANxwYSerUDtzbNvQvO9Cx8JnBXvjkYaPG1 RubYUZ6KI+43JRKkWw5JAOHWavtD2SEUTANnFtQ3Sma0gmnlCVUHZCXNWLIkUfs/R5Mg 2Rr4LHZAdC21hQd8LCdLZ1egJk2ow9jaRCVevvZNi6HE3q1SgC4STK+E/vHmRGzQZ1kd PsvNllyb4uHf9iXYvRh8jJj/hl9E4kE5YjVgKTYlpAufNS+8nG84peg/bHHBBvKh7h+B of1w== X-Gm-Message-State: ACgBeo3RtZqzqadPMCU/Mw+9KPGUCojT2zcv+da+QixSNEkwzx1ixNGB phJnJTzN65Q3mbMK/EXM93qqhXFArqGnfeGPBJl2nNznbdw= X-Google-Smtp-Source: AA6agR6kZcoRcKdtrZ8kXkWgKT/W4OviW071Nnmosd8hPlPFwLT98UM3u+AoOHgOP2euLuyz1qSk3rQU8A7AZIP0GUI= X-Received: by 2002:a05:620a:2809:b0:6b6:5908:316e with SMTP id f9-20020a05620a280900b006b65908316emr17216266qkp.734.1660035177874; Tue, 09 Aug 2022 01:52:57 -0700 (PDT) MIME-Version: 1.0 References: <20220809025054.1626339-1-luke@ljones.dev> <20220809025054.1626339-4-luke@ljones.dev> In-Reply-To: <20220809025054.1626339-4-luke@ljones.dev> From: Andy Shevchenko Date: Tue, 9 Aug 2022 10:52:21 +0200 Message-ID: Subject: Re: [PATCH v3 3/6] asus-wmi: Implement TUF laptop keyboard power states To: "Luke D. Jones" Cc: Hans de Goede , =?UTF-8?B?QmFybmFiw6FzIFDFkWN6ZQ==?= , Pavel Machek , Platform Driver , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org On Tue, Aug 9, 2022 at 4:51 AM Luke D. Jones wrote: > > Adds support for setting various power states of TUF keyboards. > These states are combinations of: > - boot, set if a boot animation is shown on keyboard > - awake, set if the keyboard LEDs are visible while laptop is on > - sleep, set if an animation is displayed while the laptop is suspended > - keyboard (unknown effect) > > Adds two sysfs attributes to asus-nb-wmi: > - keyboard_rgb_state > - keyboard_rgb_state_index ... > until the keyboard_rgb_save attribute is set (write-only): > * 0 - slow > * 1 - medium > - * 2 - fast > \ No newline at end of file ^^^ > + * 2 - fast > + > +What: /sys/devices/platform//keyboard_rgb_state > +Date: Aug 2022 > +KernelVersion: 6.1 > +Contact: "Luke Jones" > +Description: > + Set some RGB keyboard power states (write-only). > + > + The accepted input is "boot awake sleep keyboard", where "n n n n n" > + options are: > + * save - 0 or 1, if 0 then settings are not retained on boot > + * boot - 0 or 1, controls if a boot animation is shown > + * awake - 0 or 1, controls if the keyboard LED are on during awake > + * sleep - 0 or 1, controls if a suspended animation is shown. > + This is only active if the AC is connected. > + * keyboard - 0 or 1, unknown what effect this really has > \ No newline at end of file ^^^ Be sure of not repeating the same mistake. I.e. add a newline as suggested. > + flags = 0; Seems you ignored my comment here... > + if (sscanf(buf, "%hhd %hhd %hhd %hhd %hhd", &save, &boot, &awake, &sleep, &keyboard) != 5 > + return -EINVAL; > + save = save == 0 ? 0x0100 : 0x0000; ...and here... > + if (boot) > + flags |= 0x02; > + if (awake) > + flags |= 0x08; > + if (sleep) > + flags |= 0x20; > + if (keyboard) > + flags |= 0x80; ...and here. ... > + err = asus_wmi_evaluate_method3(ASUS_WMI_METHODID_DEVS, > + ASUS_WMI_DEVID_TUF_RGB_STATE, 0xBD | save | (flags << 16), 0, &ret); > + if (err) > + return err; Also see another comment about how ret is supposed to be used. -- With Best Regards, Andy Shevchenko