From: Werner Sembach <wse@tuxedocomputers.com>
To: Benjamin Tissoires <bentiss@kernel.org>
Cc: "Armin Wolf" <W_Armin@gmx.de>, "Pavel Machek" <pavel@ucw.cz>,
"Hans de Goede" <hdegoede@redhat.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
dri-devel@lists.freedesktop.org, jelle@vdwaa.nl,
jikos@kernel.org, lee@kernel.org, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org,
miguel.ojeda.sandonis@gmail.com, ojeda@kernel.org,
onitake@gmail.com, platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH 1/1] platform/x86/tuxedo: Add virtual LampArray for TUXEDO NB04 devices
Date: Wed, 23 Oct 2024 19:23:47 +0200 [thread overview]
Message-ID: <8331d2e5-ab27-4aa4-8de8-f81ecbe1c958@tuxedocomputers.com> (raw)
In-Reply-To: <zmecavqq5iztb5pkdkk6q52lupolpnufisid4ljydesqh2dtoe@qynhfo3n2i6q>
Am 22.10.24 um 11:05 schrieb Benjamin Tissoires:
> Sorry I should have answered earlier...
>
> On Oct 09 2024, Werner Sembach wrote:
>> Resend because HTML mail ..., but I think I now know when Thunderbird does
>> it: Every time I include a link it gets converted.
>>
>> Hi
>>
>> Am 08.10.24 um 17:21 schrieb Benjamin Tissoires:
>>> On Oct 08 2024, Werner Sembach wrote:
>>>> [...]
>>> Yeah, it just means that you can query or send the data. You can also
>>> use HIDIOCGINPUT() and HIDIOCSOUTPUT() to get a current input report and
>>> set an output report through the hidraw ioctl...
>>>
>>> Internally, HIDIOCGINPUT() uses the same code path than
>>> HIDIOCGFEATURE(), but with the report type being an Input instead of a
>>> Feature. Same for HIDIOCSOUTPUT() and HIDIOCSFEATURE().
>> Ok so just a difference in definition not in implementation.
>>
>> Then I use a get feature report for the device status function and use it as
>> input and output at the same time, and use a set output report for the led
>> update function (which technically has a return value but i think it's
>> always 0 anyway).
> not quite. You can not use a get feature to set something on the device.
>
> The semantic is:
> Set -> "write" something on the device (from host to device)
> Get -> "read" something from the device (from device to host)
>
> Features can be set/get.
> Input can only be get.
> Output can only be set.
>
> The implementation in the kernel should enforce that.
>
>> I scoured the old thread about exposing WMI calls to userspace, because I
>> remembered that something here came up already.
>>
>> 1. https://lore.kernel.org/all/6b32fb73-0544-4a68-95ba-e82406a4b188@gmx.de/
>> -> Should be no problem? Because this is not generally exposing wmi calls,
>> just mapping two explicitly with sanitized input (whitelisting basically).
>>
>> 2.
>> https://lore.kernel.org/all/b6d79727-ae94-44b1-aa88-069416435c14@redhat.com/
>> -> Do this concerns this apply here? The actual API to be used is LampArray
>> and the HID mapped WMI calls are just an "internal" interface for the BPF
>> driver, but technically UAPI.
>>
>> Also at Armin and Hans: Do you have comments on this approach?
>>
>>>> (well as far as I can tell the hut doesn't actual specify, if they need to
>>>> be feature reports, or am I missing something?)
>>> They can be both actually. The HUT is missing what's expected here :(.
>>>
>>> However, looking at the HUT RR 84:
>>> https://www.usb.org/sites/default/files/hutrr84_-_lighting_and_illumination_page.pdf
>>>
>>> There is an example of a report descriptor, and they are using Features.
>>> Not Input+Output.
>>>
>>> And looking even further (above), in 3.5 Usage Definitions:
>>> 3.5.2, 3.5.3 and 3.5.5 all of them are meant to be a feature, like:
>>> LampArrayAttributesReport CL – Feature -
>>> LampAttributesRequestReport CL – Feature –
>>> LampAttributesResponseReport CL – Feature –
>>> LampArrayControlReport CL – Feature –
>>>
>>> 3.5.4: can be either feature or output, like:
>>> LampMultiUpdateReport CL – Feature/Output –
>>> LampRangeUpdateReport CL – Feature/ Output –
>>>
>>> So I guess the MS implementation can handle Feature only for all but the
>>> update commands.
>> Thanks for the link, I guess for the BPF driver I will stick to feature
>> reports for the LampArray part until there is actually a hid descriptor
>> spotted in the wild defining LampMultiUpdateReport and LampRangeUpdateReport
>> as Output and not feature.
>>>> and there is the pair with LampAttributesRequestReport and
>>>> LampAttributesResponseReport.
>>> Yeah, not a big deal. The bold IN and OUT are just to say that calling a
>>> setReport on a LampAttributesResponseReport is just ignored AFAIU.
>>>
>>>> Sorry for my confusion over the hid spec.
>>> No worries. It is definitely confusing :)
>> On this note as I fathom:
>>
>> Input Report (usually always get report): Interrupts (the ioctl just there
>> to repeat the last one?)
> yeah, but from hidraw the kernel calls the device directly to query the
> report, so some device don't like that and just hang.
>
> Rule of thumbs: never use get_report on an input report, unless the
> specification explicitely says that the device is supposed to support
> it for the given usage.
>
>> Output Report (usually always set report): Async write, no return value
>> (Buffer should stay untouched)
> yep
>
>> Feature report set: Sync write, no return value (Buffer should stay untouched)
> yep
>
>> Feature report get: Sync read/write (intended only for read, but not limited
>> to it, uses singular buffer for both input and output)
> sync read only, no write. The existing values in the incoming buffer are
> just overwritten.
Sorry I'm still confused: You said i could do input and output in a singular
feature report, but now you say i can't do input or i can't do output, so i
still need to use 2?
>
>> I kind of don't get why feature report set exists, but well it's the specs ^^.
> if "feature report set" doesn't exist, you can not write a vlaue to a
> feature on a device (because get doesn't allow you to write).
>
> Anyway, it's a USB implementation detail: input/output are using URB, so
> direct USB read/write, when Features are using the control endpoint,
> which allows for a slightly different approach.
>
> And this transfered as output being async, when features are
> synchronous.
>
> Cheers,
> Benjamin
next prev parent reply other threads:[~2024-10-23 17:23 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-26 17:44 [PATCH 0/1] platform/x86/tuxedo: Add virtual LampArray for TUXEDO NB04 Werner Sembach
2024-09-26 17:44 ` [PATCH 1/1] platform/x86/tuxedo: Add virtual LampArray for TUXEDO NB04 devices Werner Sembach
2024-09-26 18:39 ` Armin Wolf
2024-09-27 6:59 ` Werner Sembach
2024-09-27 11:24 ` Werner Sembach
2024-09-27 17:18 ` Armin Wolf
2024-09-28 7:40 ` Werner Sembach
2024-09-27 17:15 ` Armin Wolf
2024-09-28 7:36 ` Werner Sembach
2024-09-27 8:59 ` kernel test robot
2024-09-27 9:20 ` kernel test robot
2024-09-27 12:18 ` kernel test robot
2024-09-27 21:01 ` Pavel Machek
2024-09-27 22:21 ` Armin Wolf
2024-09-28 7:27 ` Benjamin Tissoires
2024-09-28 8:23 ` Werner Sembach
2024-09-28 10:05 ` Benjamin Tissoires
2024-09-30 15:35 ` Werner Sembach
2024-09-30 16:15 ` Benjamin Tissoires
2024-09-30 16:35 ` Werner Sembach
2024-09-30 17:06 ` Benjamin Tissoires
2024-10-01 12:23 ` Werner Sembach
2024-10-01 12:28 ` Werner Sembach
2024-10-01 13:41 ` Benjamin Tissoires
2024-10-01 16:45 ` Armin Wolf
2024-10-01 19:32 ` Werner Sembach
2024-10-02 8:42 ` Benjamin Tissoires
2024-10-02 9:27 ` Armin Wolf
2024-10-03 16:01 ` Benjamin Tissoires
2024-10-01 19:18 ` Werner Sembach
2024-10-02 8:31 ` Benjamin Tissoires
2024-10-07 17:57 ` Werner Sembach
2024-10-08 9:53 ` Benjamin Tissoires
2024-10-08 10:45 ` Werner Sembach
2024-10-08 12:18 ` Benjamin Tissoires
2024-10-08 14:51 ` Werner Sembach
2024-10-08 15:21 ` Benjamin Tissoires
2024-10-09 9:55 ` Werner Sembach
2024-10-11 12:14 ` Armin Wolf
2024-10-11 15:26 ` Pavel Machek
2024-10-21 20:26 ` Armin Wolf
2024-10-22 7:58 ` Hans de Goede
2024-10-22 8:51 ` Benjamin Tissoires
2024-10-22 9:37 ` Pavel Machek
2024-10-22 15:02 ` Armin Wolf
2024-10-23 17:54 ` Werner Sembach
2024-10-22 9:47 ` Pavel Machek
2024-10-22 15:18 ` Armin Wolf
2024-10-22 19:15 ` Pavel Machek
2024-10-23 7:03 ` Armin Wolf
2024-10-23 17:14 ` Werner Sembach
2024-10-23 17:47 ` Pavel Machek
2024-10-23 16:38 ` Werner Sembach
2024-10-22 9:05 ` Benjamin Tissoires
2024-10-23 17:23 ` Werner Sembach [this message]
2024-10-01 21:03 ` Pavel Machek
2024-10-02 8:13 ` Benjamin Tissoires
2024-10-02 9:53 ` Pavel Machek
2024-10-02 10:21 ` Benjamin Tissoires
2024-10-03 10:59 ` Pavel Machek
2024-10-03 12:54 ` Benjamin Tissoires
2024-10-11 15:23 ` Pavel Machek
2024-09-28 8:09 ` Werner Sembach
2024-10-01 20:47 ` Pavel Machek
2024-09-28 7:55 ` Werner Sembach
2024-09-27 16:08 ` [PATCH 0/1] platform/x86/tuxedo: Add virtual LampArray for TUXEDO NB04 Benjamin Tissoires
2024-09-27 21:03 ` Pavel Machek
2024-09-28 7:31 ` Werner Sembach
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8331d2e5-ab27-4aa4-8de8-f81ecbe1c958@tuxedocomputers.com \
--to=wse@tuxedocomputers.com \
--cc=W_Armin@gmx.de \
--cc=bentiss@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jelle@vdwaa.nl \
--cc=jikos@kernel.org \
--cc=lee@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=ojeda@kernel.org \
--cc=onitake@gmail.com \
--cc=pavel@ucw.cz \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).