49 #include "os_io_usb.h"
56 #include "usbd_ctlreq.h"
58 #include "usbd_core.h"
62 #include "os_io_seproxyhal.h"
64 #pragma GCC diagnostic push
65 #pragma GCC diagnostic ignored "-Wcast-qual"
72 #ifdef HAVE_USB_CLASS_CCID
73 #include "usbd_ccid_core.h"
118 #define USBD_LANGID_STRING 0x409
121 #ifdef HAVE_VID_PID_PROBER
122 #define USBD_VID 0x2581
123 #define USBD_PID 0xf1d1
124 static uint8_t const USBD_PRODUCT_FS_STRING[] = {
126 USB_DESC_TYPE_STRING,
139 #define USBD_VID 0x2C97
141 #if defined(TARGET_NANOS)
142 #ifndef HAVE_LEGACY_PID
143 #define USBD_PID 0x1000
145 #define USBD_PID 0x0001
147 static uint8_t const USBD_PRODUCT_FS_STRING[] = {
149 USB_DESC_TYPE_STRING,
157 #elif defined(TARGET_HW2)
158 #ifndef HAVE_LEGACY_PID
159 #define USBD_PID 0x3000
161 #define USBD_PID 0x0003
163 static uint8_t const USBD_PRODUCT_FS_STRING[] = {
165 USB_DESC_TYPE_STRING,
170 #elif defined(TARGET_NANOX)
171 #ifndef HAVE_LEGACY_PID
172 #define USBD_PID 0x4000
174 #define USBD_PID 0x0004
176 static uint8_t const USBD_PRODUCT_FS_STRING[] = {
178 USB_DESC_TYPE_STRING,
186 #elif defined(TARGET_NANOS2)
187 #ifndef HAVE_LEGACY_PID
188 #define USBD_PID 0x5000
190 #define USBD_PID 0x0005
192 static uint8_t const USBD_PRODUCT_FS_STRING[] = {
194 USB_DESC_TYPE_STRING,
207 #elif defined(TARGET_STAX)
208 #ifndef HAVE_LEGACY_PID
209 #define USBD_PID 0x6000
211 #define USBD_PID 0x0006
213 static uint8_t const USBD_PRODUCT_FS_STRING[] = {
215 USB_DESC_TYPE_STRING,
228 #elif defined(TARGET_FLEX)
229 #ifndef HAVE_LEGACY_PID
230 #define USBD_PID 0x7000
232 #define USBD_PID 0x0007
234 static uint8_t const USBD_PRODUCT_FS_STRING[] = {
236 USB_DESC_TYPE_STRING,
250 #error unknown TARGET_NAME
255 static uint8_t const USBD_LangIDDesc[]=
257 USB_LEN_LANGID_STR_DESC,
258 USB_DESC_TYPE_STRING,
263 static uint8_t const USB_SERIAL_STRING[] =
266 USB_DESC_TYPE_STRING,
273 static uint8_t const USBD_MANUFACTURER_STRING[] = {
275 USB_DESC_TYPE_STRING,
284 #define USBD_INTERFACE_FS_STRING USBD_PRODUCT_FS_STRING
285 #define USBD_CONFIGURATION_FS_STRING USBD_PRODUCT_FS_STRING
287 #ifndef HAVE_USB_HIDKBD
289 static uint8_t const HID_ReportDesc[] = {
314 static uint8_t const HID_ReportDesc_kbd[] = {
351 static uint8_t const HID_ReportDesc_fido[] = {
369 0x95, U2F_EPOUT_SIZE,
375 #define ARRAY_U2LE(l) (l)&0xFF, (l)>>8
377 #define CFG_HDR_LEN (0x9)
378 #define CFG_HIDGEN_LEN (0x9+0x9+0x7+0x7)
379 #define CFG_IO_U2F_LEN (0x9+0x9+0x7+0x7)
380 #define CFG_USB_CCID_LEN (0x9+0x36+0x7+0x7)
381 #define CFG_WEBUSB_LEN (0x9+0x7+0x7)
384 #ifdef HAVE_USB_CLASS_CCID
388 static __ALIGN_BEGIN
uint8_t const N_USBD_CfgDesc[] __ALIGN_END =
390 static __ALIGN_BEGIN
uint8_t const USBD_CfgDesc[] __ALIGN_END =
394 USB_DESC_TYPE_CONFIGURATION,
400 #ifdef HAVE_USB_CLASS_CCID
411 #ifdef HAVE_USB_CLASS_CCID
419 USBD_IDX_PRODUCT_STR,
423 #ifndef HAVE_USB_HIDKBD
428 USB_DESC_TYPE_INTERFACE,
435 USBD_IDX_PRODUCT_STR,
445 sizeof(HID_ReportDesc),
450 USB_DESC_TYPE_ENDPOINT,
458 USB_DESC_TYPE_ENDPOINT,
470 USB_DESC_TYPE_INTERFACE,
477 USBD_IDX_PRODUCT_STR,
487 sizeof(HID_ReportDesc_kbd),
491 USB_DESC_TYPE_ENDPOINT,
499 USB_DESC_TYPE_ENDPOINT,
512 USB_DESC_TYPE_INTERFACE,
519 USBD_IDX_PRODUCT_STR,
529 sizeof(HID_ReportDesc_fido),
533 USB_DESC_TYPE_ENDPOINT,
541 USB_DESC_TYPE_ENDPOINT,
549 #ifdef HAVE_USB_CLASS_CCID
605 0xBA, 0x06, 0x02, 0x00,
635 LOBYTE(CCID_BULK_EPIN_SIZE),
636 HIBYTE(CCID_BULK_EPIN_SIZE),
643 LOBYTE(CCID_BULK_EPOUT_SIZE),
644 HIBYTE(CCID_BULK_EPOUT_SIZE),
653 USB_DESC_TYPE_INTERFACE,
660 USBD_IDX_PRODUCT_STR,
664 USB_DESC_TYPE_ENDPOINT,
672 USB_DESC_TYPE_ENDPOINT,
683 __ALIGN_BEGIN
uint8_t const USBD_HID_Desc_fido[] __ALIGN_END =
693 sizeof(HID_ReportDesc_fido),
698 #ifndef HAVE_USB_HIDKBD
700 __ALIGN_BEGIN
uint8_t const USBD_HID_Desc[] __ALIGN_END =
710 sizeof(HID_ReportDesc),
715 __ALIGN_BEGIN
uint8_t const USBD_HID_Desc_kbd[] __ALIGN_END =
725 sizeof(HID_ReportDesc_kbd),
731 static __ALIGN_BEGIN
uint8_t const USBD_DeviceQualifierDesc[] __ALIGN_END =
733 USB_LEN_DEV_QUALIFIER_DESC,
734 USB_DESC_TYPE_DEVICE_QUALIFIER,
746 static uint8_t const USBD_DeviceDesc[]= {
748 USB_DESC_TYPE_DEVICE,
769 USBD_IDX_PRODUCT_STR,
781 static uint8_t *USBD_DeviceDescriptor(USBD_SpeedTypeDef speed,
uint16_t *length)
784 *length =
sizeof(USBD_DeviceDesc);
785 return (
uint8_t *) USBD_DeviceDesc;
794 static uint8_t *USBD_LangIDStrDescriptor(USBD_SpeedTypeDef speed,
uint16_t *length)
797 *length =
sizeof(USBD_LangIDDesc);
798 return (
uint8_t *) USBD_LangIDDesc;
807 static uint8_t *USBD_ProductStrDescriptor(USBD_SpeedTypeDef speed,
uint16_t *length)
810 *length =
sizeof(USBD_PRODUCT_FS_STRING);
811 return (
uint8_t *) USBD_PRODUCT_FS_STRING;
820 static uint8_t *USBD_ManufacturerStrDescriptor(USBD_SpeedTypeDef speed,
uint16_t *length)
823 *length =
sizeof(USBD_MANUFACTURER_STRING);
824 return (
uint8_t *) USBD_MANUFACTURER_STRING;
833 static uint8_t *USBD_SerialStrDescriptor(USBD_SpeedTypeDef speed,
uint16_t *length)
836 *length =
sizeof(USB_SERIAL_STRING);
837 return (
uint8_t *) USB_SERIAL_STRING;
846 static uint8_t *USBD_ConfigStrDescriptor(USBD_SpeedTypeDef speed,
uint16_t *length)
859 static uint8_t *USBD_InterfaceStrDescriptor(USBD_SpeedTypeDef speed,
uint16_t *length)
874 *length =
sizeof(USBD_DeviceQualifierDesc);
875 return (
uint8_t *) USBD_DeviceQualifierDesc;
887 #ifdef HAVE_USB_CLASS_CCID
888 *length =
sizeof(N_USBD_CfgDesc);
889 return (
uint8_t *) N_USBD_CfgDesc;
891 *length =
sizeof(USBD_CfgDesc);
892 return (
uint8_t *) USBD_CfgDesc;
898 switch (USBD_Device.request.wIndex & 0xFF) {
901 *len =
sizeof(USBD_HID_Desc_fido);
902 return (
uint8_t *) USBD_HID_Desc_fido;
904 #ifndef HAVE_USB_HIDKBD
906 *len =
sizeof(USBD_HID_Desc);
907 return (
uint8_t *) USBD_HID_Desc;
910 *len =
sizeof(USBD_HID_Desc_kbd);
911 return (
uint8_t *) USBD_HID_Desc_kbd;
920 switch (USBD_Device.request.wIndex & 0xFF) {
923 *len =
sizeof(HID_ReportDesc_fido);
924 return (
uint8_t *) HID_ReportDesc_fido;
926 #ifndef HAVE_USB_HIDKBD
928 *len =
sizeof(HID_ReportDesc);
929 return (
uint8_t *) HID_ReportDesc;
932 *len =
sizeof(HID_ReportDesc_kbd);
933 return (
uint8_t *) HID_ReportDesc_kbd;
940 #ifdef HAVE_USB_CLASS_CCID
947 unsigned short length = 0;
949 unsigned short offset = 0;
951 cfgDesc = USBD_GetCfgDesc_impl(&length);
964 return (
const volatile uint8_t *) (cfgDesc + offset);
997 USBD_LL_OpenEP(pdev, U2F_EPIN_ADDR, USBD_EP_TYPE_INTR, U2F_EPIN_SIZE);
1000 USBD_LL_OpenEP(pdev, U2F_EPOUT_ADDR, USBD_EP_TYPE_INTR, U2F_EPOUT_SIZE);
1008 uint8_t USBD_U2F_DataIn_impl(USBD_HandleTypeDef *pdev,
uint8_t epnum)
1014 case (U2F_EPIN_ADDR & 0x7F):
1022 uint8_t USBD_U2F_DataOut_impl(USBD_HandleTypeDef *pdev,
1027 #ifdef HAVE_LOCAL_APDU_BUFFER
1028 #error "Feature not implemented"
1033 case (U2F_EPOUT_ADDR & 0x7F):
1036 &G_io_u2f, buffer, io_seproxyhal_get_ep_rx_size(U2F_EPOUT_ADDR),
U2F_MEDIA_USB);
1050 io_usb_hid_sent(io_usb_send_apdu_data);
1059 #ifndef HAVE_USB_HIDKBD
1061 apdu_buffer_t *apdu_buf
1075 #ifndef HAVE_USB_HIDKBD
1077 if (G_io_app.apdu_media == IO_APDU_MEDIA_NONE) {
1079 switch (io_usb_hid_receive(io_usb_send_apdu_data,
1086 case IO_USB_APDU_RECEIVED:
1087 G_io_app.apdu_media = IO_APDU_MEDIA_USB_HID;
1088 G_io_app.apdu_state = APDU_USB_HID;
1089 G_io_app.apdu_length = G_io_usb_hid_total_length;
1102 uint8_t USBD_WEBUSB_Init(USBD_HandleTypeDef *pdev,
uint8_t cfgidx)
1107 USBD_LL_OpenEP(pdev, WEBUSB_EPIN_ADDR, USBD_EP_TYPE_INTR, WEBUSB_EPIN_SIZE);
1110 USBD_LL_OpenEP(pdev, WEBUSB_EPOUT_ADDR, USBD_EP_TYPE_INTR, WEBUSB_EPOUT_SIZE);
1118 uint8_t USBD_WEBUSB_DeInit(USBD_HandleTypeDef *pdev,
uint8_t cfgidx)
1125 uint8_t USBD_WEBUSB_Setup(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
1132 uint8_t USBD_WEBUSB_DataIn(USBD_HandleTypeDef *pdev,
uint8_t epnum)
1137 case (WEBUSB_EPIN_ADDR & 0x7F):
1138 io_usb_hid_sent(io_usb_send_apdu_data_ep0x83);
1144 uint8_t USBD_WEBUSB_DataOut(USBD_HandleTypeDef *pdev,
1147 apdu_buffer_t *apdu_buf)
1152 case (WEBUSB_EPOUT_ADDR & 0x7F):
1157 if (G_io_app.apdu_media == IO_APDU_MEDIA_NONE) {
1159 switch (io_usb_hid_receive(io_usb_send_apdu_data_ep0x83,
1161 io_seproxyhal_get_ep_rx_size(WEBUSB_EPOUT_ADDR),
1166 case IO_USB_APDU_RECEIVED:
1167 G_io_app.apdu_media = IO_APDU_MEDIA_USB_WEBUSB;
1168 G_io_app.apdu_state = APDU_USB_WEBUSB;
1169 G_io_app.apdu_length = G_io_usb_hid_total_length;
1180 #define WEBUSB_VENDOR_CODE 0x1E
1185 #define WEBUSB_UUID \
1186 0x38, 0xB6, 0x08, 0x34, 0xA9, 0x09, 0xA0, 0x47, 0x8B, 0xFD, 0xA0, 0x76, 0x88, 0x15, 0xB6, 0x65
1188 #define WEBUSB_REQ_GET_URL 0x02
1190 #define WEBUSB_DT_DESCRIPTOR_SET_HEADER 0
1191 #define WEBUSB_DT_CONFIGURATION_SUBSET_HEADER 1
1192 #define WEBUSB_DT_FUNCTION_SUBSET_HEADER 2
1193 #define WEBUSB_DT_URL 3
1195 #define WEBUSB_URL_SCHEME_HTTP 0
1196 #define WEBUSB_URL_SCHEME_HTTPS 1
1197 #define WEBUSB_URL_SCHEME_CUSTOM 255
1199 unsigned char const C_webusb_url_descriptor[] = {
1201 3 + WEBUSB_URL_SIZE_B,
1205 WEBUSB_URL_SCHEME_HTTPS,
1210 #define USB_DT_BOS 15
1211 #define USB_DT_DEVICE_CAPABILITY 16
1213 #define USB_DT_BOS_SIZE 5
1216 #define USB_DC_PLATFORM 5
1218 #define MS_OS_20_DESCRIPTOR_LENGTH (0xb2)
1220 #define WINUSB_VENDOR_CODE 0x77
1223 unsigned char const C_usb_bos[] = {
1231 USB_DT_DEVICE_CAPABILITY,
1238 #if WEBUSB_URL_SIZE_B > 0
1251 0xDF, 0x60, 0xDD, 0xD8,
1255 0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F,
1257 0x00, 0x00, 0x03, 0x06,
1258 MS_OS_20_DESCRIPTOR_LENGTH, 0x00,
1266 static uint8_t *USBD_BOSDescriptor(USBD_SpeedTypeDef speed,
uint16_t *length)
1270 *length =
sizeof(C_usb_bos);
1284 USBD_DeviceDescriptor,
1285 USBD_LangIDStrDescriptor,
1286 USBD_ManufacturerStrDescriptor,
1287 USBD_ProductStrDescriptor,
1288 USBD_SerialStrDescriptor,
1289 USBD_ConfigStrDescriptor,
1290 USBD_InterfaceStrDescriptor,
1295 static USBD_ClassTypeDef
const USBD_U2F = {
1302 USBD_U2F_DataIn_impl,
1303 USBD_U2F_DataOut_impl,
1307 USBD_GetCfgDesc_impl,
1308 USBD_GetCfgDesc_impl,
1309 USBD_GetCfgDesc_impl,
1310 USBD_GetDeviceQualifierDesc_impl,
1314 static USBD_ClassTypeDef
const USBD_HID = {
1326 USBD_GetCfgDesc_impl,
1327 USBD_GetCfgDesc_impl,
1328 USBD_GetCfgDesc_impl,
1329 USBD_GetDeviceQualifierDesc_impl,
1335 static const unsigned char C_winusb_string_descriptor[] = {
1339 USB_DESC_TYPE_STRING,
1341 'M', 0x00,
'S', 0x00,
'F', 0x00,
'T', 0x00,
'1', 0x00,
'0', 0x00,
'0', 0x00, WINUSB_VENDOR_CODE, 0x00,
1346 #define MS_OS_20_DESCRIPTOR_INDEX 0x07
1349 #define MS_OS_20_SUBSET_HEADER_CONFIGURATION 0x01
1350 #define MS_OS_20_SUBSET_HEADER_FUNCTION 0x02
1351 #define MS_OS_20_FEATURE_COMPATIBLE_ID 0x03
1352 #define MS_OS_20_FEATURE_REG_PROPERTY 0x04
1355 static const unsigned char C_winusb_request_descriptor[] = {
1365 MS_OS_20_DESCRIPTOR_LENGTH,
1370 MS_OS_20_SUBSET_HEADER_CONFIGURATION, 0x00,
1377 MS_OS_20_SUBSET_HEADER_FUNCTION, 0x00,
1385 MS_OS_20_FEATURE_COMPATIBLE_ID, 0x00,
1386 'W',
'I',
'N',
'U',
'S',
'B', 0x00, 0x00,
1387 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1390 MS_OS_20_FEATURE_REG_PROPERTY, 0x00,
1394 'D', 0x00,
'e', 0x00,
'v', 0x00,
'i', 0x00,
'c', 0x00,
'e', 0x00,
'I', 0x00,
'n', 0x00,
't', 0x00,
'e', 0x00,
1395 'r', 0x00,
'f', 0x00,
'a', 0x00,
'c', 0x00,
'e', 0x00,
'G', 0x00,
'U', 0x00,
'I', 0x00,
'D', 0x00,
's', 0x00,
1399 '{', 0x00,
'C', 0x00,
'E', 0x00,
'8', 0x00,
'0', 0x00,
'9', 0x00,
'2', 0x00,
'6', 0x00,
'4', 0x00,
'-', 0x00,
1400 '4', 0x00,
'B', 0x00,
'2', 0x00,
'4', 0x00,
'-', 0x00,
'4', 0x00,
'E', 0x00,
'8', 0x00,
'1', 0x00,
'-', 0x00,
1401 'A', 0x00,
'8', 0x00,
'B', 0x00,
'2', 0x00,
'-', 0x00,
'5', 0x00,
'7', 0x00,
'E', 0x00,
'D', 0x00,
'0', 0x00,
1402 '1', 0x00,
'D', 0x00,
'5', 0x00,
'8', 0x00,
'0', 0x00,
'E', 0x00,
'1', 0x00,
'}', 0x00, 0x00, 0x00, 0x00, 0x00
1405 #define WINUSB_GET_COMPATIBLE_ID_FEATURE 0x04
1406 static const unsigned char C_winusb_wcid[] = {
1408 0x28, 0x00, 0x00, 0x00,
1412 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1416 'W',
'I',
'N',
'U',
'S',
'B', 0x00, 0x00,
1417 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1419 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1422 #define WINUSB_GET_EXTENDED_PROPERTIES_OS_FEATURE 0x05
1423 static const unsigned char C_winusb_guid[] = {
1425 0x92, 0x00, 0x00, 0x00,
1430 0x88, 0x00, 0x00, 0x00,
1431 0x07, 0x00, 0x00, 0x00,
1433 'D', 0x00,
'e', 0x00,
'v', 0x00,
'i', 0x00,
'c', 0x00,
'e', 0x00,
1434 'I', 0x00,
'n', 0x00,
't', 0x00,
'e', 0x00,
'r', 0x00,
'f', 0x00,
1435 'a', 0x00,
'c', 0x00,
'e', 0x00,
'G', 0x00,
'U', 0x00,
'I', 0x00,
1436 'D', 0x00,
's', 0x00, 0x00, 0x00,
1437 0x50, 0x00, 0x00, 0x00,
1439 '{', 0x00,
'1', 0x00,
'3', 0x00,
'd', 0x00,
'6', 0x00,
'3', 0x00,
1440 '4', 0x00,
'0', 0x00,
'0', 0x00,
'-', 0x00,
'2', 0x00,
'C', 0x00,
1441 '9', 0x00,
'7', 0x00,
'-', 0x00,
'0', 0x00,
'0', 0x00,
'0', 0x00,
1442 '4', 0x00,
'-', 0x00,
'0', 0x00,
'0', 0x00,
'0', 0x00,
'0', 0x00,
1443 '-', 0x00,
'4', 0x00,
'c', 0x00,
'6', 0x00,
'5', 0x00,
'6', 0x00,
1444 '4', 0x00,
'6', 0x00,
'7', 0x00,
'6', 0x00,
'5', 0x00,
'7', 0x00,
1445 '2', 0x00,
'}', 0x00, 0x00, 0x00, 0x00, 0x00
1450 void USBD_CtlError(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
1452 #if WEBUSB_URL_SIZE_B > 0
1453 if ((req->bmRequest & 0x80) && req->bRequest == WEBUSB_VENDOR_CODE
1454 && req->wIndex == WEBUSB_REQ_GET_URL
1456 && req->wValue == 1) {
1458 USBD_CtlSendData(pdev,
1459 (
unsigned char *) C_webusb_url_descriptor,
1460 MIN(req->wLength,
sizeof(C_webusb_url_descriptor)));
1465 if ((req->bmRequest & 0x80) && req->bRequest == USB_REQ_GET_DESCRIPTOR
1466 && (req->wValue >> 8) == USB_DESC_TYPE_STRING && (req->wValue & 0xFF) == 0xEE) {
1467 USBD_CtlSendData(pdev,
1468 (
unsigned char *) C_winusb_string_descriptor,
1469 MIN(req->wLength,
sizeof(C_winusb_string_descriptor)));
1472 else if ((req->bmRequest & 0x80) && req->bRequest == WINUSB_VENDOR_CODE
1473 && req->wIndex == WINUSB_GET_COMPATIBLE_ID_FEATURE) {
1475 pdev, (
unsigned char *) C_winusb_wcid,
MIN(req->wLength,
sizeof(C_winusb_wcid)));
1478 else if ((req->bmRequest & 0x80) && req->bRequest == WINUSB_VENDOR_CODE
1479 && req->wIndex == WINUSB_GET_EXTENDED_PROPERTIES_OS_FEATURE) {
1481 pdev, (
unsigned char *) C_winusb_guid,
MIN(req->wLength,
sizeof(C_winusb_guid)));
1484 else if ((req->bmRequest & 0x80) && req->bRequest == WINUSB_VENDOR_CODE
1485 && req->wIndex == MS_OS_20_DESCRIPTOR_INDEX) {
1486 USBD_CtlSendData(pdev,
1487 (
unsigned char *) C_winusb_request_descriptor,
1488 MIN(req->wLength,
sizeof(C_winusb_request_descriptor)));
1491 USBD_CtlStall(pdev);
1495 static const USBD_ClassTypeDef USBD_WEBUSB = {
1502 USBD_WEBUSB_DataOut,
1506 USBD_GetCfgDesc_impl,
1507 USBD_GetCfgDesc_impl,
1508 USBD_GetCfgDesc_impl,
1509 USBD_GetDeviceQualifierDesc_impl,
1514 #ifdef HAVE_USB_CLASS_CCID
1515 static const USBD_ClassTypeDef USBD_CCID = {
1526 USBD_GetCfgDesc_impl,
1527 USBD_GetCfgDesc_impl,
1528 USBD_GetCfgDesc_impl,
1529 USBD_GetDeviceQualifierDesc_impl,
1536 atr_buffer[0] = 0x3B;
1541 void SC_Poweroff(
void)
1553 UNUSED(responseBuff);
1554 UNUSED(responseLen);
1562 memset(&USBD_Device, 0,
sizeof(USBD_Device));
1565 memset(G_io_app.usb_ep_xfer_len, 0,
sizeof(G_io_app.usb_ep_xfer_len));
1566 memset(G_io_app.usb_ep_timeouts, 0,
sizeof(G_io_app.usb_ep_timeouts));
1569 memset(&USBD_Device, 0,
sizeof(USBD_Device));
1571 USBD_Init(&USBD_Device, (USBD_DescriptorsTypeDef *) &
HID_Desc, 0);
1574 USBD_RegisterClassForInterface(
HID_INTF, &USBD_Device, (USBD_ClassTypeDef *) &USBD_HID);
1576 USBD_RegisterClassForInterface(U2F_INTF, &USBD_Device, (USBD_ClassTypeDef *) &USBD_U2F);
1580 #ifdef HAVE_USB_CLASS_CCID
1581 USBD_RegisterClassForInterface(CCID_INTF, &USBD_Device, (USBD_ClassTypeDef *) &USBD_CCID);
1585 USBD_RegisterClassForInterface(
1586 WEBUSB_INTF, &USBD_Device, (USBD_ClassTypeDef *) &USBD_WEBUSB);
1590 USBD_Start(&USBD_Device);
1593 USBD_DeInit(&USBD_Device);
1597 #pragma GCC diagnostic pop
const volatile uint8_t * USBD_GetPinPadOffset(void)
USBD_DescriptorsTypeDef const HID_Desc
void USB_power(unsigned char enabled)
#define USBD_LANGID_STRING
uint8_t * USBD_HID_GetReportDescriptor_impl(uint16_t *len)
#define USBD_CONFIGURATION_FS_STRING
uint8_t * USBD_HID_GetHidDescriptor_impl(uint16_t *len)
#define USBD_INTERFACE_FS_STRING
uint8_t USBD_HID_DataOut_impl(USBD_HandleTypeDef *pdev, uint8_t epnum, uint8_t *buffer, apdu_buffer_t *apdu_buf)
uint8_t USBD_HID_DataIn_impl(USBD_HandleTypeDef *pdev, uint8_t epnum)
USBD_HID_DataOut handle data OUT Stage.
struct __attribute__((packed)) ndef_struct_s
Structure to store an NDEF message.
void u2f_transport_sent(u2f_service_t *service, u2f_transport_media_t media)
void u2f_transport_init(u2f_service_t *service, uint8_t *message_buffer, uint16_t message_buffer_length)
void u2f_transport_received(u2f_service_t *service, uint8_t *buffer, uint16_t size, u2f_transport_media_t media)
USBD_StatusTypeDef USBD_LL_OpenEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr, uint8_t ep_type, uint16_t ep_mps)
Opens an endpoint of the Low Level Driver.
USBD_StatusTypeDef USBD_LL_PrepareReceive(USBD_HandleTypeDef *pdev, uint8_t ep_addr, uint16_t size)
Prepares an endpoint for reception.
: Header for usbd_conf file.