mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Set protocol shouldn’t have it’s own state, as it will then sometimes not call the other states afterwards
This commit is contained in:
parent
627c390191
commit
bcc4afede5
2 changed files with 15 additions and 19 deletions
13
BTHID.cpp
13
BTHID.cpp
|
@ -254,7 +254,7 @@ void BTHID::L2CAP_task() {
|
||||||
#ifdef DEBUG_USB_HOST
|
#ifdef DEBUG_USB_HOST
|
||||||
Notify(PSTR("\r\nHID Control Successfully Configured"), 0x80);
|
Notify(PSTR("\r\nHID Control Successfully Configured"), 0x80);
|
||||||
#endif
|
#endif
|
||||||
setProtocol();
|
setProtocol(); // Set protocol before establishing HID interrupt channel
|
||||||
l2cap_state = L2CAP_INTERRUPT_SETUP;
|
l2cap_state = L2CAP_INTERRUPT_SETUP;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -283,24 +283,21 @@ void BTHID::L2CAP_task() {
|
||||||
#endif
|
#endif
|
||||||
identifier++;
|
identifier++;
|
||||||
pBtd->l2cap_config_request(hci_handle, identifier, control_scid);
|
pBtd->l2cap_config_request(hci_handle, identifier, control_scid);
|
||||||
l2cap_state = L2CAP_SET_PROTOCOL;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case L2CAP_SET_PROTOCOL:
|
|
||||||
if (l2cap_config_success_control_flag) {
|
|
||||||
setProtocol();
|
|
||||||
l2cap_state = L2CAP_CONTROL_CONFIG_REQUEST;
|
l2cap_state = L2CAP_CONTROL_CONFIG_REQUEST;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case L2CAP_CONTROL_CONFIG_REQUEST:
|
case L2CAP_CONTROL_CONFIG_REQUEST:
|
||||||
|
if (l2cap_config_success_control_flag) {
|
||||||
|
setProtocol(); // Set protocol before establishing HID interrupt channel
|
||||||
|
delay(1); // Short delay between commands - just to be sure
|
||||||
#ifdef DEBUG_USB_HOST
|
#ifdef DEBUG_USB_HOST
|
||||||
Notify(PSTR("\r\nSend HID Interrupt Connection Request"), 0x80);
|
Notify(PSTR("\r\nSend HID Interrupt Connection Request"), 0x80);
|
||||||
#endif
|
#endif
|
||||||
identifier++;
|
identifier++;
|
||||||
pBtd->l2cap_connection_request(hci_handle, identifier, interrupt_dcid, HID_INTR_PSM);
|
pBtd->l2cap_connection_request(hci_handle, identifier, interrupt_dcid, HID_INTR_PSM);
|
||||||
l2cap_state = L2CAP_INTERRUPT_CONNECT_REQUEST;
|
l2cap_state = L2CAP_INTERRUPT_CONNECT_REQUEST;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case L2CAP_INTERRUPT_CONNECT_REQUEST:
|
case L2CAP_INTERRUPT_CONNECT_REQUEST:
|
||||||
|
|
13
BTHID.h
13
BTHID.h
|
@ -31,15 +31,14 @@
|
||||||
|
|
||||||
// These states are used if the Arduino is the host
|
// These states are used if the Arduino is the host
|
||||||
#define L2CAP_CONTROL_CONNECT_REQUEST 3
|
#define L2CAP_CONTROL_CONNECT_REQUEST 3
|
||||||
#define L2CAP_SET_PROTOCOL 4
|
#define L2CAP_CONTROL_CONFIG_REQUEST 4
|
||||||
#define L2CAP_CONTROL_CONFIG_REQUEST 5
|
#define L2CAP_INTERRUPT_CONNECT_REQUEST 5
|
||||||
#define L2CAP_INTERRUPT_CONNECT_REQUEST 6
|
|
||||||
|
|
||||||
#define L2CAP_INTERRUPT_CONFIG_REQUEST 7
|
#define L2CAP_INTERRUPT_CONFIG_REQUEST 6
|
||||||
#define L2CAP_DONE 8
|
#define L2CAP_DONE 7
|
||||||
|
|
||||||
#define L2CAP_INTERRUPT_DISCONNECT 9
|
#define L2CAP_INTERRUPT_DISCONNECT 8
|
||||||
#define L2CAP_CONTROL_DISCONNECT 10
|
#define L2CAP_CONTROL_DISCONNECT 9
|
||||||
|
|
||||||
/* L2CAP event flags */
|
/* L2CAP event flags */
|
||||||
#define L2CAP_FLAG_CONTROL_CONNECTED 0x01
|
#define L2CAP_FLAG_CONTROL_CONNECTED 0x01
|
||||||
|
|
Loading…
Reference in a new issue