This repository was archived by the owner on Mar 26, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -160,6 +160,8 @@ struct usb_descriptor_set {
160160 usb_configuration_set_c * configs ;
161161 uint8_t string_count ;
162162 usb_ascii_string_c * strings ;
163+ uint8_t capability_count ;
164+ usb_desc_generic_c * capabilities ;
163165};
164166
165167typedef __code const struct usb_descriptor_set
Original file line number Diff line number Diff line change @@ -54,6 +54,12 @@ enum usb_descriptor {
5454 USB_DESC_DEVICE_QUALIFIER = 6 ,
5555 USB_DESC_OTHER_SPEED_CONFIGURATION = 7 ,
5656 USB_DESC_INTERFACE_POWER = 8 ,
57+ USB_DESC_BINARY_OBJECT_STORE = 15 ,
58+ USB_DESC_DEVICE_CAPABILITY = 16 ,
59+ };
60+
61+ enum usb_device_capability {
62+ USB_DEV_CAP_PLATFORM = 5 ,
5763};
5864
5965enum usb_feature {
@@ -232,4 +238,14 @@ struct usb_desc_string {
232238typedef __code const struct usb_desc_string
233239 usb_desc_string_c ;
234240
241+ struct usb_desc_binary_object_store {
242+ uint8_t bLength ;
243+ uint8_t bDescriptorType ;
244+ uint16_t wTotalLength ;
245+ uint8_t bNumDeviceCaps ;
246+ };
247+
248+ typedef __code const struct usb_desc_binary_object_store
249+ usb_binary_object_store_c ;
250+
235251#endif
Original file line number Diff line number Diff line change @@ -210,6 +210,20 @@ void usb_serve_descriptor(usb_descriptor_set_c *set,
210210 * buf ++ = 0 ;
211211 scratch [0 ] += 2 ;
212212 }
213+ } else if (type == USB_DESC_BINARY_OBJECT_STORE && index == 0 ) {
214+ __xdata struct usb_desc_binary_object_store * bos_desc =
215+ (__xdata struct usb_desc_binary_object_store * )buf ;
216+ bos_desc -> bLength = sizeof (struct usb_desc_binary_object_store );
217+ bos_desc -> bDescriptorType = USB_DESC_BINARY_OBJECT_STORE ;
218+ // bos_desc->wTotalLength filled in later
219+ bos_desc -> bNumDeviceCaps = set -> capability_count ;
220+ buf += bos_desc -> bLength ;
221+ for (uint8_t i = 0 ; i < bos_desc -> bNumDeviceCaps ; i ++ ) {
222+ APPEND (& set -> capabilities [i ]);
223+ }
224+ bos_desc -> wTotalLength = (uint16_t )(buf - scratch );
225+ SETUP_EP0_IN_DATA (scratch , bos_desc -> wTotalLength );
226+ return ;
213227 } else {
214228 STALL_EP0 ();
215229 return ;
You can’t perform that action at this time.
0 commit comments