Remove deprecated WebUSB Allowed Origins header

This commit is contained in:
William Toohey
2017-05-05 01:47:02 +10:00
parent 5d94a9c930
commit f4e98c1a50
4 changed files with 10 additions and 61 deletions
+4 -27
View File
@@ -1,7 +1,6 @@
#include "Descriptors.h"
const USB_Descriptor_URL_t ConfigURL = URL_STRING_DESCRIPTOR(URL_HTTPS, "mon.im");
const USB_Descriptor_URL_t LocalhostURL = URL_STRING_DESCRIPTOR(URL_HTTP, "localhost");
const USB_Descriptor_String_t ProductString = USB_STRING_DESCRIPTOR(L"Voltex Boot");
const USB_Descriptor_String_t LanguageString = USB_STRING_DESCRIPTOR_ARRAY(LANGUAGE_ID_ENG);
@@ -13,15 +12,6 @@ const uint8_t MS_OS_Descriptor[] =
)
};
const uint8_t WebUSBAllowedOrigins[] = {
WEBUSB_ALLOWED_ORIGINS_HEADER
(
0, // no config header
// Config interface accessible from the web, 2 valid URLs
URL_ID_Config, URL_ID_Localhost
)
};
const uint8_t BOSDescriptor[] =
{
BOS_DESCRIPTOR
@@ -105,23 +95,10 @@ void USB_Process_BOS(void) {
switch(USB_ControlRequest.bRequest) {
case WEBUSB_ID:
switch(USB_ControlRequest.wIndex) {
case WEBUSB_REQUEST_GET_ALLOWED_ORIGINS:
Address = &WebUSBAllowedOrigins;
Size = sizeof(WebUSBAllowedOrigins);
break;
case WEBUSB_REQUEST_GET_URL:
switch(USB_ControlRequest.wValue) {
case URL_ID_Localhost:
Address = &LocalhostURL;
Size = LocalhostURL.Header.Size;
break;
case URL_ID_Config:
Address = &ConfigURL;
Size = ConfigURL.Header.Size;
break;
}
break;
if(USB_ControlRequest.wIndex == WEBUSB_REQUEST_GET_URL &&
USB_ControlRequest.wValue == URL_ID_Config) {
Address = &ConfigURL;
Size = ConfigURL.Header.Size;
}
break;
case MS_OS_ID:
+1 -2
View File
@@ -56,8 +56,7 @@
enum URLDescriptors_t
{
URL_ID_Localhost = 1,
URL_ID_Config = 2,
URL_ID_Config = 1,
};
enum StringDescriptors_t
+4 -30
View File
@@ -149,19 +149,6 @@ const uint8_t PROGMEM MS_OS_Descriptor[] =
)
};
const uint8_t PROGMEM WebUSBAllowedOrigins[] = {
WEBUSB_ALLOWED_ORIGINS_HEADER
(
1, // 1 config header present
WEBUSB_CONFIG_SUBSET_HEADER
(
0x00, 1, // Config 0, 1 function header
// Config interface accessible from the web, 2 valid URLs
WEBUSB_FUNCTION_SUBSET_HEADER(INTERFACE_ID_Config, URL_ID_Config, URL_ID_Localhost)
)
)
};
const uint8_t PROGMEM BOSDescriptor[] =
{
BOS_DESCRIPTOR
@@ -380,23 +367,10 @@ void USB_Process_BOS(void) {
}
switch(USB_ControlRequest.bRequest) {
case WEBUSB_ID:
switch(USB_ControlRequest.wIndex) {
case WEBUSB_REQUEST_GET_ALLOWED_ORIGINS:
Address = &WebUSBAllowedOrigins;
Size = sizeof(WebUSBAllowedOrigins);
break;
case WEBUSB_REQUEST_GET_URL:
switch(USB_ControlRequest.wValue) {
case URL_ID_Localhost:
Address = &LocalhostURL;
Size = pgm_read_byte(&LocalhostURL.Header.Size);
break;
case URL_ID_Config:
Address = &ConfigURL;
Size = pgm_read_byte(&ConfigURL.Header.Size);
break;
}
break;
if(USB_ControlRequest.wIndex == WEBUSB_REQUEST_GET_URL &&
USB_ControlRequest.wValue == URL_ID_Config) {
Address = &ConfigURL;
Size = pgm_read_byte(&ConfigURL.Header.Size);
}
break;
case MS_OS_ID:
+1 -2
View File
@@ -58,8 +58,7 @@
enum URLDescriptors_t
{
URL_ID_Localhost = 1,
URL_ID_Config = 2,
URL_ID_Config = 1,
};
/** Enum for the HID report IDs used in the device. */