30 connectToHIDDevice(false),
31 pairWithHIDDevice(false),
50 uint8_t buf[constBufSize];
60 Notify(PSTR(
"\r\nBTD ConfigureDevice"), 0x80);
65 Notify(PSTR(
"\r\nAddress in use"), 0x80);
73 Notify(PSTR(
"\r\nAddress not found"), 0x80);
80 Notify(PSTR(
"\r\nepinfo is null"), 0x80);
99 Notify(PSTR(
"\r\nOut of address space"), 0x80);
113 #ifdef DEBUG_USB_HOST
122 uint8_t
BTD::Init(uint8_t parent, uint8_t port,
bool lowspeed) {
129 Notify(PSTR(
"\r\nBTD Init"), 0x80);
134 #ifdef DEBUG_USB_HOST
135 Notify(PSTR(
"\r\nAddress not found"), 0x80);
144 #ifdef DEBUG_USB_HOST
145 Notify(PSTR(
"\r\nsetAddr: "), 0x80);
146 D_PrintHex<uint8_t > (rcode, 0x80);
152 Notify(PSTR(
"\r\nAddr: "), 0x80);
153 D_PrintHex<uint8_t > (
bAddress, 0x80);
160 #ifdef DEBUG_USB_HOST
161 Notify(PSTR(
"\r\nAddress not found"), 0x80);
170 goto FailSetDevTblEntry;
176 goto FailSetConfDescr;
178 #ifdef DEBUG_USB_HOST
181 Notify(PSTR(
"\r\nDualshock 3 Controller Connected"), 0x80);
183 Notify(PSTR(
"\r\nNavigation Controller Connected"), 0x80);
185 Notify(PSTR(
"\r\nMotion Controller Connected"), 0x80);
189 #ifdef DEBUG_USB_HOST
190 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);
197 #ifdef DEBUG_USB_HOST
198 Notify(PSTR(
"\r\nBluetooth Address was set to: "), 0x80);
199 for(int8_t i = 5; i > 0; i--) {
200 D_PrintHex<uint8_t > (
my_bdaddr[i], 0x80);
203 D_PrintHex<uint8_t > (
my_bdaddr[0], 0x80);
215 for(uint8_t i = 0; i < num_of_conf; i++) {
224 goto FailGetConfDescr;
230 goto FailUnknownDevice;
235 goto FailSetDevTblEntry;
240 goto FailSetConfDescr;
242 hci_num_reset_loops = 100;
248 #ifdef DEBUG_USB_HOST
249 Notify(PSTR(
"\r\nBluetooth Dongle Initialized"), 0x80);
256 #ifdef DEBUG_USB_HOST
262 #ifdef DEBUG_USB_HOST
268 #ifdef DEBUG_USB_HOST
274 #ifdef DEBUG_USB_HOST
280 #ifdef DEBUG_USB_HOST
281 Notify(PSTR(
"\r\nBTD Init Failed, error code: "), 0x80);
288 void BTD::Initialize() {
298 btService[i]->
Reset();
341 if(pollInterval < pep->bInterval)
348 Notify(PSTR(
"\r\nEndpoint descriptor:"), 0x80);
349 Notify(PSTR(
"\r\nLength:\t\t"), 0x80);
350 D_PrintHex<uint8_t > (ep_ptr->
bLength, 0x80);
351 Notify(PSTR(
"\r\nType:\t\t"), 0x80);
353 Notify(PSTR(
"\r\nAddress:\t"), 0x80);
355 Notify(PSTR(
"\r\nAttributes:\t"), 0x80);
357 Notify(PSTR(
"\r\nMaxPktSize:\t"), 0x80);
359 Notify(PSTR(
"\r\nPoll Intrv:\t"), 0x80);
360 D_PrintHex<uint8_t > (ep_ptr->
bInterval, 0x80);
383 void BTD::HCI_event_task() {
387 if(!rcode || rcode ==
hrNAK) {
392 if((hcibuf[3] == 0x01) && (hcibuf[4] == 0x10)) {
395 }
else if((hcibuf[3] == 0x09) && (hcibuf[4] == 0x10)) {
396 for(uint8_t i = 0; i < 6; i++)
405 #ifdef DEBUG_USB_HOST
406 Notify(PSTR(
"\r\nHCI Command Failed: "), 0x80);
407 D_PrintHex<uint8_t > (hcibuf[2], 0x80);
415 #ifdef DEBUG_USB_HOST
417 Notify(PSTR(
"\r\nCouldn't find Wiimote"), 0x80);
419 Notify(PSTR(
"\r\nCouldn't find HID device"), 0x80);
433 Notify(PSTR(
"\r\nNumber of responses: "), 0x80);
436 for(uint8_t i = 0; i < hcibuf[2]; i++) {
437 uint8_t offset = 8 * hcibuf[2] + 3 * i;
439 for(uint8_t j = 0; j < 3; j++)
440 classOfDevice[j] = hcibuf[j + 4 + offset];
442 if(
pairWithWii && classOfDevice[2] == 0x00 && (classOfDevice[1] & 0x05) && (classOfDevice[0] & 0x0C)) {
443 if(classOfDevice[0] & 0x08)
448 for(uint8_t j = 0; j < 6; j++)
453 }
else if(
pairWithHIDDevice && (classOfDevice[1] & 0x05) && (classOfDevice[0] & 0xC8)) {
454 #ifdef DEBUG_USB_HOST
455 if(classOfDevice[0] & 0x80)
456 Notify(PSTR(
"\r\nMouse found"), 0x80);
457 if(classOfDevice[0] & 0x40)
458 Notify(PSTR(
"\r\nKeyboard found"), 0x80);
459 if(classOfDevice[0] & 0x08)
460 Notify(PSTR(
"\r\nGamepad found"), 0x80);
463 for(uint8_t j = 0; j < 6; j++)
470 Notify(PSTR(
"\r\nClass of device: "), 0x80);
471 D_PrintHex<uint8_t > (classOfDevice[2], 0x80);
473 D_PrintHex<uint8_t > (classOfDevice[1], 0x80);
475 D_PrintHex<uint8_t > (classOfDevice[0], 0x80);
486 Notify(PSTR(
"\r\nConnection established"), 0x80);
488 hci_handle = hcibuf[3] | ((hcibuf[4] & 0x0F) << 8);
492 #ifdef DEBUG_USB_HOST
493 Notify(PSTR(
"\r\nConnection Failed: "), 0x80);
494 D_PrintHex<uint8_t > (hcibuf[2], 0x80);
508 for(uint8_t i = 0; i < min(
sizeof (
remote_name),
sizeof (hcibuf) - 9); i++) {
518 for(uint8_t i = 0; i < 6; i++)
521 for(uint8_t i = 0; i < 3; i++)
522 classOfDevice[i] = hcibuf[i + 8];
524 if((classOfDevice[1] & 0x05) && (classOfDevice[0] & 0xC8)) {
525 #ifdef DEBUG_USB_HOST
526 if(classOfDevice[0] & 0x80)
527 Notify(PSTR(
"\r\nMouse is connecting"), 0x80);
528 if(classOfDevice[0] & 0x40)
529 Notify(PSTR(
"\r\nKeyboard is connecting"), 0x80);
530 if(classOfDevice[0] & 0x08)
531 Notify(PSTR(
"\r\nGamepad is connecting"), 0x80);
537 Notify(PSTR(
"\r\nClass of device: "), 0x80);
538 D_PrintHex<uint8_t > (classOfDevice[2], 0x80);
540 D_PrintHex<uint8_t > (classOfDevice[1], 0x80);
542 D_PrintHex<uint8_t > (classOfDevice[0], 0x80);
549 #ifdef DEBUG_USB_HOST
550 Notify(PSTR(
"\r\nPairing with wiimote"), 0x80);
553 }
else if(
btdPin != NULL) {
554 #ifdef DEBUG_USB_HOST
555 Notify(PSTR(
"\r\nBluetooth pin is set too: "), 0x80);
560 #ifdef DEBUG_USB_HOST
561 Notify(PSTR(
"\r\nNo pin was set"), 0x80);
568 #ifdef DEBUG_USB_HOST
569 Notify(PSTR(
"\r\nReceived Key Request"), 0x80);
576 #ifdef DEBUG_USB_HOST
577 Notify(PSTR(
"\r\nPairing successful with Wiimote"), 0x80);
581 #ifdef DEBUG_USB_HOST
582 Notify(PSTR(
"\r\nPairing successful with HID device"), 0x80);
602 if(hcibuf[0] != 0x00) {
603 Notify(PSTR(
"\r\nUnmanaged HCI Event: "), 0x80);
604 D_PrintHex<uint8_t > (hcibuf[0], 0x80);
612 Notify(PSTR(
"\r\nHCI event error: "), 0x80);
613 D_PrintHex<uint8_t > (rcode, 0x80);
619 void BTD::HCI_task() {
623 if(hci_counter > hci_num_reset_loops) {
634 #ifdef DEBUG_USB_HOST
635 Notify(PSTR(
"\r\nHCI Reset complete"), 0x80);
639 }
else if(hci_counter > hci_num_reset_loops) {
640 hci_num_reset_loops *= 10;
641 if(hci_num_reset_loops > 2000)
642 hci_num_reset_loops = 2000;
643 #ifdef DEBUG_USB_HOST
644 Notify(PSTR(
"\r\nNo response to HCI Reset"), 0x80);
653 #ifdef DEBUG_USB_HOST
654 Notify(PSTR(
"\r\nWrite class of device"), 0x80);
663 #ifdef DEBUG_USB_HOST
664 Notify(PSTR(
"\r\nLocal Bluetooth Address: "), 0x80);
665 for(int8_t i = 5; i > 0; i--) {
666 D_PrintHex<uint8_t > (
my_bdaddr[i], 0x80);
669 D_PrintHex<uint8_t > (my_bdaddr[0], 0x80);
688 #ifdef DEBUG_USB_HOST
689 Notify(PSTR(
"\r\nThe name is set to: "), 0x80);
698 #ifdef DEBUG_USB_HOST
700 Notify(PSTR(
"\r\nStarting inquiry\r\nPress 1 & 2 on the Wiimote\r\nOr press sync if you are using a Wii U Pro Controller"), 0x80);
702 Notify(PSTR(
"\r\nPlease enable discovery of your device"), 0x80);
713 #ifdef DEBUG_USB_HOST
715 Notify(PSTR(
"\r\nWiimote found"), 0x80);
717 Notify(PSTR(
"\r\nHID device found"), 0x80);
719 Notify(PSTR(
"\r\nNow just create the instance like so:"), 0x80);
721 Notify(PSTR(
"\r\nWII Wii(&Btd);"), 0x80);
723 Notify(PSTR(
"\r\nBTHID hid(&Btd);"), 0x80);
725 Notify(PSTR(
"\r\nAnd then press any button on the "), 0x80);
727 Notify(PSTR(
"Wiimote"), 0x80);
729 Notify(PSTR(
"device"), 0x80);
741 #ifdef DEBUG_USB_HOST
743 Notify(PSTR(
"\r\nConnecting to Wiimote"), 0x80);
745 Notify(PSTR(
"\r\nConnecting to HID device"), 0x80);
755 #ifdef DEBUG_USB_HOST
757 Notify(PSTR(
"\r\nConnected to Wiimote"), 0x80);
759 Notify(PSTR(
"\r\nConnected to HID device"), 0x80);
764 #ifdef DEBUG_USB_HOST
765 Notify(PSTR(
"\r\nTrying to connect one more time..."), 0x80);
774 #ifdef DEBUG_USB_HOST
775 Notify(PSTR(
"\r\nWait For Incoming Connection Request"), 0x80);
786 #ifdef DEBUG_USB_HOST
787 Notify(PSTR(
"\r\nIncoming Connection Request"), 0x80);
797 #ifdef DEBUG_USB_HOST
798 Notify(PSTR(
"\r\nRemote Name: "), 0x80);
802 if(strncmp((
const char*)
remote_name,
"Nintendo", 8) == 0) {
804 #ifdef DEBUG_USB_HOST
805 Notify(PSTR(
"\r\nWiimote is connecting"), 0x80);
807 if(strncmp((
const char*)
remote_name,
"Nintendo RVL-CNT-01-TR", 22) == 0) {
808 #ifdef DEBUG_USB_HOST
809 Notify(PSTR(
" with Motion Plus Inside"), 0x80);
812 }
else if(strncmp((
const char*)
remote_name,
"Nintendo RVL-CNT-01-UC", 22) == 0) {
813 #ifdef DEBUG_USB_HOST
814 Notify(PSTR(
" - Wii U Pro Controller"), 0x80);
823 if(classOfDevice[2] == 0 && classOfDevice[1] == 0x25 && classOfDevice[0] == 0x08 && strncmp((
const char*)
remote_name,
"Wireless Controller", 19) == 0) {
824 #ifdef DEBUG_USB_HOST
825 Notify(PSTR(
"\r\nPS4 controller is connecting"), 0x80);
840 #ifdef DEBUG_USB_HOST
841 Notify(PSTR(
"\r\nConnected to Device: "), 0x80);
842 for(int8_t i = 5; i > 0; i--) {
846 D_PrintHex<uint8_t > (disc_bdaddr[0], 0x80);
863 if(hci_counter > 1000) {
871 #ifdef DEBUG_USB_HOST
872 Notify(PSTR(
"\r\nHCI Disconnected from Device"), 0x80);
892 void BTD::ACL_event_task() {
900 btService[i]->
ACLData(l2capinbuf);
905 else if(rcode !=
hrNAK) {
906 Notify(PSTR(
"\r\nACL data in error: "), 0x80);
907 D_PrintHex<uint8_t > (rcode, 0x80);
921 pUsb->
ctrlReq(
bAddress,
epInfo[
BTD_CONTROL_PIPE ].epAddr,
bmREQ_HCI_OUT, 0x00, 0x00, 0x00, 0x00, nbytes, nbytes, data, NULL);
927 hcibuf[1] = 0x03 << 2;
936 hcibuf[1] = 0x03 << 2;
948 hcibuf[1] = 0x03 << 2;
958 hcibuf[1] = 0x04 << 2;
967 hcibuf[1] = 0x04 << 2;
976 hcibuf[1] = 0x01 << 2;
978 hcibuf[3] = disc_bdaddr[0];
979 hcibuf[4] = disc_bdaddr[1];
980 hcibuf[5] = disc_bdaddr[2];
981 hcibuf[6] = disc_bdaddr[3];
982 hcibuf[7] = disc_bdaddr[4];
983 hcibuf[8] = disc_bdaddr[5];
992 hcibuf[1] = 0x01 << 2;
994 hcibuf[3] = disc_bdaddr[0];
995 hcibuf[4] = disc_bdaddr[1];
996 hcibuf[5] = disc_bdaddr[2];
997 hcibuf[6] = disc_bdaddr[3];
998 hcibuf[7] = disc_bdaddr[4];
999 hcibuf[8] = disc_bdaddr[5];
1010 hcibuf[1] = 0x03 << 2;
1011 hcibuf[2] = strlen(name) + 1;
1013 for(i = 0; i < strlen(name); i++)
1014 hcibuf[i + 3] = name[i];
1015 hcibuf[i + 3] = 0x00;
1023 hcibuf[1] = 0x01 << 2;
1036 hcibuf[1] = 0x01 << 2;
1049 hcibuf[1] = 0x01 << 2;
1051 hcibuf[3] = bdaddr[0];
1052 hcibuf[4] = bdaddr[1];
1053 hcibuf[5] = bdaddr[2];
1054 hcibuf[6] = bdaddr[3];
1055 hcibuf[7] = bdaddr[4];
1056 hcibuf[8] = bdaddr[5];
1070 hcibuf[1] = 0x01 << 2;
1072 hcibuf[3] = disc_bdaddr[0];
1073 hcibuf[4] = disc_bdaddr[1];
1074 hcibuf[5] = disc_bdaddr[2];
1075 hcibuf[6] = disc_bdaddr[3];
1076 hcibuf[7] = disc_bdaddr[4];
1077 hcibuf[8] = disc_bdaddr[5];
1081 #ifdef DEBUG_USB_HOST
1082 Notify(PSTR(
"\r\nParing with Wii U Pro Controller"), 0x80);
1084 for(uint8_t i = 0; i < 6; i++)
1087 for(uint8_t i = 0; i < 6; i++)
1088 hcibuf[10 + i] = disc_bdaddr[i];
1090 for(uint8_t i = 16; i < 26; i++)
1093 hcibuf[9] = strlen(
btdPin);
1095 for(i = 0; i < strlen(
btdPin); i++)
1096 hcibuf[i + 10] =
btdPin[i];
1098 hcibuf[i + 10] = 0x00;
1106 hcibuf[1] = 0x01 << 2;
1108 hcibuf[3] = disc_bdaddr[0];
1109 hcibuf[4] = disc_bdaddr[1];
1110 hcibuf[5] = disc_bdaddr[2];
1111 hcibuf[6] = disc_bdaddr[3];
1112 hcibuf[7] = disc_bdaddr[4];
1113 hcibuf[8] = disc_bdaddr[5];
1120 hcibuf[1] = 0x01 << 2;
1122 hcibuf[3] = disc_bdaddr[0];
1123 hcibuf[4] = disc_bdaddr[1];
1124 hcibuf[5] = disc_bdaddr[2];
1125 hcibuf[6] = disc_bdaddr[3];
1126 hcibuf[7] = disc_bdaddr[4];
1127 hcibuf[8] = disc_bdaddr[5];
1134 hcibuf[1] = 0x01 << 2;
1137 hcibuf[4] = (uint8_t)((
hci_handle >> 8) & 0x0F);
1145 hcibuf[1] = 0x01 << 2;
1147 hcibuf[3] = (uint8_t)(handle & 0xFF);
1148 hcibuf[4] = (uint8_t)((handle >> 8) & 0x0F);
1156 hcibuf[1] = 0x03 << 2;
1190 void BTD::L2CAP_Command(uint16_t handle, uint8_t* data, uint8_t nbytes, uint8_t channelLow, uint8_t channelHigh) {
1191 uint8_t buf[8 + nbytes];
1192 buf[0] = (uint8_t)(handle & 0xff);
1193 buf[1] = (uint8_t)(((handle >> 8) & 0x0f) | 0x20);
1194 buf[2] = (uint8_t)((4 + nbytes) & 0xff);
1195 buf[3] = (uint8_t)((4 + nbytes) >> 8);
1196 buf[4] = (uint8_t)(nbytes & 0xff);
1197 buf[5] = (uint8_t)(nbytes >> 8);
1198 buf[6] = channelLow;
1199 buf[7] = channelHigh;
1201 for(uint16_t i = 0; i < nbytes; i++)
1202 buf[8 + i] = data[i];
1207 #ifdef DEBUG_USB_HOST
1208 Notify(PSTR(
"\r\nError sending L2CAP message: 0x"), 0x80);
1209 D_PrintHex<uint8_t > (rcode, 0x80);
1210 Notify(PSTR(
" - Channel ID: "), 0x80);
1211 D_PrintHex<uint8_t > (channelHigh, 0x80);
1213 D_PrintHex<uint8_t > (channelLow, 0x80);
1220 l2capoutbuf[1] = rxid;
1221 l2capoutbuf[2] = 0x04;
1222 l2capoutbuf[3] = 0x00;
1223 l2capoutbuf[4] = (uint8_t)(psm & 0xff);
1224 l2capoutbuf[5] = (uint8_t)(psm >> 8);
1225 l2capoutbuf[6] = scid[0];
1226 l2capoutbuf[7] = scid[1];
1233 l2capoutbuf[1] = rxid;
1234 l2capoutbuf[2] = 0x08;
1235 l2capoutbuf[3] = 0x00;
1236 l2capoutbuf[4] = dcid[0];
1237 l2capoutbuf[5] = dcid[1];
1238 l2capoutbuf[6] = scid[0];
1239 l2capoutbuf[7] = scid[1];
1240 l2capoutbuf[8] = result;
1241 l2capoutbuf[9] = 0x00;
1242 l2capoutbuf[10] = 0x00;
1243 l2capoutbuf[11] = 0x00;
1250 l2capoutbuf[1] = rxid;
1251 l2capoutbuf[2] = 0x08;
1252 l2capoutbuf[3] = 0x00;
1253 l2capoutbuf[4] = dcid[0];
1254 l2capoutbuf[5] = dcid[1];
1255 l2capoutbuf[6] = 0x00;
1256 l2capoutbuf[7] = 0x00;
1257 l2capoutbuf[8] = 0x01;
1258 l2capoutbuf[9] = 0x02;
1259 l2capoutbuf[10] = 0xFF;
1260 l2capoutbuf[11] = 0xFF;
1267 l2capoutbuf[1] = rxid;
1268 l2capoutbuf[2] = 0x0A;
1269 l2capoutbuf[3] = 0x00;
1270 l2capoutbuf[4] = scid[0];
1271 l2capoutbuf[5] = scid[1];
1272 l2capoutbuf[6] = 0x00;
1273 l2capoutbuf[7] = 0x00;
1274 l2capoutbuf[8] = 0x00;
1275 l2capoutbuf[9] = 0x00;
1276 l2capoutbuf[10] = 0x01;
1277 l2capoutbuf[11] = 0x02;
1278 l2capoutbuf[12] = 0xA0;
1279 l2capoutbuf[13] = 0x02;
1286 l2capoutbuf[1] = rxid;
1287 l2capoutbuf[2] = 0x04;
1288 l2capoutbuf[3] = 0x00;
1289 l2capoutbuf[4] = dcid[0];
1290 l2capoutbuf[5] = dcid[1];
1291 l2capoutbuf[6] = scid[0];
1292 l2capoutbuf[7] = scid[1];
1299 l2capoutbuf[1] = rxid;
1300 l2capoutbuf[2] = 0x04;
1301 l2capoutbuf[3] = 0x00;
1302 l2capoutbuf[4] = dcid[0];
1303 l2capoutbuf[5] = dcid[1];
1304 l2capoutbuf[6] = scid[0];
1305 l2capoutbuf[7] = scid[1];
1312 l2capoutbuf[1] = rxid;
1313 l2capoutbuf[2] = 0x08;
1314 l2capoutbuf[3] = 0x00;
1315 l2capoutbuf[4] = infoTypeLow;
1316 l2capoutbuf[5] = infoTypeHigh;
1317 l2capoutbuf[6] = 0x00;
1318 l2capoutbuf[7] = 0x00;
1319 l2capoutbuf[8] = 0x00;
1320 l2capoutbuf[9] = 0x00;
1321 l2capoutbuf[10] = 0x00;
1322 l2capoutbuf[11] = 0x00;
1328 void BTD::setBdaddr(uint8_t* bdaddr) {
1334 for(uint8_t i = 0; i < 6; i++)
1335 buf[i + 2] = bdaddr[5 - i];
1338 pUsb->
ctrlReq(
bAddress,
epInfo[
BTD_CONTROL_PIPE].epAddr,
bmREQ_HID_OUT,
HID_REQUEST_SET_REPORT, 0xF5, 0x03, 0x00, 8, 8, buf, NULL);
1341 void BTD::setMoveBdaddr(uint8_t* bdaddr) {
1350 for(uint8_t i = 0; i < 6; i++)
1351 buf[i + 1] = bdaddr[i];
1354 pUsb->
ctrlReq(
bAddress,
epInfo[
BTD_CONTROL_PIPE].epAddr,
bmREQ_HID_OUT,
HID_REQUEST_SET_REPORT, 0x05, 0x03, 0x00, 11, 11, buf, NULL);
static const uint8_t BTD_DATAOUT_PIPE
uint8_t getConfDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t *dataptr)
void l2cap_connection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid, uint8_t result)
#define HCI_SCANNING_STATE
#define USB_ERROR_EPINFO_IS_NULL
void l2cap_connection_request(uint16_t handle, uint8_t rxid, uint8_t *scid, uint16_t psm)
#define EV_COMMAND_STATUS
#define EV_REMOTE_NAME_COMPLETE
bool sdpConnectionClaimed
void l2cap_disconnection_request(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
bool rfcommConnectionClaimed
#define EV_INQUIRY_COMPLETE
static const uint8_t BTD_EVENT_PIPE
void hci_write_scan_disable()
#define HCI_SET_NAME_STATE
virtual void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto, const USB_ENDPOINT_DESCRIPTOR *ep)
#define EV_LINK_KEY_REQUEST
#define EV_DATA_BUFFER_OVERFLOW
#define HCI_DISCONNECT_STATE
#define HCI_FLAG_CONNECT_COMPLETE
#define EV_PIN_CODE_REQUEST
uint8_t setConf(uint8_t addr, uint8_t ep, uint8_t conf_value)
#define EV_AUTHENTICATION_COMPLETE
#define HCI_FLAG_CONNECT_EVENT
#define HCI_FLAG_DISCONNECT_COMPLETE
#define HCI_REMOTE_NAME_STATE
#define USB_ERROR_FailGetDevDescr
#define HCI_FLAG_CMD_COMPLETE
#define NotifyFailGetDevDescr(...)
uint8_t setEpInfoEntry(uint8_t addr, uint8_t epcount, EpInfo *eprecord_ptr)
#define EV_MAX_SLOTS_CHANGE
static const uint8_t BTD_DATAIN_PIPE
void hci_set_local_name(const char *name)
#define EV_QOS_SETUP_COMPLETE
void hci_write_scan_enable()
virtual uint8_t Release()
virtual void FreeAddress(uint8_t addr)=0
void l2cap_disconnection_response(uint16_t handle, uint8_t rxid, uint8_t *dcid, uint8_t *scid)
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)
virtual UsbDevice * GetUsbDevicePtr(uint8_t addr)=0
#define HCI_CONNECT_DEVICE_STATE
uint8_t setAddr(uint8_t oldaddr, uint8_t ep, uint8_t newaddr)
#define NotifyFailGetConfDescr(...)
#define NotifyFailUnknownDevice(...)
#define USB_NAK_MAX_POWER
#define EV_CONNECT_COMPLETE
void PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR *ep_ptr)
#define EV_DISCONNECT_COMPLETE
#define HCI_FLAG_READ_BDADDR
#define IOGEAR_GBU521_PID
virtual uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)
#define HCI_LOCAL_VERSION_STATE
virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
void hci_disconnect(uint16_t handle)
uint8_t outTransfer(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *data)
void hci_inquiry_cancel()
#define L2CAP_CMD_INFORMATION_RESPONSE
#define HID_REQUEST_SET_REPORT
#define EV_INCOMING_CONNECT
#define HCI_CONNECT_IN_STATE
#define HCI_INQUIRY_STATE
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub=false, uint8_t port=0)=0
#define HCI_CONNECTED_STATE
#define EV_INQUIRY_RESULT
#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE
#define L2CAP_CMD_CONFIG_REQUEST
#define L2CAP_CMD_DISCONNECT_REQUEST
static const uint8_t BTD_CONTROL_PIPE
#define HCI_FLAG_READ_VERSION
bool l2capConnectionClaimed
#define HCI_FLAG_INCOMING_REQUEST
#define EV_NUM_COMPLETE_PKT
#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL
EpInfo epInfo[BTD_MAX_ENDPOINTS]
#define IOGEAR_GBU521_VID
virtual void ACLData(uint8_t *ACLData)
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data)
#define BTD_MAX_ENDPOINTS
#define PS3NAVIGATION_PID
#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED
#define L2CAP_CMD_DISCONNECT_RESPONSE
#define EV_READ_REMOTE_VERSION_INFORMATION_COMPLETE
#define EV_COMMAND_COMPLETE
void l2cap_information_response(uint16_t handle, uint8_t rxid, uint8_t infoTypeLow, uint8_t infoTypeHigh)
#define L2CAP_CMD_CONNECTION_RESPONSE
#define L2CAP_CMD_CONFIG_RESPONSE
#define hci_set_flag(flag)
void hci_write_class_of_device()
#define HCI_CONNECTED_DEVICE_STATE
void hci_pin_code_negative_request_reply()
#define EV_CHANGE_CONNECTION_LINK
uint8_t bNumConfigurations
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
#define hci_check_flag(flag)
AddressPool & GetAddressPool()
#define HCI_CHECK_DEVICE_SERVICE
void hci_link_key_request_negative_reply()
#define EV_LOOPBACK_COMMAND
void L2CAP_Command(uint16_t handle, uint8_t *data, uint8_t nbytes, uint8_t channelLow=0x01, uint8_t channelHigh=0x00)
#define EV_LINK_KEY_NOTIFICATION
void l2cap_config_response(uint16_t handle, uint8_t rxid, uint8_t *scid)
void l2cap_config_request(uint16_t handle, uint8_t rxid, uint8_t *dcid)
void hci_pin_code_request_reply()
#define L2CAP_CMD_CONNECTION_REQUEST
uint8_t RegisterDeviceClass(USBDeviceConfig *pdev)
#define EV_ENCRYPTION_CHANGE
#define NotifyFailSetConfDescr(...)
#define hci_clear_flag(flag)
void hci_authentication_request()
void hci_read_local_version_information()
#define HCI_FLAG_REMOTE_NAME_COMPLETE
void hci_accept_connection()
#define EV_PAGE_SCAN_REP_MODE
#define HCI_FLAG_DEVICE_FOUND
uint8_t getDevDescr(uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t *dataptr)
defined(USB_METHODS_INLINE)
#define NotifyFailSetDevTblEntry(...)
#define USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET
void HCI_Command(uint8_t *data, uint16_t nbytes)