LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Maxim Devaev <mdevaev@gmail.com>
Cc: gregkh@linuxfoundation.org, ruslan.bilovol@gmail.com,
	mika.westerberg@linux.intel.com, jj251510319013@gmail.com,
	maze@google.com, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] usb: gadget: f_hid: optional SETUP/SET_REPORT mode
Date: Tue, 24 Aug 2021 10:05:52 +0300	[thread overview]
Message-ID: <877dgb8gps.fsf@kernel.org> (raw)
In-Reply-To: <20210821134004.363217-1-mdevaev@gmail.com>


Maxim Devaev <mdevaev@gmail.com> writes:

> f_hid provides the OUT Endpoint as only way for receiving reports
> from the host. SETUP/SET_REPORT method is not supported, and this causes
> a number of compatibility problems with various host drivers, especially
> in the case of keyboard emulation using f_hid.
>
>   - Some hosts do not support the OUT Endpoint and ignore it,
>     so it becomes impossible for the gadget to receive a report
>     from the host. In the case of a keyboard, the gadget loses
>     the ability to receive the status of the LEDs.
>
>   - Some BIOSes/UEFIs can't work with HID devices with the OUT Endpoint
>     at all. This may be due to their bugs or incomplete implementation
>     of the HID standard.
>     For example, absolutely all Apple UEFIs can't handle the OUT Endpoint
>     if it goes after IN Endpoint in the descriptor and require the reverse
>     order (OUT, IN) which is a violation of the standard.
>     Other hosts either do not initialize gadgets with a descriptor
>     containing the OUT Endpoint completely (like some HP and DELL BIOSes
>     and embedded firmwares like on KVM switches), or initialize them,
>     but will not poll the IN Endpoint.
>
> This patch adds configfs option no_out_endpoint=1 to disable
> the OUT Endpoint and allows f_hid to receive reports from the host
> via SETUP/SET_REPORT.
>
> Previously, there was such a feature in f_hid, but it was replaced
> by the OUT Endpoint [1] in the commit 99c515005857 ("usb: gadget: hidg:
> register OUT INT endpoint for SET_REPORT"). So this patch actually
> returns the removed functionality while making it optional.
> For backward compatibility reasons, the OUT Endpoint mode remains
> the default behaviour.
>
>   - The OUT Endpoint mode provides the report queue and reduces
>     USB overhead (eliminating SETUP routine) on transmitting a report
>     from the host.
>
>   - If the SETUP/SET_REPORT mode is used, there is no report queue,
>     so the userspace will only read last report. For classic HID devices
>     like keyboards this is not a problem, since it's intended to transmit
>     the status of the LEDs and only the last report is important.
>     This mode provides better compatibility with strange and buggy
>     host drivers.
>
> Both modes passed USBCV tests. Checking with the USB protocol analyzer
> also confirmed that everything is working as it should and the new mode
> ensures operability in all of the described cases.
>
> Signed-off-by: Maxim Devaev <mdevaev@gmail.com>
> Link: https://www.spinics.net/lists/linux-usb/msg65494.html [1]

Acked-by: Felipe Balbi <balbi@kernel.org>

-- 
balbi

      parent reply	other threads:[~2021-08-24  7:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-21 13:40 Maxim Devaev
2021-08-23 17:50 ` Maciej Żenczykowski
2021-08-24  7:05 ` Felipe Balbi [this message]

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=877dgb8gps.fsf@kernel.org \
    --to=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jj251510319013@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=maze@google.com \
    --cc=mdevaev@gmail.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=ruslan.bilovol@gmail.com \
    --subject='Re: [PATCH v3] usb: gadget: f_hid: optional SETUP/SET_REPORT mode' \
    /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

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).