Kiibohd Controller
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

dfu.desc.c 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. // Originally Generated from MCHCK Toolkit
  2. /* Copyright (c) Jacob Alexander 2014-2015 <[email protected]>
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. // ----- Local Includes -----
  18. #include "dfu.desc.h"
  19. // ----- Generated Includes -----
  20. #include <buildvars.h>
  21. // ----- Structs -----
  22. static const struct usb_config_1 usb_config_1 = {
  23. .config = {
  24. .bLength = sizeof(struct usb_desc_config_t),
  25. .bDescriptorType = USB_DESC_CONFIG,
  26. .wTotalLength = sizeof(struct usb_config_1),
  27. .bNumInterfaces = 1,
  28. .bConfigurationValue = 1,
  29. .iConfiguration = 0,
  30. .one = 1,
  31. .bMaxPower = 100
  32. },
  33. .usb_function_0 = {
  34. .iface = {
  35. .bLength = sizeof(struct usb_desc_iface_t),
  36. .bDescriptorType = USB_DESC_IFACE,
  37. .bInterfaceNumber = 0,
  38. .bAlternateSetting = 0,
  39. .bNumEndpoints = 0,
  40. .bInterfaceClass = USB_DEV_CLASS_APP,
  41. .bInterfaceSubClass = USB_DEV_SUBCLASS_APP_DFU,
  42. .bInterfaceProtocol = USB_DEV_PROTO_DFU_DFU,
  43. .iInterface = 4
  44. },
  45. .dfu = {
  46. .bLength = sizeof(struct dfu_desc_functional),
  47. .bDescriptorType = {
  48. .id = 0x1,
  49. .type_type = USB_DESC_TYPE_CLASS
  50. },
  51. .will_detach = 1,
  52. .manifestation_tolerant = 0,
  53. .can_upload = 1,
  54. .can_download = 1,
  55. .wDetachTimeOut = 0,
  56. .wTransferSize = USB_DFU_TRANSFER_SIZE,
  57. .bcdDFUVersion = { .maj = 1, .min = 1 }
  58. }
  59. },
  60. };
  61. static const struct usbd_config usbd_config_1 = {
  62. .init = init_usb_bootloader,
  63. .suspend = NULL,
  64. .resume = NULL,
  65. .desc = &usb_config_1.config,
  66. .function = {&dfu_function},
  67. };
  68. static const struct usb_desc_dev_t dfu_device_dev_desc = {
  69. .bLength = sizeof(struct usb_desc_dev_t),
  70. .bDescriptorType = USB_DESC_DEV,
  71. .bcdUSB = { .maj = 2 },
  72. .bDeviceClass = USB_DEV_CLASS_SEE_IFACE,
  73. .bDeviceSubClass = USB_DEV_SUBCLASS_SEE_IFACE,
  74. .bDeviceProtocol = USB_DEV_PROTO_SEE_IFACE,
  75. .bMaxPacketSize0 = EP0_BUFSIZE,
  76. .idVendor = VENDOR_ID,
  77. .idProduct = PRODUCT_ID,
  78. .bcdDevice = { .raw = 0 },
  79. .iManufacturer = 1,
  80. .iProduct = 2,
  81. .iSerialNumber = 3,
  82. .bNumConfigurations = 1,
  83. };
  84. static const struct usb_desc_string_t * const dfu_device_str_desc[] = {
  85. USB_DESC_STRING_LANG_ENUS,
  86. USB_DESC_STRING(STR_MANUFACTURER),
  87. USB_DESC_STRING(STR_PRODUCT),
  88. USB_DESC_STRING(STR_SERIAL),
  89. USB_DESC_STRING(STR_ALTNAME),
  90. NULL
  91. };
  92. const struct usbd_device dfu_device = {
  93. .dev_desc = &dfu_device_dev_desc,
  94. .string_descs = dfu_device_str_desc,
  95. .configs = {
  96. &usbd_config_1,
  97. NULL
  98. }
  99. };