mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-09 17:11:42 +00:00
The WebUSB specification defines a specific Platform Descriptor in the Binary Object Store: https://wicg.github.io/webusb/#webusb-platform-capability-descriptor This descriptor provides a special 'Landing page' URL to the host browser and associated privileges for it. Bump the USB version for BOS descriptors to 2.1 to be compatible with Chrome implementation. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=none BRANCH=twinkie TEST=manual: on Twinkie (chip/stm32) and HG proto2 (chip/g), enumerate WebUSB descriptors with lsusb and connect to a WebUSB page in Chrome R61+. Change-Id: I7211ab554f4a6c156c1e8e79a3d9f0d6644217c6 Reviewed-on: https://chromium-review.googlesource.com/664813 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
47 lines
1.2 KiB
C
47 lines
1.2 KiB
C
/* Copyright 2017 The Chromium OS Authors. All rights reserved.
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
/* WebUSB platform descriptor */
|
|
|
|
#include "common.h"
|
|
#include "usb_descriptor.h"
|
|
#include "util.h"
|
|
|
|
#ifndef CONFIG_USB_BOS
|
|
#error "CONFIG_USB_BOS must be defined to use WebUSB descriptor"
|
|
#endif
|
|
|
|
const void *webusb_url = USB_URL_DESC(HTTPS, CONFIG_WEBUSB_URL);
|
|
|
|
/*
|
|
* Platform Descriptor in the device Binary Object Store
|
|
* as defined by USB 3.1 spec chapter 9.6.2.
|
|
*/
|
|
static struct {
|
|
struct usb_bos_hdr_descriptor bos;
|
|
struct usb_platform_descriptor platform;
|
|
} bos_desc = {
|
|
.bos = {
|
|
.bLength = USB_DT_BOS_SIZE,
|
|
.bDescriptorType = USB_DT_BOS,
|
|
.wTotalLength = (USB_DT_BOS_SIZE + USB_DT_PLATFORM_SIZE),
|
|
.bNumDeviceCaps = 1, /* platform caps */
|
|
},
|
|
.platform = {
|
|
.bLength = USB_DT_PLATFORM_SIZE,
|
|
.bDescriptorType = USB_DT_DEVICE_CAPABILITY,
|
|
.bDevCapabilityType = USB_DC_DTYPE_PLATFORM,
|
|
.bReserved = 0,
|
|
.PlatformCapUUID = USB_PLAT_CAP_WEBUSB,
|
|
.bcdVersion = 0x0100,
|
|
.bVendorCode = 0x01,
|
|
.iLandingPage = 1,
|
|
},
|
|
};
|
|
|
|
const struct bos_context bos_ctx = {
|
|
.descp = (void *)&bos_desc,
|
|
.size = sizeof(bos_desc),
|
|
};
|