mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Do not hardcode identifier when disconnecting
This commit is contained in:
parent
413e65a44f
commit
1ef78c3674
4 changed files with 8 additions and 8 deletions
|
@ -53,7 +53,7 @@ void BTHID::Reset() {
|
||||||
|
|
||||||
void BTHID::disconnect() { // Use this void to disconnect any of the controllers
|
void BTHID::disconnect() { // Use this void to disconnect any of the controllers
|
||||||
// First the HID interrupt channel has to be disconnected, then the HID control channel and finally the HCI connection
|
// First the HID interrupt channel has to be disconnected, then the HID control channel and finally the HCI connection
|
||||||
pBtd->l2cap_disconnection_request(hci_handle, 0x0A, interrupt_scid, interrupt_dcid);
|
pBtd->l2cap_disconnection_request(hci_handle, ++identifier, interrupt_scid, interrupt_dcid);
|
||||||
Reset();
|
Reset();
|
||||||
l2cap_state = L2CAP_INTERRUPT_DISCONNECT;
|
l2cap_state = L2CAP_INTERRUPT_DISCONNECT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,14 +218,14 @@ void PS3BT::Reset() {
|
||||||
l2cap_event_flag = 0; // Reset flags
|
l2cap_event_flag = 0; // Reset flags
|
||||||
l2cap_state = L2CAP_WAIT;
|
l2cap_state = L2CAP_WAIT;
|
||||||
|
|
||||||
// Needed for PS3 Dualshock Controller commands to work via bluetooth
|
// Needed for PS3 Dualshock Controller commands to work via Bluetooth
|
||||||
for (uint8_t i = 0; i < PS3_REPORT_BUFFER_SIZE; i++)
|
for (uint8_t i = 0; i < PS3_REPORT_BUFFER_SIZE; i++)
|
||||||
HIDBuffer[i + 2] = pgm_read_byte(&PS3_REPORT_BUFFER[i]); // First two bytes reserved for report type and ID
|
HIDBuffer[i + 2] = pgm_read_byte(&PS3_REPORT_BUFFER[i]); // First two bytes reserved for report type and ID
|
||||||
}
|
}
|
||||||
|
|
||||||
void PS3BT::disconnect() { // Use this void to disconnect any of the controllers
|
void PS3BT::disconnect() { // Use this void to disconnect any of the controllers
|
||||||
//First the HID interrupt channel has to be disconencted, then the HID control channel and finally the HCI connection
|
// First the HID interrupt channel has to be disconnected, then the HID control channel and finally the HCI connection
|
||||||
pBtd->l2cap_disconnection_request(hci_handle, 0x0A, interrupt_scid, interrupt_dcid);
|
pBtd->l2cap_disconnection_request(hci_handle, ++identifier, interrupt_scid, interrupt_dcid);
|
||||||
Reset();
|
Reset();
|
||||||
l2cap_state = L2CAP_INTERRUPT_DISCONNECT;
|
l2cap_state = L2CAP_INTERRUPT_DISCONNECT;
|
||||||
}
|
}
|
||||||
|
|
6
SPP.cpp
6
SPP.cpp
|
@ -73,13 +73,13 @@ void SPP::Reset() {
|
||||||
|
|
||||||
void SPP::disconnect() {
|
void SPP::disconnect() {
|
||||||
connected = false;
|
connected = false;
|
||||||
// First the two L2CAP channels has to be disconencted and then the HCI connection
|
// First the two L2CAP channels has to be disconnected and then the HCI connection
|
||||||
if (RFCOMMConnected)
|
if (RFCOMMConnected)
|
||||||
pBtd->l2cap_disconnection_request(hci_handle, 0x0A, rfcomm_scid, rfcomm_dcid);
|
pBtd->l2cap_disconnection_request(hci_handle, ++identifier, rfcomm_scid, rfcomm_dcid);
|
||||||
if (RFCOMMConnected && SDPConnected)
|
if (RFCOMMConnected && SDPConnected)
|
||||||
delay(1); // Add delay between commands
|
delay(1); // Add delay between commands
|
||||||
if (SDPConnected)
|
if (SDPConnected)
|
||||||
pBtd->l2cap_disconnection_request(hci_handle, 0x0B, sdp_scid, sdp_dcid);
|
pBtd->l2cap_disconnection_request(hci_handle, ++identifier, sdp_scid, sdp_dcid);
|
||||||
l2cap_sdp_state = L2CAP_DISCONNECT_RESPONSE;
|
l2cap_sdp_state = L2CAP_DISCONNECT_RESPONSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
Wii.cpp
2
Wii.cpp
|
@ -126,7 +126,7 @@ void WII::disconnect() { // Use this void to disconnect any of the controllers
|
||||||
} else
|
} else
|
||||||
timer = millis(); // Don't wait
|
timer = millis(); // Don't wait
|
||||||
// First the HID interrupt channel has to be disconnected, then the HID control channel and finally the HCI connection
|
// First the HID interrupt channel has to be disconnected, then the HID control channel and finally the HCI connection
|
||||||
pBtd->l2cap_disconnection_request(hci_handle, 0x0A, interrupt_scid, interrupt_dcid);
|
pBtd->l2cap_disconnection_request(hci_handle, ++identifier, interrupt_scid, interrupt_dcid);
|
||||||
Reset();
|
Reset();
|
||||||
l2cap_state = L2CAP_INTERRUPT_DISCONNECT;
|
l2cap_state = L2CAP_INTERRUPT_DISCONNECT;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue