Skip to content

Instantly share code, notes, and snippets.

@lupyuen
Last active December 17, 2018 08:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lupyuen/ac26b8a2148a20de9c367c0b7b745560 to your computer and use it in GitHub Desktop.
Save lupyuen/ac26b8a2148a20de9c367c0b7b745560 to your computer and use it in GitHub Desktop.
// USB Device
static const struct usb_device_descriptor dev = {
.bLength = USB_DT_DEVICE_SIZE, // Length of this descriptor.
.bDescriptorType = USB_DT_DEVICE, // This is a Device Descriptor.
.bcdUSB = 0x0210, // USB Version 2.1. Need to handle special requests e.g. BOS.
.bDeviceClass = USB_CLASS_MISCELLANEOUS, // Miscellaneous Class. For composite device, let host probe the interfaces.
.bDeviceSubClass = 2, // Miscellaneous Common Class
.bDeviceProtocol = 1, // Use Interface Association Descriptor
.bMaxPacketSize0 = 64, // USB packet size
.idVendor = USB_VID, // Official USB Vendor ID
.idProduct = USB_PID, // Official USB Product ID
.bcdDevice = 0x0220, // Device Release number 2.2
.iManufacturer = 1, // Name of maufacturer (index of string descriptor)
.iProduct = 2, // Name of product (index of string descriptor)
.iSerialNumber = 2, // Serial number (index of string descriptor)
.bNumConfigurations = 1, // How many configurations we support
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment