30 connectToHIDDevice(false),
31 pairWithHIDDevice(false),
50 uint8_t buf[constBufSize];
99 Notify(
PSTR(
"\r\nOut of address space"), 0x80);
116 #ifdef DEBUG_USB_HOST
117 Notify(
PSTR(
"\r\nPlease create a hub instance in your code: \"USBHub Hub1(&Usb);\""), 0x80);
125 #ifdef DEBUG_USB_HOST
134 uint8_t
BTD::Init(uint8_t parent __attribute__((unused)), uint8_t port __attribute__((unused)),
bool lowspeed) {
146 #ifdef DEBUG_USB_HOST
156 #ifdef DEBUG_USB_HOST
158 D_PrintHex<uint8_t > (rcode, 0x80);
165 D_PrintHex<uint8_t > (
bAddress, 0x80);
172 #ifdef DEBUG_USB_HOST
182 goto FailSetDevTblEntry;
188 goto FailSetConfDescr;
190 #ifdef DEBUG_USB_HOST
193 Notify(
PSTR(
"\r\nDualshock 3 Controller Connected"), 0x80);
195 Notify(
PSTR(
"\r\nNavigation Controller Connected"), 0x80);
197 Notify(
PSTR(
"\r\nMotion Controller Connected"), 0x80);
201 #ifdef DEBUG_USB_HOST
202 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);
209 #ifdef DEBUG_USB_HOST
210 Notify(
PSTR(
"\r\nBluetooth Address was set to: "), 0x80);
211 for(int8_t i = 5; i > 0; i--) {
212 D_PrintHex<uint8_t > (
my_bdaddr[i], 0x80);
215 D_PrintHex<uint8_t > (
my_bdaddr[0], 0x80);
227 for(uint8_t i = 0; i < num_of_conf; i++) {
236 goto FailGetConfDescr;
242 goto FailUnknownDevice;
247 goto FailSetDevTblEntry;
252 goto FailSetConfDescr;
254 hci_num_reset_loops = 100;
260 #ifdef DEBUG_USB_HOST
261 Notify(
PSTR(
"\r\nBluetooth Dongle Initialized"), 0x80);
268 #ifdef DEBUG_USB_HOST
274 #ifdef DEBUG_USB_HOST
280 #ifdef DEBUG_USB_HOST
286 #ifdef DEBUG_USB_HOST
292 #ifdef DEBUG_USB_HOST
293 Notify(
PSTR(
"\r\nBTD Init Failed, error code: "), 0x80);
300 void BTD::Initialize() {
311 btService[i]->
Reset();
352 if(pollInterval < pep->bInterval)
359 Notify(
PSTR(
"\r\nEndpoint descriptor:"), 0x80);
361 D_PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
363 D_PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
365 D_PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
367 D_PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
369 D_PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
371 D_PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
400 void BTD::HCI_event_task() {
404 if(!rcode || rcode ==
hrNAK) {
409 if((hcibuf[3] == 0x01) && (hcibuf[4] == 0x10)) {
412 }
else if((hcibuf[3] == 0x09) && (hcibuf[4] == 0x10)) {
413 for(uint8_t i = 0; i < 6; i++)
422 #ifdef DEBUG_USB_HOST
423 Notify(
PSTR(
"\r\nHCI Command Failed: "), 0x80);
424 D_PrintHex<uint8_t > (hcibuf[2], 0x80);
432 #ifdef DEBUG_USB_HOST
434 Notify(
PSTR(
"\r\nCouldn't find Wiimote"), 0x80);
436 Notify(
PSTR(
"\r\nCouldn't find HID device"), 0x80);
450 Notify(
PSTR(
"\r\nNumber of responses: "), 0x80);
453 for(uint8_t i = 0; i < hcibuf[2]; i++) {
454 uint8_t offset = 8 * hcibuf[2] + 3 * i;
456 for(uint8_t j = 0; j < 3; j++)
457 classOfDevice[j] = hcibuf[j + 4 + offset];
461 D_PrintHex<uint8_t > (classOfDevice[2], 0x80);
463 D_PrintHex<uint8_t > (classOfDevice[1], 0x80);
465 D_PrintHex<uint8_t > (classOfDevice[0], 0x80);
468 if(
pairWithWii && classOfDevice[2] == 0x00 && (classOfDevice[1] & 0x05) && (classOfDevice[0] & 0x0C)) {
469 checkRemoteName =
true;
471 for(uint8_t j = 0; j < 6; j++)
476 }
else if(
pairWithHIDDevice && (classOfDevice[1] & 0x05) && (classOfDevice[0] & 0xC8)) {
477 #ifdef DEBUG_USB_HOST
478 if(classOfDevice[0] & 0x80)
480 if(classOfDevice[0] & 0x40)
482 if(classOfDevice[0] & 0x08)
486 for(uint8_t j = 0; j < 6; j++)
500 Notify(
PSTR(
"\r\nConnection established"), 0x80);
502 hci_handle = hcibuf[3] | ((hcibuf[4] & 0x0F) << 8);
506 #ifdef DEBUG_USB_HOST
507 Notify(
PSTR(
"\r\nConnection Failed: "), 0x80);
508 D_PrintHex<uint8_t > (hcibuf[2], 0x80);
522 for(uint8_t i = 0; i < min(
sizeof (
remote_name),
sizeof (hcibuf) - 9); i++) {
533 for(uint8_t i = 0; i < 6; i++)
536 for(uint8_t i = 0; i < 3; i++)
537 classOfDevice[i] = hcibuf[i + 8];
539 if((classOfDevice[1] & 0x05) && (classOfDevice[0] & 0xC8)) {
540 #ifdef DEBUG_USB_HOST
541 if(classOfDevice[0] & 0x80)
542 Notify(
PSTR(
"\r\nMouse is connecting"), 0x80);
543 if(classOfDevice[0] & 0x40)
544 Notify(
PSTR(
"\r\nKeyboard is connecting"), 0x80);
545 if(classOfDevice[0] & 0x08)
546 Notify(
PSTR(
"\r\nGamepad is connecting"), 0x80);
553 D_PrintHex<uint8_t > (classOfDevice[2], 0x80);
555 D_PrintHex<uint8_t > (classOfDevice[1], 0x80);
557 D_PrintHex<uint8_t > (classOfDevice[0], 0x80);
564 #ifdef DEBUG_USB_HOST
565 Notify(
PSTR(
"\r\nPairing with Wiimote"), 0x80);
568 }
else if(
btdPin != NULL) {
569 #ifdef DEBUG_USB_HOST
570 Notify(
PSTR(
"\r\nBluetooth pin is set too: "), 0x80);
575 #ifdef DEBUG_USB_HOST
583 #ifdef DEBUG_USB_HOST
584 Notify(
PSTR(
"\r\nReceived Key Request"), 0x80);
592 #ifdef DEBUG_USB_HOST
593 Notify(
PSTR(
"\r\nPairing successful with Wiimote"), 0x80);
597 #ifdef DEBUG_USB_HOST
598 Notify(
PSTR(
"\r\nPairing successful with HID device"), 0x80);
603 #ifdef DEBUG_USB_HOST
605 D_PrintHex<uint8_t > (hcibuf[2], 0x80);
626 if(hcibuf[0] != 0x00) {
627 Notify(
PSTR(
"\r\nUnmanaged HCI Event: "), 0x80);
628 D_PrintHex<uint8_t > (hcibuf[0], 0x80);
637 D_PrintHex<uint8_t > (rcode, 0x80);
643 void BTD::HCI_task() {
647 if(hci_counter > hci_num_reset_loops) {
658 #ifdef DEBUG_USB_HOST
663 }
else if(hci_counter > hci_num_reset_loops) {
664 hci_num_reset_loops *= 10;
665 if(hci_num_reset_loops > 2000)
666 hci_num_reset_loops = 2000;
667 #ifdef DEBUG_USB_HOST
668 Notify(
PSTR(
"\r\nNo response to HCI Reset"), 0x80);
677 #ifdef DEBUG_USB_HOST
678 Notify(
PSTR(
"\r\nWrite class of device"), 0x80);
687 #ifdef DEBUG_USB_HOST
688 Notify(
PSTR(
"\r\nLocal Bluetooth Address: "), 0x80);
689 for(int8_t i = 5; i > 0; i--) {
690 D_PrintHex<uint8_t > (
my_bdaddr[i], 0x80);
693 D_PrintHex<uint8_t > (my_bdaddr[0], 0x80);
712 #ifdef DEBUG_USB_HOST
713 Notify(
PSTR(
"\r\nThe name is set to: "), 0x80);
722 #ifdef DEBUG_USB_HOST
724 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);
726 Notify(
PSTR(
"\r\nPlease enable discovery of your device"), 0x80);
737 #ifdef DEBUG_USB_HOST
743 Notify(
PSTR(
"\r\nNow just create the instance like so:"), 0x80);
749 Notify(
PSTR(
"\r\nAnd then press any button on the "), 0x80);
755 if(checkRemoteName) {
765 #ifdef DEBUG_USB_HOST
767 Notify(
PSTR(
"\r\nConnecting to Wiimote"), 0x80);
769 Notify(
PSTR(
"\r\nConnecting to HID device"), 0x80);
771 checkRemoteName =
false;
780 #ifdef DEBUG_USB_HOST
782 Notify(
PSTR(
"\r\nConnected to Wiimote"), 0x80);
784 Notify(
PSTR(
"\r\nConnected to HID device"), 0x80);
789 #ifdef DEBUG_USB_HOST
790 Notify(
PSTR(
"\r\nTrying to connect one more time..."), 0x80);
799 #ifdef DEBUG_USB_HOST
800 Notify(
PSTR(
"\r\nWait For Incoming Connection Request"), 0x80);
811 #ifdef DEBUG_USB_HOST
812 Notify(
PSTR(
"\r\nIncoming Connection Request"), 0x80);
822 #ifdef DEBUG_USB_HOST
827 if(strncmp((
const char*)
remote_name,
"Nintendo", 8) == 0) {
831 pairWiiUsingSync =
false;
832 #ifdef DEBUG_USB_HOST
833 Notify(
PSTR(
"\r\nWiimote is connecting"), 0x80);
835 if(strncmp((
const char*)
remote_name,
"Nintendo RVL-CNT-01-TR", 22) == 0) {
836 #ifdef DEBUG_USB_HOST
837 Notify(
PSTR(
" with Motion Plus Inside"), 0x80);
840 }
else if(strncmp((
const char*)
remote_name,
"Nintendo RVL-CNT-01-UC", 22) == 0) {
841 #ifdef DEBUG_USB_HOST
842 Notify(
PSTR(
" - Wii U Pro Controller"), 0x80);
845 }
else if(strncmp((
const char*)
remote_name,
"Nintendo RVL-WBC-01", 19) == 0) {
846 #ifdef DEBUG_USB_HOST
849 pairWiiUsingSync =
true;
852 if(classOfDevice[2] == 0 && classOfDevice[1] == 0x25 && classOfDevice[0] == 0x08 && strncmp((
const char*)
remote_name,
"Wireless Controller", 19) == 0) {
853 #ifdef DEBUG_USB_HOST
854 Notify(
PSTR(
"\r\nPS4 controller is connecting"), 0x80);
869 #ifdef DEBUG_USB_HOST
870 Notify(
PSTR(
"\r\nConnected to Device: "), 0x80);
871 for(int8_t i = 5; i > 0; i--) {
875 D_PrintHex<uint8_t > (disc_bdaddr[0], 0x80);
892 if(hci_counter > 1000) {
900 #ifdef DEBUG_USB_HOST
901 Notify(
PSTR(
"\r\nHCI Disconnected from Device"), 0x80);
921 void BTD::ACL_event_task() {
929 btService[i]->
ACLData(l2capinbuf);
934 else if(rcode !=
hrNAK) {
935 Notify(
PSTR(
"\r\nACL data in error: "), 0x80);
936 D_PrintHex<uint8_t > (rcode, 0x80);
950 pUsb->
ctrlReq(
bAddress,
epInfo[
BTD_CONTROL_PIPE ].epAddr,
bmREQ_HCI_OUT, 0x00, 0x00, 0x00, 0x00, nbytes, nbytes, data, NULL);
956 hcibuf[1] = 0x03 << 2;
965 hcibuf[1] = 0x03 << 2;
977 hcibuf[1] = 0x03 << 2;
987 hcibuf[1] = 0x04 << 2;
996 hcibuf[1] = 0x04 << 2;
1005 hcibuf[1] = 0x01 << 2;
1007 hcibuf[3] = disc_bdaddr[0];
1008 hcibuf[4] = disc_bdaddr[1];
1009 hcibuf[5] = disc_bdaddr[2];
1010 hcibuf[6] = disc_bdaddr[3];
1011 hcibuf[7] = disc_bdaddr[4];
1012 hcibuf[8] = disc_bdaddr[5];
1021 hcibuf[1] = 0x01 << 2;
1023 hcibuf[3] = disc_bdaddr[0];
1024 hcibuf[4] = disc_bdaddr[1];
1025 hcibuf[5] = disc_bdaddr[2];
1026 hcibuf[6] = disc_bdaddr[3];
1027 hcibuf[7] = disc_bdaddr[4];
1028 hcibuf[8] = disc_bdaddr[5];
1039 hcibuf[1] = 0x03 << 2;
1040 hcibuf[2] = strlen(name) + 1;
1042 for(i = 0; i < strlen(name); i++)
1043 hcibuf[i + 3] = name[i];
1044 hcibuf[i + 3] = 0x00;
1052 hcibuf[1] = 0x01 << 2;
1065 hcibuf[1] = 0x01 << 2;
1078 hcibuf[1] = 0x01 << 2;
1080 hcibuf[3] = bdaddr[0];
1081 hcibuf[4] = bdaddr[1];
1082 hcibuf[5] = bdaddr[2];
1083 hcibuf[6] = bdaddr[3];
1084 hcibuf[7] = bdaddr[4];
1085 hcibuf[8] = bdaddr[5];
1099 hcibuf[1] = 0x01 << 2;
1101 hcibuf[3] = disc_bdaddr[0];
1102 hcibuf[4] = disc_bdaddr[1];
1103 hcibuf[5] = disc_bdaddr[2];
1104 hcibuf[6] = disc_bdaddr[3];
1105 hcibuf[7] = disc_bdaddr[4];
1106 hcibuf[8] = disc_bdaddr[5];
1109 if(pairWiiUsingSync) {
1110 #ifdef DEBUG_USB_HOST
1111 Notify(
PSTR(
"\r\nPairing with Wii controller via SYNC"), 0x80);
1113 for(uint8_t i = 0; i < 6; i++)
1116 for(uint8_t i = 0; i < 6; i++)
1117 hcibuf[10 + i] = disc_bdaddr[i];
1119 for(uint8_t i = 16; i < 26; i++)
1122 hcibuf[9] = strlen(
btdPin);
1124 for(i = 0; i < strlen(
btdPin); i++)
1125 hcibuf[i + 10] =
btdPin[i];
1127 hcibuf[i + 10] = 0x00;
1135 hcibuf[1] = 0x01 << 2;
1137 hcibuf[3] = disc_bdaddr[0];
1138 hcibuf[4] = disc_bdaddr[1];
1139 hcibuf[5] = disc_bdaddr[2];
1140 hcibuf[6] = disc_bdaddr[3];
1141 hcibuf[7] = disc_bdaddr[4];
1142 hcibuf[8] = disc_bdaddr[5];
1149 hcibuf[1] = 0x01 << 2;
1151 hcibuf[3] = disc_bdaddr[0];
1152 hcibuf[4] = disc_bdaddr[1];
1153 hcibuf[5] = disc_bdaddr[2];
1154 hcibuf[6] = disc_bdaddr[3];
1155 hcibuf[7] = disc_bdaddr[4];
1156 hcibuf[8] = disc_bdaddr[5];
1163 hcibuf[1] = 0x01 << 2;
1166 hcibuf[4] = (uint8_t)((
hci_handle >> 8) & 0x0F);
1174 hcibuf[1] = 0x01 << 2;
1176 hcibuf[3] = (uint8_t)(handle & 0xFF);
1177 hcibuf[4] = (uint8_t)((handle >> 8) & 0x0F);
1185 hcibuf[1] = 0x03 << 2;
1219 void BTD::L2CAP_Command(uint16_t handle, uint8_t* data, uint8_t nbytes, uint8_t channelLow, uint8_t channelHigh) {
1220 uint8_t buf[8 + nbytes];
1221 buf[0] = (uint8_t)(handle & 0xff);
1222 buf[1] = (uint8_t)(((handle >> 8) & 0x0f) | 0x20);
1223 buf[2] = (uint8_t)((4 + nbytes) & 0xff);
1224 buf[3] = (uint8_t)((4 + nbytes) >> 8);
1225 buf[4] = (uint8_t)(nbytes & 0xff);
1226 buf[5] = (uint8_t)(nbytes >> 8);
1227 buf[6] = channelLow;
1228 buf[7] = channelHigh;
1230 for(uint16_t i = 0; i < nbytes; i++)
1231 buf[8 + i] = data[i];
1236 #ifdef DEBUG_USB_HOST
1237 Notify(
PSTR(
"\r\nError sending L2CAP message: 0x"), 0x80);
1238 D_PrintHex<uint8_t > (rcode, 0x80);
1240 D_PrintHex<uint8_t > (channelHigh, 0x80);
1242 D_PrintHex<uint8_t > (channelLow, 0x80);
1249 l2capoutbuf[1] = rxid;
1250 l2capoutbuf[2] = 0x04;
1251 l2capoutbuf[3] = 0x00;
1252 l2capoutbuf[4] = (uint8_t)(psm & 0xff);
1253 l2capoutbuf[5] = (uint8_t)(psm >> 8);
1254 l2capoutbuf[6] = scid[0];
1255 l2capoutbuf[7] = scid[1];
1262 l2capoutbuf[1] = rxid;
1263 l2capoutbuf[2] = 0x08;
1264 l2capoutbuf[3] = 0x00;
1265 l2capoutbuf[4] = dcid[0];
1266 l2capoutbuf[5] = dcid[1];
1267 l2capoutbuf[6] = scid[0];
1268 l2capoutbuf[7] = scid[1];
1269 l2capoutbuf[8] = result;
1270 l2capoutbuf[9] = 0x00;
1271 l2capoutbuf[10] = 0x00;
1272 l2capoutbuf[11] = 0x00;
1279 l2capoutbuf[1] = rxid;
1280 l2capoutbuf[2] = 0x08;
1281 l2capoutbuf[3] = 0x00;
1282 l2capoutbuf[4] = dcid[0];
1283 l2capoutbuf[5] = dcid[1];
1284 l2capoutbuf[6] = 0x00;
1285 l2capoutbuf[7] = 0x00;
1286 l2capoutbuf[8] = 0x01;
1287 l2capoutbuf[9] = 0x02;
1288 l2capoutbuf[10] = 0xFF;
1289 l2capoutbuf[11] = 0xFF;
1296 l2capoutbuf[1] = rxid;
1297 l2capoutbuf[2] = 0x0A;
1298 l2capoutbuf[3] = 0x00;
1299 l2capoutbuf[4] = scid[0];
1300 l2capoutbuf[5] = scid[1];
1301 l2capoutbuf[6] = 0x00;
1302 l2capoutbuf[7] = 0x00;
1303 l2capoutbuf[8] = 0x00;
1304 l2capoutbuf[9] = 0x00;
1305 l2capoutbuf[10] = 0x01;
1306 l2capoutbuf[11] = 0x02;
1307 l2capoutbuf[12] = 0xA0;
1308 l2capoutbuf[13] = 0x02;
1315 l2capoutbuf[1] = rxid;
1316 l2capoutbuf[2] = 0x04;
1317 l2capoutbuf[3] = 0x00;
1318 l2capoutbuf[4] = dcid[0];
1319 l2capoutbuf[5] = dcid[1];
1320 l2capoutbuf[6] = scid[0];
1321 l2capoutbuf[7] = scid[1];
1328 l2capoutbuf[1] = rxid;
1329 l2capoutbuf[2] = 0x04;
1330 l2capoutbuf[3] = 0x00;
1331 l2capoutbuf[4] = dcid[0];
1332 l2capoutbuf[5] = dcid[1];
1333 l2capoutbuf[6] = scid[0];
1334 l2capoutbuf[7] = scid[1];
1341 l2capoutbuf[1] = rxid;
1342 l2capoutbuf[2] = 0x08;
1343 l2capoutbuf[3] = 0x00;
1344 l2capoutbuf[4] = infoTypeLow;
1345 l2capoutbuf[5] = infoTypeHigh;
1346 l2capoutbuf[6] = 0x00;
1347 l2capoutbuf[7] = 0x00;
1348 l2capoutbuf[8] = 0x00;
1349 l2capoutbuf[9] = 0x00;
1350 l2capoutbuf[10] = 0x00;
1351 l2capoutbuf[11] = 0x00;
1357 void BTD::setBdaddr(uint8_t* bdaddr) {
1363 for(uint8_t i = 0; i < 6; i++)
1364 buf[i + 2] = bdaddr[5 - i];
1367 pUsb->
ctrlReq(
bAddress,
epInfo[
BTD_CONTROL_PIPE].epAddr,
bmREQ_HID_OUT,
HID_REQUEST_SET_REPORT, 0xF5, 0x03, 0x00, 8, 8, buf, NULL);
1370 void BTD::setMoveBdaddr(uint8_t* bdaddr) {
1379 for(uint8_t i = 0; i < 6; i++)
1380 buf[i + 1] = bdaddr[i];
1383 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
bool waitingForConnection
#define EV_INQUIRY_COMPLETE
static const uint8_t BTD_EVENT_PIPE
void hci_write_scan_disable()
#define BELKIN_F8T065BF_PID
#define HCI_SET_NAME_STATE
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 USB_TRANSFER_TYPE_INTERRUPT
#define HCI_FLAG_CONNECT_EVENT
#define HCI_FLAG_DISCONNECT_COMPLETE
#define BELKIN_F8T065BF_VID
#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 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
uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed)
#define HCI_LOCAL_VERSION_STATE
virtual void disconnect()=0
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 bmUSB_TRANSFER_TYPE
#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
#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
uint8_t inTransfer(uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t *data, uint8_t bInterval=0)
void hci_pin_code_negative_request_reply()
#define EV_CHANGE_CONNECTION_LINK
virtual void ACLData(uint8_t *ACLData)=0
uint8_t bNumConfigurations
#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL
#define hci_check_flag(flag)
AddressPool & GetAddressPool()
#define HCI_CHECK_DEVICE_SERVICE
#define USB_TRANSFER_TYPE_BULK
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 HID_REQUEST_SET_REPORT
#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)