30 connectToHIDDevice(false),
31 pairWithHIDDevice(false),
32 useSimplePairing(false),
38 simple_pairing_supported(false),
52 uint8_t buf[constBufSize];
100 #ifdef DEBUG_USB_HOST
101 Notify(
PSTR(
"\r\nOut of address space"), 0x80);
118 #ifdef DEBUG_USB_HOST
119 Notify(
PSTR(
"\r\nPlease create a hub instance in your code: \"USBHub Hub1(&Usb);\""), 0x80);
127 #ifdef DEBUG_USB_HOST
136 uint8_t
BTD::Init(uint8_t parent __attribute__((unused)), uint8_t port __attribute__((unused)),
bool lowspeed) {
148 #ifdef DEBUG_USB_HOST
158 #ifdef DEBUG_USB_HOST
160 D_PrintHex<uint8_t > (rcode, 0x80);
167 D_PrintHex<uint8_t > (
bAddress, 0x80);
174 #ifdef DEBUG_USB_HOST
184 goto FailSetDevTblEntry;
190 goto FailSetConfDescr;
192 #ifdef DEBUG_USB_HOST
195 Notify(
PSTR(
"\r\nDualshock 3 Controller Connected"), 0x80);
197 Notify(
PSTR(
"\r\nNavigation Controller Connected"), 0x80);
199 Notify(
PSTR(
"\r\nMotion Controller Connected"), 0x80);
203 #ifdef DEBUG_USB_HOST
204 Notify(
PSTR(
"\r\nPlease plug in the dongle before trying to pair with the PS3 Controller\r\nor set the Bluetooth address in the constructor of the PS3BT class"), 0x80);
211 #ifdef DEBUG_USB_HOST
212 Notify(
PSTR(
"\r\nBluetooth Address was set to: "), 0x80);
213 for(int8_t i = 5; i > 0; i--) {
214 D_PrintHex<uint8_t > (
my_bdaddr[i], 0x80);
217 D_PrintHex<uint8_t > (
my_bdaddr[0], 0x80);
229 for(uint8_t i = 0; i < num_of_conf; i++) {
238 goto FailGetConfDescr;
244 goto FailUnknownDevice;
249 goto FailSetDevTblEntry;
254 goto FailSetConfDescr;
256 hci_num_reset_loops = 100;
262 #ifdef DEBUG_USB_HOST
263 Notify(
PSTR(
"\r\nBluetooth Dongle Initialized"), 0x80);
270 #ifdef DEBUG_USB_HOST
276 #ifdef DEBUG_USB_HOST
282 #ifdef DEBUG_USB_HOST
288 #ifdef DEBUG_USB_HOST
294 #ifdef DEBUG_USB_HOST
295 Notify(
PSTR(
"\r\nBTD Init Failed, error code: "), 0x80);
302 void BTD::Initialize() {
313 btService[i]->
Reset();
320 incomingPSController =
false;
326 simple_pairing_supported =
false;
355 if(pollInterval < pep->bInterval)
362 Notify(
PSTR(
"\r\nEndpoint descriptor:"), 0x80);
364 D_PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
366 D_PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
368 D_PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
370 D_PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
372 D_PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
374 D_PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
403 void BTD::HCI_event_task() {
407 if(!rcode || rcode ==
hrNAK) {
412 if((hcibuf[3] == 0x01) && (hcibuf[4] == 0x10)) {
421 }
else if((hcibuf[3] == 0x04) && (hcibuf[4] == 0x10)) {
425 D_PrintHex<uint8_t > (hcibuf[6], 0x80);
426 Notify(
PSTR(
"\r\nMaximum page number: "), 0x80);
427 D_PrintHex<uint8_t > (hcibuf[7], 0x80);
428 Notify(
PSTR(
"\r\nExtended LMP features:"), 0x80);
429 for(uint8_t i = 0; i < 8; i++) {
431 D_PrintHex<uint8_t > (hcibuf[8 + i], 0x80);
435 #ifdef DEBUG_USB_HOST
438 if(hcibuf[8 + 6] & (1U << 3)) {
439 simple_pairing_supported =
true;
440 #ifdef DEBUG_USB_HOST
444 simple_pairing_supported =
false;
445 #ifdef DEBUG_USB_HOST
449 #ifdef DEBUG_USB_HOST
450 Notify(
PSTR(
" secure simple pairing (controller support)"), 0x80);
452 }
else if(hcibuf[6] == 1) {
453 #ifdef DEBUG_USB_HOST
455 if(hcibuf[8 + 0] & (1U << 0))
459 Notify(
PSTR(
" secure simple pairing (host support)"), 0x80);
465 }
else if((hcibuf[3] == 0x09) && (hcibuf[4] == 0x10)) {
466 for(uint8_t i = 0; i < 6; i++)
475 #ifdef DEBUG_USB_HOST
476 Notify(
PSTR(
"\r\nHCI Command Failed: "), 0x80);
477 D_PrintHex<uint8_t > (hcibuf[2], 0x80);
478 Notify(
PSTR(
"\r\nNum HCI Command Packets: "), 0x80);
479 D_PrintHex<uint8_t > (hcibuf[3], 0x80);
481 D_PrintHex<uint8_t > (hcibuf[4], 0x80);
483 D_PrintHex<uint8_t > (hcibuf[5], 0x80);
491 #ifdef DEBUG_USB_HOST
493 Notify(
PSTR(
"\r\nCouldn't find Wiimote"), 0x80);
495 Notify(
PSTR(
"\r\nCouldn't find HID device"), 0x80);
510 Notify(
PSTR(
"\r\nNumber of responses: "), 0x80);
513 for(uint8_t i = 0; i < hcibuf[2]; i++) {
514 uint8_t classOfDevice_offset;
516 classOfDevice_offset = 9 * hcibuf[2];
518 classOfDevice_offset = 8 * hcibuf[2];
520 for(uint8_t j = 0; j < 3; j++)
521 classOfDevice[j] = hcibuf[3 + classOfDevice_offset + 3 * i + j];
525 D_PrintHex<uint8_t > (classOfDevice[2], 0x80);
527 D_PrintHex<uint8_t > (classOfDevice[1], 0x80);
529 D_PrintHex<uint8_t > (classOfDevice[0], 0x80);
532 if(
pairWithWii && (classOfDevice[2] == 0x00) && ((classOfDevice[1] & 0x0F) == 0x05) && (classOfDevice[0] & 0x0C)) {
533 checkRemoteName =
true;
535 for(uint8_t j = 0; j < 6; j++)
540 }
else if(
pairWithHIDDevice && ((classOfDevice[1] & 0x0F) == 0x05) && (classOfDevice[0] & 0xC8)) {
541 #ifdef DEBUG_USB_HOST
542 checkRemoteName =
true;
544 if(classOfDevice[0] & 0x80)
546 if(classOfDevice[0] & 0x40)
548 if(classOfDevice[0] & 0x08)
551 for(uint8_t j = 0; j < 6; j++)
565 Notify(
PSTR(
"\r\nConnection established"), 0x80);
567 hci_handle = hcibuf[3] | ((hcibuf[4] & 0x0F) << 8);
571 #ifdef DEBUG_USB_HOST
572 Notify(
PSTR(
"\r\nConnection Failed: "), 0x80);
573 D_PrintHex<uint8_t > (hcibuf[2], 0x80);
587 for(uint8_t i = 0; i < min(
sizeof (
remote_name),
sizeof (hcibuf) - 9); i++) {
598 for(uint8_t i = 0; i < 6; i++)
601 for(uint8_t i = 0; i < 3; i++)
602 classOfDevice[i] = hcibuf[i + 8];
604 if(((classOfDevice[1] & 0x0F) == 0x05) && (classOfDevice[0] & 0xC8)) {
605 #ifdef DEBUG_USB_HOST
606 if(classOfDevice[0] & 0x80)
607 Notify(
PSTR(
"\r\nMouse is connecting"), 0x80);
608 if(classOfDevice[0] & 0x40)
609 Notify(
PSTR(
"\r\nKeyboard is connecting"), 0x80);
610 if(classOfDevice[0] & 0x08)
611 Notify(
PSTR(
"\r\nGamepad is connecting"), 0x80);
618 D_PrintHex<uint8_t > (classOfDevice[2], 0x80);
620 D_PrintHex<uint8_t > (classOfDevice[1], 0x80);
622 D_PrintHex<uint8_t > (classOfDevice[0], 0x80);
629 #ifdef DEBUG_USB_HOST
630 Notify(
PSTR(
"\r\nPairing with Wiimote"), 0x80);
633 }
else if(
btdPin != NULL) {
634 #ifdef DEBUG_USB_HOST
635 Notify(
PSTR(
"\r\nBluetooth pin is set too: "), 0x80);
640 #ifdef DEBUG_USB_HOST
648 #ifdef DEBUG_USB_HOST
649 Notify(
PSTR(
"\r\nReceived Key Request"), 0x80);
657 #ifdef DEBUG_USB_HOST
658 Notify(
PSTR(
"\r\nPairing successful with Wiimote"), 0x80);
662 #ifdef DEBUG_USB_HOST
663 Notify(
PSTR(
"\r\nPairing successful with HID device"), 0x80);
668 Notify(
PSTR(
"\r\nPairing was successful"), 0x80);
672 #ifdef DEBUG_USB_HOST
674 D_PrintHex<uint8_t > (hcibuf[2], 0x80);
682 #ifdef DEBUG_USB_HOST
683 Notify(
PSTR(
"\r\nReceived IO Capability Request"), 0x80);
690 Notify(
PSTR(
"\r\nReceived IO Capability Response: "), 0x80);
692 D_PrintHex<uint8_t > (hcibuf[8], 0x80);
694 D_PrintHex<uint8_t > (hcibuf[9], 0x80);
695 Notify(
PSTR(
"\r\nAuthentication request: "), 0x80);
696 D_PrintHex<uint8_t > (hcibuf[10], 0x80);
701 #ifdef DEBUG_USB_HOST
702 Notify(
PSTR(
"\r\nUser confirmation Request"), 0x80);
705 for(uint8_t i = 0; i < 4; i++) {
707 D_PrintHex<uint8_t > (hcibuf[8 + i], 0x80);
718 Notify(
PSTR(
"\r\nSimple Pairing succeeded"), 0x80);
720 Notify(
PSTR(
"\r\nSimple Pairing failed: "), 0x80);
721 D_PrintHex<uint8_t > (hcibuf[2], 0x80);
740 if(hcibuf[0] != 0x00) {
742 D_PrintHex<uint8_t > (hcibuf[0], 0x80);
748 if(hcibuf[0] != 0x00) {
749 Notify(
PSTR(
"\r\nUnmanaged HCI Event: "), 0x80);
750 D_PrintHex<uint8_t > (hcibuf[0], 0x80);
752 for(uint16_t i = 0; i < hcibuf[1]; i++) {
753 D_PrintHex<uint8_t > (hcibuf[2 + i], 0x80);
764 D_PrintHex<uint8_t > (rcode, 0x80);
770 void BTD::HCI_task() {
774 if(hci_counter > hci_num_reset_loops) {
785 #ifdef DEBUG_USB_HOST
790 }
else if(hci_counter > hci_num_reset_loops) {
791 hci_num_reset_loops *= 10;
792 if(hci_num_reset_loops > 2000)
793 hci_num_reset_loops = 2000;
794 #ifdef DEBUG_USB_HOST
795 Notify(
PSTR(
"\r\nNo response to HCI Reset"), 0x80);
804 #ifdef DEBUG_USB_HOST
805 Notify(
PSTR(
"\r\nWrite class of device"), 0x80);
814 #ifdef DEBUG_USB_HOST
815 Notify(
PSTR(
"\r\nLocal Bluetooth Address: "), 0x80);
816 for(int8_t i = 5; i > 0; i--) {
817 D_PrintHex<uint8_t > (
my_bdaddr[i], 0x80);
820 D_PrintHex<uint8_t > (
my_bdaddr[0], 0x80);
843 #ifdef DEBUG_USB_HOST
844 Notify(
PSTR(
"\r\nThe name was set to: "), 0x80);
858 if(simple_pairing_supported) {
868 #ifdef DEBUG_USB_HOST
869 Notify(
PSTR(
"\r\nSimple pairing was enabled"), 0x80);
878 #ifdef DEBUG_USB_HOST
879 Notify(
PSTR(
"\r\nSet event mask completed"), 0x80);
887 #ifdef DEBUG_USB_HOST
889 Notify(
PSTR(
"\r\nStarting inquiry\r\nPress 1 & 2 on the Wiimote\r\nOr press the SYNC button if you are using a Wii U Pro Controller or a Wii Balance Board"), 0x80);
891 Notify(
PSTR(
"\r\nPlease enable discovery of your device"), 0x80);
902 #ifdef DEBUG_USB_HOST
908 Notify(
PSTR(
"\r\nNow just create the instance like so:"), 0x80);
914 Notify(
PSTR(
"\r\nAnd then press any button on the "), 0x80);
920 if(checkRemoteName) {
930 #ifdef DEBUG_USB_HOST
932 Notify(
PSTR(
"\r\nConnecting to Wiimote"), 0x80);
934 Notify(
PSTR(
"\r\nConnecting to HID device"), 0x80);
936 checkRemoteName =
false;
945 #ifdef DEBUG_USB_HOST
947 Notify(
PSTR(
"\r\nConnected to Wiimote"), 0x80);
949 Notify(
PSTR(
"\r\nConnected to HID device"), 0x80);
954 #ifdef DEBUG_USB_HOST
955 Notify(
PSTR(
"\r\nTrying to connect one more time..."), 0x80);
964 #ifdef DEBUG_USB_HOST
965 Notify(
PSTR(
"\r\nWait For Incoming Connection Request"), 0x80);
976 #ifdef DEBUG_USB_HOST
977 Notify(
PSTR(
"\r\nIncoming Connection Request"), 0x80);
987 #ifdef DEBUG_USB_HOST
992 if(strncmp((
const char*)
remote_name,
"Nintendo", 8) == 0) {
996 pairWiiUsingSync =
false;
997 #ifdef DEBUG_USB_HOST
998 Notify(
PSTR(
"\r\nWiimote is connecting"), 0x80);
1000 if(strncmp((
const char*)
remote_name,
"Nintendo RVL-CNT-01-TR", 22) == 0) {
1001 #ifdef DEBUG_USB_HOST
1002 Notify(
PSTR(
" with Motion Plus Inside"), 0x80);
1005 }
else if(strncmp((
const char*)
remote_name,
"Nintendo RVL-CNT-01-UC", 22) == 0) {
1006 #ifdef DEBUG_USB_HOST
1007 Notify(
PSTR(
" - Wii U Pro Controller"), 0x80);
1010 }
else if(strncmp((
const char*)
remote_name,
"Nintendo RVL-WBC-01", 19) == 0) {
1011 #ifdef DEBUG_USB_HOST
1014 pairWiiUsingSync =
true;
1017 if(classOfDevice[2] == 0 && classOfDevice[1] == 0x25 && classOfDevice[0] == 0x08 && strncmp((
const char*)
remote_name,
"Wireless Controller", 19) == 0) {
1018 #ifdef DEBUG_USB_HOST
1019 Notify(
PSTR(
"\r\nPS4/PS5 controller is connecting"), 0x80);
1021 incomingPSController =
true;
1034 #ifdef DEBUG_USB_HOST
1035 Notify(
PSTR(
"\r\nConnected to Device: "), 0x80);
1036 for(int8_t i = 5; i > 0; i--) {
1042 if(incomingPSController)
1057 if(hci_counter > 1000) {
1065 #ifdef DEBUG_USB_HOST
1066 Notify(
PSTR(
"\r\nHCI Disconnected from Device"), 0x80);
1076 incomingPSController =
false;
1086 void BTD::ACL_event_task() {
1094 btService[i]->
ACLData(l2capinbuf);
1099 else if(rcode !=
hrNAK) {
1100 Notify(
PSTR(
"\r\nACL data in error: "), 0x80);
1101 D_PrintHex<uint8_t > (rcode, 0x80);
1106 btService[i]->
Run();
1115 pUsb->
ctrlReq(
bAddress,
epInfo[
BTD_CONTROL_PIPE ].epAddr,
bmREQ_HCI_OUT, 0x00, 0x00, 0x00, 0x00, nbytes, nbytes, data, NULL);
1121 hcibuf[1] = 0x03 << 2;
1130 hcibuf[1] = 0x03 << 2;
1142 hcibuf[1] = 0x03 << 2;
1152 hcibuf[1] = 0x04 << 2;
1161 hcibuf[1] = 0x04 << 2;
1170 hcibuf[1] = 0x04 << 2;
1172 hcibuf[3] = page_number;
1180 hcibuf[1] = 0x01 << 2;
1196 hcibuf[1] = 0x01 << 2;
1214 hcibuf[1] = 0x03 << 2;
1215 hcibuf[2] = strlen(name) + 1;
1217 for(i = 0; i < strlen(name); i++)
1218 hcibuf[i + 3] = name[i];
1219 hcibuf[i + 3] = 0x00;
1226 hcibuf[1] = 0x03 << 2;
1244 hcibuf[1] = 0x03 << 2;
1246 hcibuf[3] = enable ? 1 : 0;
1254 hcibuf[1] = 0x01 << 2;
1267 hcibuf[1] = 0x01 << 2;
1280 hcibuf[1] = 0x01 << 2;
1282 hcibuf[3] = bdaddr[0];
1283 hcibuf[4] = bdaddr[1];
1284 hcibuf[5] = bdaddr[2];
1285 hcibuf[6] = bdaddr[3];
1286 hcibuf[7] = bdaddr[4];
1287 hcibuf[8] = bdaddr[5];
1301 hcibuf[1] = 0x01 << 2;
1311 if(pairWiiUsingSync) {
1312 #ifdef DEBUG_USB_HOST
1313 Notify(
PSTR(
"\r\nPairing with Wii controller via SYNC"), 0x80);
1315 for(uint8_t i = 0; i < 6; i++)
1318 for(uint8_t i = 0; i < 6; i++)
1321 for(uint8_t i = 16; i < 26; i++)
1324 hcibuf[9] = strlen(
btdPin);
1326 for(i = 0; i < strlen(
btdPin); i++)
1327 hcibuf[i + 10] =
btdPin[i];
1329 hcibuf[i + 10] = 0x00;
1337 hcibuf[1] = 0x01 << 2;
1351 hcibuf[1] = 0x01 << 2;
1365 hcibuf[1] = 0x01 << 2;
1382 hcibuf[1] = 0x01 << 2;
1396 hcibuf[1] = 0x01 << 2;
1399 hcibuf[4] = (uint8_t)((
hci_handle >> 8) & 0x0F);
1407 hcibuf[1] = 0x01 << 2;
1409 hcibuf[3] = (uint8_t)(handle & 0xFF);
1410 hcibuf[4] = (uint8_t)((handle >> 8) & 0x0F);
1418 hcibuf[1] = 0x03 << 2;
1452 void BTD::L2CAP_Command(uint16_t handle, uint8_t* data, uint8_t nbytes, uint8_t channelLow, uint8_t channelHigh) {
1453 uint8_t buf[8 + nbytes];
1454 buf[0] = (uint8_t)(handle & 0xff);
1455 buf[1] = (uint8_t)(((handle >> 8) & 0x0f) | 0x20);
1456 buf[2] = (uint8_t)((4 + nbytes) & 0xff);
1457 buf[3] = (uint8_t)((4 + nbytes) >> 8);
1458 buf[4] = (uint8_t)(nbytes & 0xff);
1459 buf[5] = (uint8_t)(nbytes >> 8);
1460 buf[6] = channelLow;
1461 buf[7] = channelHigh;
1463 for(uint16_t i = 0; i < nbytes; i++)
1464 buf[8 + i] = data[i];
1469 #ifdef DEBUG_USB_HOST
1470 Notify(
PSTR(
"\r\nError sending L2CAP message: 0x"), 0x80);
1471 D_PrintHex<uint8_t > (rcode, 0x80);
1473 D_PrintHex<uint8_t > (channelHigh, 0x80);
1475 D_PrintHex<uint8_t > (channelLow, 0x80);
1482 l2capoutbuf[1] = rxid;
1483 l2capoutbuf[2] = 0x04;
1484 l2capoutbuf[3] = 0x00;
1485 l2capoutbuf[4] = (uint8_t)(psm & 0xff);
1486 l2capoutbuf[5] = (uint8_t)(psm >> 8);
1487 l2capoutbuf[6] = scid[0];
1488 l2capoutbuf[7] = scid[1];
1495 l2capoutbuf[1] = rxid;
1496 l2capoutbuf[2] = 0x08;
1497 l2capoutbuf[3] = 0x00;
1498 l2capoutbuf[4] = dcid[0];
1499 l2capoutbuf[5] = dcid[1];
1500 l2capoutbuf[6] = scid[0];
1501 l2capoutbuf[7] = scid[1];
1502 l2capoutbuf[8] = result;
1503 l2capoutbuf[9] = 0x00;
1504 l2capoutbuf[10] = 0x00;
1505 l2capoutbuf[11] = 0x00;
1512 l2capoutbuf[1] = rxid;
1513 l2capoutbuf[2] = 0x08;
1514 l2capoutbuf[3] = 0x00;
1515 l2capoutbuf[4] = dcid[0];
1516 l2capoutbuf[5] = dcid[1];
1517 l2capoutbuf[6] = 0x00;
1518 l2capoutbuf[7] = 0x00;
1519 l2capoutbuf[8] = 0x01;
1520 l2capoutbuf[9] = 0x02;
1521 l2capoutbuf[10] = 0xFF;
1522 l2capoutbuf[11] = 0xFF;
1529 l2capoutbuf[1] = rxid;
1530 l2capoutbuf[2] = 0x0A;
1531 l2capoutbuf[3] = 0x00;
1532 l2capoutbuf[4] = scid[0];
1533 l2capoutbuf[5] = scid[1];
1534 l2capoutbuf[6] = 0x00;
1535 l2capoutbuf[7] = 0x00;
1536 l2capoutbuf[8] = 0x00;
1537 l2capoutbuf[9] = 0x00;
1538 l2capoutbuf[10] = 0x01;
1539 l2capoutbuf[11] = 0x02;
1540 l2capoutbuf[12] = 0xA0;
1541 l2capoutbuf[13] = 0x02;
1548 l2capoutbuf[1] = rxid;
1549 l2capoutbuf[2] = 0x04;
1550 l2capoutbuf[3] = 0x00;
1551 l2capoutbuf[4] = dcid[0];
1552 l2capoutbuf[5] = dcid[1];
1553 l2capoutbuf[6] = scid[0];
1554 l2capoutbuf[7] = scid[1];
1561 l2capoutbuf[1] = rxid;
1562 l2capoutbuf[2] = 0x04;
1563 l2capoutbuf[3] = 0x00;
1564 l2capoutbuf[4] = dcid[0];
1565 l2capoutbuf[5] = dcid[1];
1566 l2capoutbuf[6] = scid[0];
1567 l2capoutbuf[7] = scid[1];
1574 l2capoutbuf[1] = rxid;
1575 l2capoutbuf[2] = 0x08;
1576 l2capoutbuf[3] = 0x00;
1577 l2capoutbuf[4] = infoTypeLow;
1578 l2capoutbuf[5] = infoTypeHigh;
1579 l2capoutbuf[6] = 0x00;
1580 l2capoutbuf[7] = 0x00;
1581 l2capoutbuf[8] = 0x00;
1582 l2capoutbuf[9] = 0x00;
1583 l2capoutbuf[10] = 0x00;
1584 l2capoutbuf[11] = 0x00;
1590 void BTD::setBdaddr(uint8_t* bdaddr) {
1596 for(uint8_t i = 0; i < 6; i++)
1597 buf[i + 2] = bdaddr[5 - i];
1600 pUsb->
ctrlReq(
bAddress,
epInfo[
BTD_CONTROL_PIPE].epAddr,
bmREQ_HID_OUT,
HID_REQUEST_SET_REPORT, 0xF5, 0x03, 0x00, 8, 8, buf, NULL);
1603 void BTD::setMoveBdaddr(uint8_t* bdaddr) {
1612 for(uint8_t i = 0; i < 6; i++)
1613 buf[i + 1] = bdaddr[i];
1616 pUsb->
ctrlReq(
bAddress,
epInfo[
BTD_CONTROL_PIPE].epAddr,
bmREQ_HID_OUT,
HID_REQUEST_SET_REPORT, 0x05, 0x03, 0x00, 11, 11, buf, NULL);
#define EV_COMMAND_STATUS
#define HCI_FLAG_DISCONNECT_COMPLETE
#define EV_NUM_COMPLETE_PKT
#define HCI_INQUIRY_STATE
#define HCI_FLAG_INCOMING_REQUEST
#define EV_EXTENDED_INQUIRY_RESULT
#define HCI_FLAG_CMD_COMPLETE
#define HCI_CONNECT_DEVICE_STATE
#define EV_QOS_SETUP_COMPLETE
#define EV_DISCONNECT_COMPLETE
#define HCI_FLAG_LOCAL_EXTENDED_FEATURES
#define EV_REMOTE_NAME_COMPLETE
#define EV_MAX_SLOTS_CHANGE
#define HCI_CHECK_DEVICE_SERVICE
#define EV_IO_CAPABILITY_RESPONSE
#define HCI_DISCONNECT_STATE
#define EV_INQUIRY_RESULT
#define L2CAP_CMD_DISCONNECT_REQUEST
#define EV_CHANGE_CONNECTION_LINK
#define HCI_FLAG_REMOTE_NAME_COMPLETE
#define HCI_FLAG_CONNECT_COMPLETE
#define L2CAP_CMD_CONFIG_REQUEST
#define HCI_WRITE_NAME_STATE
#define HCI_REMOTE_NAME_STATE
#define L2CAP_CMD_DISCONNECT_RESPONSE
#define EV_INQUIRY_COMPLETE
#define HCI_LOCAL_EXTENDED_FEATURES_STATE
#define PS3NAVIGATION_PID
#define BELKIN_F8T065BF_VID
#define hci_check_flag(flag)
#define HCI_FLAG_DEVICE_FOUND
#define EV_AUTHENTICATION_COMPLETE
#define IOGEAR_GBU521_VID
#define EV_DATA_BUFFER_OVERFLOW
#define hci_clear_flag(flag)
#define L2CAP_CMD_CONFIG_RESPONSE
#define EV_COMMAND_COMPLETE
#define EV_READ_REMOTE_VERSION_INFORMATION_COMPLETE
#define EV_IO_CAPABILITY_REQUEST
#define HCI_CONNECT_IN_STATE
#define EV_LINK_KEY_NOTIFICATION
#define EV_LINK_KEY_REQUEST
#define HCI_LOCAL_VERSION_STATE
#define EV_PIN_CODE_REQUEST
#define EV_ENCRYPTION_CHANGE
#define HCI_FLAG_READ_BDADDR
#define HCI_FLAG_READ_VERSION
#define HCI_SET_EVENT_MASK_STATE
#define HCI_CONNECTED_DEVICE_STATE
#define L2CAP_CMD_CONNECTION_REQUEST
#define HCI_WRITE_SIMPLE_PAIRING_STATE
#define HCI_SCANNING_STATE
#define EV_LOOPBACK_COMMAND
#define BELKIN_F8T065BF_PID
#define HCI_FLAG_CONNECT_EVENT
#define EV_CONNECT_COMPLETE
#define EV_PAGE_SCAN_REP_MODE
#define hci_set_flag(flag)
#define EV_SIMPLE_PAIRING_COMPLETE
#define HCI_CONNECTED_STATE
#define EV_USER_CONFIRMATION_REQUEST
#define IOGEAR_GBU521_PID
#define BTD_MAX_ENDPOINTS
#define L2CAP_CMD_CONNECTION_RESPONSE
#define L2CAP_CMD_INFORMATION_RESPONSE
#define EV_INCOMING_CONNECT
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
#define USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET
#define USB_ERROR_FailGetDevDescr
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
#define USB_ERROR_EPINFO_IS_NULL
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
#define USB_NAK_MAX_POWER
virtual void FreeAddress(uint8_t addr)=0
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)=0
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
void hci_user_confirmation_request_reply()
static const uint8_t BTD_DATAOUT_PIPE
bool l2capConnectionClaimed
void hci_disconnect(uint16_t handle)
void hci_accept_connection()
void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
static const uint8_t BTD_EVENT_PIPE
void hci_read_local_extended_features(uint8_t page_number)
void l2cap_disconnection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
void hci_io_capability_request_reply()
void hci_write_simple_pairing_mode(bool enable)
void hci_inquiry_cancel()
static const uint8_t BTD_DATAIN_PIPE
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
static const uint8_t BTD_CONTROL_PIPE
uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)
void l2cap_connection_request(uint16_t handle, uint8_t rxid, uint8_t *scid, uint16_t psm)
void hci_pin_code_request_reply()
void hci_pin_code_negative_request_reply()
void l2cap_config_response(uint16_t handle, uint8_t rxid, uint8_t *scid)
void l2cap_connection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid, uint8_t result)
void hci_write_scan_enable()
EpInfo epInfo[BTD_MAX_ENDPOINTS]
void l2cap_information_response(uint16_t handle, uint8_t rxid, uint8_t infoTypeLow, uint8_t infoTypeHigh)
bool waitingForConnection
void hci_write_class_of_device()
bool rfcommConnectionClaimed
void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)
void L2CAP_Command(uint16_t handle, uint8_t *data, uint8_t nbytes, uint8_t channelLow=0x01, uint8_t channelHigh=0x00)
void l2cap_config_request(uint16_t handle, uint8_t rxid, uint8_t *dcid)
void hci_write_local_name(const char *name)
void l2cap_disconnection_request(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
void hci_set_event_mask()
void hci_authentication_request()
void hci_read_local_version_information()
void HCI_Command(uint8_t *data, uint16_t nbytes)
void hci_link_key_request_negative_reply()
bool sdpConnectionClaimed
void hci_write_scan_disable()
virtual void disconnect()=0
virtual void ACLData(uint8_t *ACLData)=0
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
AddressPool & GetAddressPool()
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
#define NotifyFailSetConfDescr(...)
#define NotifyFailUnknownDevice(...)
#define NotifyFailGetConfDescr(...)
#define NotifyFailSetDevTblEntry(...)
#define NotifyFailGetDevDescr(...)
uint8_t bNumConfigurations
#define USB_TRANSFER_TYPE_BULK
#define bmUSB_TRANSFER_TYPE
#define USB_TRANSFER_TYPE_INTERRUPT
#define HID_REQUEST_SET_REPORT