Received: by 2002:a05:7208:70d5:b0:7f:5597:fa5c with SMTP id q21csp88291rba; Wed, 20 Mar 2024 11:46:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVQgVWhTBzFKIrwo7p+7tK0vGmsVShi+I4rBmu6MP49Ab+JLIzJIa2Ie6tMdAD7VLKwnNZUvXQapL/4ejB/7mZADDzN7sszpS2pGmlHfA== X-Google-Smtp-Source: AGHT+IFI8kkkT9aJ0+2EYDAMGEKQ/i1UNtxyIw11CCKsYtmkIOHb+Tn7u1gHI/zmSwQdioOtVbme X-Received: by 2002:a17:906:e208:b0:a45:ad5d:98ac with SMTP id gf8-20020a170906e20800b00a45ad5d98acmr4528952ejb.44.1710960393427; Wed, 20 Mar 2024 11:46:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710960393; cv=pass; d=google.com; s=arc-20160816; b=LRxUeqxfbwm6p3LoFZYoL6FscpqtUhEkbnWMQFEvlQTtXM8kY/WcyqvWI93fwxGKlf Q+0w7K6HRBk8Uk+YsXByGlfO9HfmbEEciji7w8rzkK1C5GQB0EPntxnh7hspxIbB9fd0 3ZZWJA47wBSmDZqdnj+T8c/QO5FThcLVLer0ckiAYUSKhE6eqRwXSE/nBB+atbTqPifS gL3A3W+6+scNvaiRHZvyt1WaALKP0+TQy7+Rw4arvYd1CWVmBZ7ZgKLIHq5JQA6Sa5Tz ihFO4nRYFAR1fN7Dc3lGayppfyPmNeLZ44M5ONoGIinFl2UtN2b3SGpDq8WOUAdeN82n IcUA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=0aJ6WogG8TKIkMoo2xB1GRutijq0g65zd7DzWfQd0xo=; fh=osraw80b6b5kOJhWrlSmCWYGpGbFPkIVuQqPI0VpNTA=; b=C43UNjcRJ7RZAl8fPrhDcKJA2A0bp4YZb0NkfKZybtyd2WTzrd17D0WRWqX97rZgFj lH1BNoBgBa/cgyaXwPyG+3htjpVESjdiqgK8Cu3QVGryBXBlcZIpIlniwaoet5/tSnN1 IU0OV7VT4OuvfDFl4OVUkjoqv78IHYmMsdQLywiC1d+wve1O6q0zoWOU+vGybgzVREKY XlH0DYPKGq5vBV8+buEdt+x5G9BCJKQ49rj1wWiMrOJTpUdjpPGpa2QU6hRc5BWZpyqj VTz77fZR45XXhHctUEGvXMoXjUZCx6PqbwHmWbJ++v629y+Mvk4zAfc+/S/DZQ8tkbh2 +WHA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxedocomputers.com header.s=default header.b=f4tGR9zO; arc=pass (i=1 spf=pass spfdomain=tuxedocomputers.com dkim=pass dkdomain=tuxedocomputers.com dmarc=pass fromdomain=tuxedocomputers.com); spf=pass (google.com: domain of linux-kernel+bounces-109307-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109307-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tuxedocomputers.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ho12-20020a1709070e8c00b00a4678ee590asi6522046ejc.679.2024.03.20.11.46.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 11:46:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-109307-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxedocomputers.com header.s=default header.b=f4tGR9zO; arc=pass (i=1 spf=pass spfdomain=tuxedocomputers.com dkim=pass dkdomain=tuxedocomputers.com dmarc=pass fromdomain=tuxedocomputers.com); spf=pass (google.com: domain of linux-kernel+bounces-109307-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109307-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tuxedocomputers.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D3CF51F2281B for ; Wed, 20 Mar 2024 18:46:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1E5888529E; Wed, 20 Mar 2024 18:45:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=tuxedocomputers.com header.i=@tuxedocomputers.com header.b="f4tGR9zO" Received: from mail.tuxedocomputers.com (mail.tuxedocomputers.com [157.90.84.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F54052F78; Wed, 20 Mar 2024 18:45:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=157.90.84.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710960357; cv=none; b=ONVs74+1CriBXIsnxUj2UL3GZNIdjWxf3KqzP2+DqUaNJPlmZfH4pASxrNwnMkgWaa5xibtUanBd4GTM20iGWKXJla3DpL7VQfOlbiwqNhexTo0wRt68rmFupkbSNhC06E8YHnjKx2n+7+hzMX0BYiLQH4FMsAh0Cv92A09MLQY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710960357; c=relaxed/simple; bh=FdvAryhYuwV2hmzPVyBwo1j+eckI21gR/HiDPzPWTGg=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=Xj0G7NSw49STVx3jbjl/3LBjZf9w+qBn4Q5JQw30Y0yc3hnkJjzpeKIhFGZXbVTT6sVKOhRGUQfVtx3M8rMnMxIYmpdPwmE6WmVnTk4HJOFsdUKMPSvY8deWvM05E5MBFGv8ZCMmGM6g3In+8QHB16CXalOJzPtJ77xbHkVY6ec= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=tuxedocomputers.com; spf=pass smtp.mailfrom=tuxedocomputers.com; dkim=pass (1024-bit key) header.d=tuxedocomputers.com header.i=@tuxedocomputers.com header.b=f4tGR9zO; arc=none smtp.client-ip=157.90.84.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=tuxedocomputers.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxedocomputers.com Received: from [192.168.42.20] (pd9e59c8a.dip0.t-ipconnect.de [217.229.156.138]) (Authenticated sender: wse@tuxedocomputers.com) by mail.tuxedocomputers.com (Postfix) with ESMTPSA id 3E8C62FC0112; Wed, 20 Mar 2024 19:45:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxedocomputers.com; s=default; t=1710960345; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0aJ6WogG8TKIkMoo2xB1GRutijq0g65zd7DzWfQd0xo=; b=f4tGR9zOeoNnuXaCPems0Yk3CHqLH8rQYPZgbz9KHVxqddiaqgtmuOTk2m89La8hZhIZJT epbtVjyFfEncfkX1T/CeG3NNHemqwCgqnf9z7BwXtUvK7jAfsQcMcN0lPM3Xmjt0g+gphx KmYoc49s+v9KutsRCGGpxN+vfnNZd0A= Authentication-Results: mail.tuxedocomputers.com; auth=pass smtp.auth=wse@tuxedocomputers.com smtp.mailfrom=wse@tuxedocomputers.com Message-ID: <742f2564-96bd-4b4c-89d6-7ef4e6b641a5@tuxedocomputers.com> Date: Wed, 20 Mar 2024 19:45:43 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Future handling of complex RGB devices on Linux v3 Content-Language: en-US From: Werner Sembach To: Hans de Goede Cc: Lee Jones , jikos@kernel.org, linux-kernel@vger.kernel.org, Jelle van der Waa , Miguel Ojeda , "dri-devel@lists.freedesktop.org" , linux-input@vger.kernel.org, ojeda@kernel.org, linux-leds@vger.kernel.org, Pavel Machek , Gregor Riepl References: <0cdb78b1-7763-4bb6-9582-d70577781e61@tuxedocomputers.com> <7228f2c6-fbdd-4e19-b703-103b8535d77d@redhat.com> <730bead8-6e1d-4d21-90d2-4ee73155887a@tuxedocomputers.com> <952409e1-2f0e-4d7a-a7a9-3b78f2eafec7@redhat.com> <9851a06d-956e-4b57-be63-e10ff1fce8b4@tuxedocomputers.com> <1bc6d6f0-a13d-4148-80cb-9c13dec7ed32@redhat.com> <477d30ee-247e-47e6-bc74-515fd87fdc13@redhat.com> <247b5dcd-fda8-45a7-9896-eabc46568281@tuxedocomputers.com> <825129ea-d389-4c6c-8a23-39f05572e4b4@redhat.com> <1fb08a74-62c7-4d0c-ba5d-648e23082dcb@tuxedocomputers.com> <31bbac5f-a1fc-41dd-b614-f9039763084d@tuxedocomputers.com> In-Reply-To: <31bbac5f-a1fc-41dd-b614-f9039763084d@tuxedocomputers.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Am 20.03.24 um 12:33 schrieb Werner Sembach: > > Am 20.03.24 um 12:16 schrieb Werner Sembach: >> Hi Hans and the others, >> >> Am 22.02.24 um 14:14 schrieb Werner Sembach: >>> Hi, >>> >>> Thanks everyone for the exhaustive feedback. And at least this thread is a >>> good comprehesive reference for the future ^^. >>> >>> To recap the hopefully final UAPI for complex RGB lighting devices: >>> >>> - By default there is a singular /sys/class/leds/* entry that treats the >>> device as if it was a single zone RGB keyboard backlight with no special >>> effects. >>> >>> - There is an accompanying misc device with the sysfs attributes "name", >>> "device_type",  "firmware_version_string", "serial_number" for device >>> identification and "use_leds_uapi" that defaults to 1. >>> >>>     - If set to 0 the /sys/class/leds/* entry disappears. The driver should >>> keep the last state the backlight was in active if possible. >>> >>>     - If set 1 it appears again. The driver should bring it back to a static >>> 1 zone setting while avoiding flicker if possible. >>> >>> - If the device is not controllable by for example hidraw, the misc device >>> might also implement additional ioctls or sysfs attributes to allow a more >>> complex low level control for the keyboard backlight. This is will be a >>> highly vendor specific UAPI. >> So in the OpenRGB issue thread >> https://learn.microsoft.com/en-us/windows-hardware/design/component-guidelines/dynamic-lighting-devices >> aka HID LampArray was mentioned. I did dismiss it because I thought that is >> only relevant for firmware, but I now stumbled upon the Virtual HID Framework >> (VHF) >> https://learn.microsoft.com/en-us/windows-hardware/drivers/hid/virtual-hid-framework--vhf- >> and now I wonder if an equivalent exists for Linux? A quick search did not >> yield any results for me. > Is this what I have been searching for? > https://docs.kernel.org/usb/gadget_hid.html Nope is something different: http://www.linux-usb.org/gadget/ >> >> If a virtual HID device is possible and the WMI interface can reasonably be >> mapped to the LampArray API this might be the best starting point: >> >> - Implement a Virtual HID device with LampArray >> >> - Implement LampArray in OpenRGB >> >> - (Optional) Implement a generic LampArray leds subsystem driver that maps to >> the single zone control and ads the use_leds_uapi sysfs switch to the virtual >> HID device >> >> - (Optional) Implement vendor specific controls for >> AutonomousMode/built-in-firmware-effects via custom HID commands >> >> - (Optional) Implement Virtual HID devices for actual HID devices that don't >> support LampArray in firmware (Open question: How to prevent >> userspace/OpenRGB from interacting with original HID when the virtual HID >> device is not in AutonomousMode? How to associate the original and virtual >> HID device to each other that userspace can easily recognize this relation? >> Or is it possible to add virtual HID commands on top of a real HID device, >> making it look exactly like the pure virtual devices for userspace?) >> >> The LampArray API hereby is made with the intention to be used for multi leds >> devices, like per-key-backlight keyboards, unlike the leds UAPI. And it is >> coming anyway with new RGB devices soon. So it would not conflict with a >> "don't introduce unnecessary UAPI interfaces" principle. Are there any plans >> already of Wrapping LampArray in some kind ioctl/sysfs API? Or just have it >> used via hidraw? Or was there no discussion about it till now? >> >> Regards, >> >> Werner >> >>> >>>     - The actual logic interacting with this low level UAPI is implemented >>> by a userspace driver >>> >>> Implementation wise: For the creation of the misc device with the >>> use_leds_uapi switch a helper function/macro might be useful? Wonder if it >>> should go into leds.h, led-class-multicolor.h, or a new header file? >>> >>> - Out of my head it would look something like this: >>> >>> led_classdev_add_optional_misc_control( >>>     struct led_classdev *led_cdev, >>>     char* name, >>>     char* device_type, >>>     char* firmware_version_string, >>>     char* serial_number, >>>     void (*deregister_led)(struct led_classdev *led_cdev), >>>     void (*reregister_led)(struct led_classdev *led_cdev)) >>> >>> Let me know your thoughts and hopefully I can start implementing it soon for >>> one of our devices. >>> >>> Kind regards, >>> >>> Werner Sembach >>>