mirror of
https://github.com/im-tomu/foboot.git
synced 2024-09-20 02:40:09 +00:00
sw: webusb: fix landing descriptor warning
For some reason, -flto didn't like the "extern const struct" definition. Hide the variable now and use an accessor function to silence this warning, which may have caused other issues with stability. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
ba310ab8e2
commit
5d6a0d0ec7
@ -90,6 +90,6 @@ extern const usb_descriptor_list_t usb_descriptor_list[];
|
||||
#define LANDING_PAGE_DESCRIPTOR_SIZE (WEBUSB_DT_URL_DESCRIPTOR_SIZE \
|
||||
+ sizeof(LANDING_PAGE_URL) - 1)
|
||||
|
||||
extern const struct webusb_url_descriptor landing_url_descriptor;
|
||||
const uint8_t *get_landing_url_descriptor(uint32_t *datalen);
|
||||
|
||||
#endif
|
||||
|
@ -166,13 +166,19 @@ const uint8_t usb_microsoft_wcid[MSFT_WCID_LEN] = {
|
||||
0,0,0,0,0,0, // Reserved
|
||||
};
|
||||
|
||||
const struct webusb_url_descriptor landing_url_descriptor = {
|
||||
static const struct webusb_url_descriptor landing_url_descriptor = {
|
||||
.bLength = LANDING_PAGE_DESCRIPTOR_SIZE,
|
||||
.bDescriptorType = WEBUSB_DT_URL,
|
||||
.bScheme = WEBUSB_URL_SCHEME_HTTPS,
|
||||
.URL = LANDING_PAGE_URL
|
||||
};
|
||||
|
||||
const uint8_t *get_landing_url_descriptor(uint32_t *datalen) {
|
||||
// Return landing page URL descriptor
|
||||
*datalen = LANDING_PAGE_DESCRIPTOR_SIZE;
|
||||
return (const uint8_t*)&landing_url_descriptor;
|
||||
}
|
||||
|
||||
struct full_bos {
|
||||
struct usb_bos_descriptor bos;
|
||||
struct webusb_platform_descriptor webusb;
|
||||
|
@ -126,9 +126,7 @@ void usb_setup(const struct usb_setup_request *setup)
|
||||
{
|
||||
if (setup->wValue == 0x0001)
|
||||
{
|
||||
// Return landing page URL descriptor
|
||||
data = (uint8_t*)&landing_url_descriptor;
|
||||
datalen = LANDING_PAGE_DESCRIPTOR_SIZE;
|
||||
data = get_landing_url_descriptor(&datalen);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user