usb: gadget: composite: report bcdUSB 0x0210 when WebUSB is enabled (v6.8) - #368
Open
evgeny-boger wants to merge 2 commits into
Open
usb: gadget: composite: report bcdUSB 0x0210 when WebUSB is enabled (v6.8)#368evgeny-boger wants to merge 2 commits into
evgeny-boger wants to merge 2 commits into
Conversation
The WebUSB specification requires a device that carries the WebUSB platform capability descriptor to report bcdUSB >= 0x0210, and Chromium enforces exactly that: its USB service reads the BOS descriptor and the landing page URL only if the device version is at least 2.1.0 (kUsbVersion2_1 = 0x0210 in usb_service_linux.cc and usb_device_win.cc). composite_setup() currently reports bcdUSB 0x0201 for a non-superspeed gadget with cdev->use_webusb set, sharing the branch with LPM-capable gadgets, and ignores the value written to the configfs bcdUSB attribute. Chromium therefore never reads the landing page: the "Go to <site> to connect <device>" notification never appears, which defeats the purpose of the configfs webusb/ interface. Report 0x0210 when WebUSB is in use; keep 0x0201 for the LPM-only case. Verified on a Wiren Board 8 (musb high-speed UDC, kernel 6.8) with Chromium 144 on Linux: with 0x0201 chrome://usb-internals shows "USB Version: 2.0.1" and no landing page; with 0x0210 it shows "USB Version: 2.1.0", "WebUSB Landing Page: <url>" and the plug-in notification is displayed. With webusb/use = 0 the device still reports bcdUSB 2.00 and no BOS, as before. An LLM assistant located the Chromium-side version gate, wrote this patch and the changelog, and ran the on-hardware verification above; the analysis and the result were reviewed by the submitter. Fixes: 93c4739 ("usb: gadget: add WebUSB landing page support") Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Evgeny Boger <boger@wirenboard.com>
Member
Author
|
Заменяет #367 (закрыт): там в коммите оказался Отличия от #367: добавлены |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Что происходит; кому и зачем нужно:
Ядро умеет отдавать WebUSB landing page для USB-гаджета (configfs
webusb/{use,bVendorCode,landingPage}, ядро ≥ 6.3): в BOS-дескриптор добавляется WebUSB platform capability, а на vendor-запрос GET_URL возвращается URL. Chromium на десктопе показывает по этому URL уведомление «Go to <site> to connect <device>» при подключении устройства.Но
composite_setup()для не-superspeed гаджета сuse_webusbвыдаётbcdUSB = 0x0201(общая ветка с LPM), игнорируя значение из configfs. Спецификация WebUSB требует bcdUSB ≥ 2.10, и Chromium это проверяет жёстко: landing page читается только при версии ≥ 2.1.0 (kUsbVersion2_1 = 0x0210вusb_service_linux.ccиusb_device_win.cc). То есть configfs-фича ядра в связке с Chromium не работает вообще:chrome://usb-internalsпоказывает «USB Version: 2.0.1» и landing page отсутствует.Патч отдаёт
0x0210приuse_webusb, для чисто LPM-случая оставляет0x0201. Предназначен и для mainline (Fixes: 93c4739, Cc: stable).Что поменялось для пользователей:
Прямо сейчас — ничего:
webusb/useв configfs никто не включает, и приuse_webusb = 0дескриптор прежний (bcdUSB 2.00, BOS не отдаётся) — проверено.Дальше это нужно для Debug Network: планируется, что wb-utils будет включать WebUSB с landing page
https://10-200-200-1.<sn>.ip.wirenboard.com/(веб-интерфейс контроллера), когда в wb-mqtt-homeui настроен HTTPS. Важно: одного этого патча для появления уведомления не хватит — Chromium на Linux не читает дескрипторы у устройств с mass-storage интерфейсом (ShouldReadDescriptors()), а на Windows отправляет GET_URL только через интерфейс, привязанный к драйверу WinUSB, которого у связки RNDIS+MSC нет. Это решается на стороне гаджета отдельно; данный патч — необходимое, но не достаточное условие.Как проверял/а:
scripts/checkpatch.pl(mainline-версия, знает тегAssisted-by:): 0 warnings; остаётся толькоERROR: Missing Signed-off-by— по Documentation/process/coding-assistants.rst тег DCO ставит человек, см. ниже.libcomposite.koдля 6.8.0-wb161 (кросс-сборка, vermagic совпадает), загружен на WB 8.5 (wirenboard-ALFLOJF3, musb HS):use_webusb = 1: до патча хост видит bcdUSB 2.01, Chromium 144 — «USB Version: 2.0.1», landing page нет; после патча bcdUSB 2.10,chrome://usb-internalsпоказывает «USB Version: 2.1.0» и «WebUSB Landing Page: …», уведомление появляется, клик открывает веб-интерфейс по HTTPS без предупреждения о сертификате.use_webusb = 0(штатное состояние, HTTPS не настроен): bcdUSB 2.00, BOS не отдаётся, RNDIS и mass storage работают как раньше.composite_setup().AI-assisted:
Патч и changelog подготовлены с помощью LLM-ассистента (тег
Assisted-by: LLMпо Documentation/process/coding-assistants.rst). По той же инструкции ассистент не ставитSigned-off-by— его добавляет человек-отправитель, подтверждая DCO.