1 /*
2  * Copyright (c) 2018 Intel Corporation
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #if defined(CONFIG_USB_DEVICE_OS_DESC)
8 #define USB_OSDESC_EXTENDED_COMPAT_ID	0x04
9 
10 /*
11  * Devices supporting Microsoft OS Descriptors store special string
12  * descriptor at fixed index (0xEE). It is read when a new device is
13  * attached to a computer for the first time.
14  */
15 #define USB_OSDESC_STRING_DESC_INDEX	0xEE
16 
17 struct usb_os_descriptor {
18 	uint8_t *string;
19 	size_t string_len;
20 	uint8_t vendor_code;
21 
22 	uint8_t *compat_id;
23 	size_t compat_id_len;
24 };
25 
26 int usb_handle_os_desc(struct usb_setup_packet *setup,
27 		       int32_t *len, uint8_t **data_buf);
28 int usb_handle_os_desc_feature(struct usb_setup_packet *setup,
29 			       int32_t *len, uint8_t **data_buf);
30 void usb_register_os_desc(struct usb_os_descriptor *desc);
31 bool usb_os_desc_enabled(void);
32 #else
33 #define usb_os_desc_enabled(x)			false
34 #define usb_handle_os_desc(x, y, z)		-ENOTSUP
35 #define usb_handle_os_desc_feature(x, y, z)	-ENOTSUP
36 #define usb_register_os_desc(x)
37 #endif
38