Go to the documentation of this file.
18#ifndef __VSF_USBD_WEBUSB_H__
19#define __VSF_USBD_WEBUSB_H__
25#if VSF_USE_USB_DEVICE == ENABLED
33#define USB_BOS_CAP_WEBUSB_LEN USB_DESC_BOS_CAPABILITY_LEN(4)
35#define USB_DT_WEBUSB_URL 0x03
36#define USB_REQ_WEBUSB_GET_URL 0x02
38#define WEBUSB_URL_PREFIX_HTTP 0x00
39#define WEBUSB_URL_PREFIX_HTTPS 0x01
40#define WEBUSB_URL_PREFIX_NONE 0xFF
44#define USB_WEBUSB_URL_DESC(__PREFIX, __URL_LEN, ...) \
50#define __bos_desc_webusb(__vendor_code, __landing_page) \
51 USB_DESC_BOS_CAPABILITY_HEADER(4, 5, \
52 0x38, 0xB6, 0x08, 0x34, \
53 0xA9, 0x09, 0xA0, 0x47, \
54 0x8B, 0xFD, 0xA0, 0x76, \
55 0x88, 0x15, 0xB6, 0x65, \
57 USB_DESC_WORD(0x0100), \
61#define bos_desc_webusb(__vendor_code, __landing_page) \
62 __bos_desc_webusb((__vendor_code), (__landing_page))
64#define __usbd_webusb_url_desc(__name, __landing_page, __prefix, __url_len, __url)\
67 uint8_t bDescriptorType; \
69 char url_utf8[(__url_len) + 3]; \
70 } VSF_CAL_PACKED const __##__name##_webusb_url##__landing_page##_desc = {\
71 .bLength = 6 + (__url_len), \
72 .bDescriptorType = USB_DT_WEBUSB_URL, \
73 .bScheme = (__prefix), \
74 .url_utf8 = (__url), \
77#define usbd_webusb_url_desc(__name, __landing_page, __prefix, __url_len, __url)\
78 __usbd_webusb_url_desc(__name, __landing_page, (__prefix), (__url_len), (__url))
80#define __usbd_webusb_url_desc_buffer(__name, __landing_page) \
81 &__##__name##_webusb_url##__landing_page##_desc
82#define __usbd_webusb_url_desc_len(__name, __landing_page) \
83 sizeof(__##__name##_webusb_url##__landing_page##_desc)
84#define usbd_webusb_url_desc_buffer(__name, __landing_page) \
85 __usbd_webusb_url_desc_buffer(__name, __landing_page)
86#define usbd_webusb_url_desc_len(__name, __landing_page) \
87 __usbd_webusb_url_desc_len(__name, __landing_page)