diff --git a/BTD.cpp b/BTD.cpp index ab55885b..a7a9f986 100644 --- a/BTD.cpp +++ b/BTD.cpp @@ -878,13 +878,14 @@ void BTD::hci_pin_code_request_reply() { for(uint8_t i = 16; i < 26; i++) hcibuf[i] = 0x00; // The rest should be 0 } else { - hcibuf[9] = strlen(btdPin); // Length of key + hcibuf[9] = strlen(btdPin); // Length of pin uint8_t i; - for(i = 0; i < strlen(btdPin); i++) // The maximum size of the key is 16 + for(i = 0; i < strlen(btdPin); i++) // The maximum size of the pin is 16 hcibuf[i+10] = btdPin[i]; for(;i < 16; i++) hcibuf[i+10] = 0x00; // The rest should be 0 } + HCI_Command(hcibuf, 26); } void BTD::hci_pin_code_negative_request_reply() { diff --git a/Wii.cpp b/Wii.cpp index 27f41727..37fc806e 100644 --- a/Wii.cpp +++ b/Wii.cpp @@ -43,6 +43,7 @@ void WII::Reset() { nunchuckConnected = false; motionPlusConnected = false; activateNunchuck = false; + motionValuesReset = false; l2cap_event_flag = 0; // Reset flags l2cap_state = L2CAP_WAIT; } @@ -72,7 +73,7 @@ void WII::ACLData(uint8_t* l2capinbuf) { Notify(PSTR(" ")); PrintHex(l2capinbuf[14]); #endif - } + } else if (l2capinbuf[8] == L2CAP_CMD_CONNECTION_RESPONSE) { if (((l2capinbuf[16] | (l2capinbuf[17] << 8)) == 0x0000) && ((l2capinbuf[18] | (l2capinbuf[19] << 8)) == SUCCESSFUL)) { // Success if (l2capinbuf[14] == control_dcid[0] && l2capinbuf[15] == control_dcid[1]) { // Success