mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Only use simple pairing with the Xbox One S controller, as it did not work with the PS4
This commit is contained in:
parent
102746ef6b
commit
f500cc9b4c
4 changed files with 19 additions and 8 deletions
17
BTD.cpp
17
BTD.cpp
|
@ -29,6 +29,7 @@ connectToWii(false),
|
||||||
pairWithWii(false),
|
pairWithWii(false),
|
||||||
connectToHIDDevice(false),
|
connectToHIDDevice(false),
|
||||||
pairWithHIDDevice(false),
|
pairWithHIDDevice(false),
|
||||||
|
useSimplePairing(false),
|
||||||
pUsb(p), // Pointer to USB class instance - mandatory
|
pUsb(p), // Pointer to USB class instance - mandatory
|
||||||
bAddress(0), // Device address - mandatory
|
bAddress(0), // Device address - mandatory
|
||||||
bNumEP(1), // If config descriptor needs to be parsed
|
bNumEP(1), // If config descriptor needs to be parsed
|
||||||
|
@ -658,7 +659,7 @@ void BTD::HCI_event_task() {
|
||||||
#endif
|
#endif
|
||||||
connectToHIDDevice = true; // Used to indicate to the BTHID service, that it should connect to this device
|
connectToHIDDevice = true; // Used to indicate to the BTHID service, that it should connect to this device
|
||||||
} else {
|
} else {
|
||||||
#ifdef DEBUG_USB_HOST
|
#ifdef EXTRADEBUG
|
||||||
Notify(PSTR("\r\nPairing was successful"), 0x80);
|
Notify(PSTR("\r\nPairing was successful"), 0x80);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -823,11 +824,12 @@ void BTD::HCI_task() {
|
||||||
if(btdName != NULL) {
|
if(btdName != NULL) {
|
||||||
hci_write_local_name(btdName);
|
hci_write_local_name(btdName);
|
||||||
hci_state = HCI_WRITE_NAME_STATE;
|
hci_state = HCI_WRITE_NAME_STATE;
|
||||||
} else {
|
} else if(useSimplePairing) {
|
||||||
hci_read_local_extended_features(0); // "Requests the normal LMP features as returned by Read_Local_Supported_Features"
|
hci_read_local_extended_features(0); // "Requests the normal LMP features as returned by Read_Local_Supported_Features"
|
||||||
//hci_read_local_extended_features(1); // Read page 1
|
//hci_read_local_extended_features(1); // Read page 1
|
||||||
hci_state = HCI_LOCAL_EXTENDED_FEATURES_STATE;
|
hci_state = HCI_LOCAL_EXTENDED_FEATURES_STATE;
|
||||||
}
|
} else
|
||||||
|
hci_state = HCI_CHECK_DEVICE_SERVICE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -837,9 +839,12 @@ void BTD::HCI_task() {
|
||||||
Notify(PSTR("\r\nThe name was set to: "), 0x80);
|
Notify(PSTR("\r\nThe name was set to: "), 0x80);
|
||||||
NotifyStr(btdName, 0x80);
|
NotifyStr(btdName, 0x80);
|
||||||
#endif
|
#endif
|
||||||
hci_read_local_extended_features(0); // "Requests the normal LMP features as returned by Read_Local_Supported_Features"
|
if(useSimplePairing) {
|
||||||
//hci_read_local_extended_features(1); // Read page 1
|
hci_read_local_extended_features(0); // "Requests the normal LMP features as returned by Read_Local_Supported_Features"
|
||||||
hci_state = HCI_LOCAL_EXTENDED_FEATURES_STATE;
|
//hci_read_local_extended_features(1); // Read page 1
|
||||||
|
hci_state = HCI_LOCAL_EXTENDED_FEATURES_STATE;
|
||||||
|
} else
|
||||||
|
hci_state = HCI_CHECK_DEVICE_SERVICE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
3
BTD.h
3
BTD.h
|
@ -530,6 +530,9 @@ public:
|
||||||
return pollInterval;
|
return pollInterval;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Used by the drivers to enable simple pairing */
|
||||||
|
bool useSimplePairing;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** Pointer to USB class instance. */
|
/** Pointer to USB class instance. */
|
||||||
USB *pUsb;
|
USB *pUsb;
|
||||||
|
|
|
@ -258,8 +258,9 @@ void BTHID::ACLData(uint8_t* l2capinbuf) {
|
||||||
#endif
|
#endif
|
||||||
} else if(l2capinbuf[6] == sdp_dcid[0] && l2capinbuf[7] == sdp_dcid[1]) { // SDP
|
} else if(l2capinbuf[6] == sdp_dcid[0] && l2capinbuf[7] == sdp_dcid[1]) { // SDP
|
||||||
if(l2capinbuf[8] == SDP_SERVICE_SEARCH_REQUEST) {
|
if(l2capinbuf[8] == SDP_SERVICE_SEARCH_REQUEST) {
|
||||||
|
#ifdef EXTRADEBUG
|
||||||
Notify(PSTR("\r\nSDP_SERVICE_SEARCH_REQUEST"), 0x80);
|
Notify(PSTR("\r\nSDP_SERVICE_SEARCH_REQUEST"), 0x80);
|
||||||
|
#endif
|
||||||
// Send response
|
// Send response
|
||||||
l2capoutbuf[0] = SDP_SERVICE_SEARCH_RESPONSE;
|
l2capoutbuf[0] = SDP_SERVICE_SEARCH_RESPONSE;
|
||||||
l2capoutbuf[1] = l2capinbuf[9];//transactionIDHigh;
|
l2capoutbuf[1] = l2capinbuf[9];//transactionIDHigh;
|
||||||
|
@ -278,8 +279,9 @@ void BTHID::ACLData(uint8_t* l2capinbuf) {
|
||||||
|
|
||||||
SDP_Command(l2capoutbuf, 10);
|
SDP_Command(l2capoutbuf, 10);
|
||||||
} else if(l2capinbuf[8] == SDP_SERVICE_ATTRIBUTE_REQUEST) {
|
} else if(l2capinbuf[8] == SDP_SERVICE_ATTRIBUTE_REQUEST) {
|
||||||
|
#ifdef EXTRADEBUG
|
||||||
Notify(PSTR("\r\nSDP_SERVICE_ATTRIBUTE_REQUEST"), 0x80);
|
Notify(PSTR("\r\nSDP_SERVICE_ATTRIBUTE_REQUEST"), 0x80);
|
||||||
|
#endif
|
||||||
// Send response
|
// Send response
|
||||||
l2capoutbuf[0] = SDP_SERVICE_ATTRIBUTE_RESPONSE;
|
l2capoutbuf[0] = SDP_SERVICE_ATTRIBUTE_RESPONSE;
|
||||||
l2capoutbuf[1] = l2capinbuf[9];//transactionIDHigh;
|
l2capoutbuf[1] = l2capinbuf[9];//transactionIDHigh;
|
||||||
|
|
|
@ -35,6 +35,7 @@ public:
|
||||||
XBOXONESBT(BTD *p, bool pair = false) :
|
XBOXONESBT(BTD *p, bool pair = false) :
|
||||||
BTHID(p, pair) {
|
BTHID(p, pair) {
|
||||||
XBOXONESParser::Reset();
|
XBOXONESParser::Reset();
|
||||||
|
pBtd->useSimplePairing = true; // The Xbox One S controller only works via simple pairing
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue