Example #1
0
	.wMaxPacketSize = usb_cpu_to_le16((uint16_t)4),
	.bInterval = 10, /* resolution in ms */
};

static const UsbDescHeader *usb_hid_config[] =
{
	(const UsbDescHeader *)&usb_hid_config_descriptor,
	(const UsbDescHeader *)&usb_hid_interface_descriptor,
	(const UsbDescHeader *)&usb_hid_descriptor,
	(const UsbDescHeader *)&usb_hid_ep_descriptor,
	NULL,
};

static const DEFINE_USB_STRING(language_str, "\x09\x04"); // Language ID: en_US
static const DEFINE_USB_STRING(manufacturer_str,
		USB_STRING("B", "e", "R", "T", "O", "S"));
static const DEFINE_USB_STRING(product_str,
		USB_STRING("U", "S", "B", " ",
				"K", "e", "y", "b", "o", "a", "r", "d"));

static const UsbStringDesc *usb_hid_strings[] =
{
	(const UsbStringDesc *)&language_str,
	(const UsbStringDesc *)&manufacturer_str,
	(const UsbStringDesc *)&product_str,
	NULL,
};

static uint8_t report[8];

static bool hid_keyboard_configured;
Example #2
0
    .bInterval = 0,
};

static const UsbDescHeader *usb_serial_config[] =
{
    (const UsbDescHeader *)&usb_serial_config_descriptor,
    (const UsbDescHeader *)&usb_serial_interface_descriptor,
    (const UsbDescHeader *)&usb_serial_ep_report_descriptor,
    (const UsbDescHeader *)&usb_serial_ep_in_descriptor,
    (const UsbDescHeader *)&usb_serial_ep_out_descriptor,
    NULL,
};

static const DEFINE_USB_STRING(language_str, "\x09\x04"); // Language ID: en_US
static const DEFINE_USB_STRING(manufacturer_str,
                               USB_STRING("B", "e", "R", "T", "O", "S"));
static const DEFINE_USB_STRING(product_str,
                               USB_STRING("U", "S", "B", "-", "s", "e", "r", "i", "a", "l"));
static const DEFINE_USB_STRING(serial_str,
                               USB_STRING("0", "0", "1"));

static const UsbStringDesc *usb_serial_strings[] =
{
    (const UsbStringDesc *)&language_str,
    (const UsbStringDesc *)&manufacturer_str,
    (const UsbStringDesc *)&product_str,
    (const UsbStringDesc *)&serial_str,
    NULL,
};

/* Global usb-serial descriptor that identifies the usb-serial device */