mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-06-13 04:14:19 +00:00
Extra protocol value in the RFCOMM protocol is the channel number, not the PSM - update typedef name and size.
Add delay to the Connection Request signal processing routine - without this, the host will not create the RFCOMM channel correctly. Need to investigate why this delay is needed.
This commit is contained in:
parent
480da5aab6
commit
a405a9bdf8
@ -291,7 +291,8 @@ void Bluetooth_PacketReceived(void* Data, uint16_t DataLen, Bluetooth_Channel_t*
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* Unknown Protocol packet */
|
/* Unknown Protocol packet */
|
||||||
printf_P(PSTR("Unknown Packet Received (Channel 0x%04X, PSM: 0x%02X):\r\n"), Channel->LocalNumber, Channel->PSM);
|
printf_P(PSTR("Unknown Packet Received (Channel 0x%04X, PSM: 0x%02X, Len: 0x%04X):\r\n"),
|
||||||
|
Channel->LocalNumber, Channel->PSM, DataLen);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
TODO: Make SendPacket respect receiver's MTU
|
TODO: Make SendPacket respect receiver's MTU
|
||||||
TODO: Make ReceivePacket stitch together MTU fragments (?)
|
TODO: Make ReceivePacket stitch together MTU fragments (?)
|
||||||
TODO: Add channel opened/closed callbacks
|
TODO: Add channel opened/closed callbacks
|
||||||
|
TODO: Figure out why delay is needed in connection for services
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define INCLUDE_FROM_BLUETOOTH_ACLPACKETS_C
|
#define INCLUDE_FROM_BLUETOOTH_ACLPACKETS_C
|
||||||
@ -363,10 +364,12 @@ static inline void Bluetooth_Signal_ConnectionReq(const BT_Signal_Header_t* cons
|
|||||||
|
|
||||||
Pipe_ClearIN();
|
Pipe_ClearIN();
|
||||||
Pipe_Freeze();
|
Pipe_Freeze();
|
||||||
|
|
||||||
BT_ACL_DEBUG(1, "<< L2CAP Connection Request");
|
BT_ACL_DEBUG(1, "<< L2CAP Connection Request");
|
||||||
BT_ACL_DEBUG(2, "-- PSM: 0x%04X", ConnectionRequest.PSM);
|
BT_ACL_DEBUG(2, "-- PSM: 0x%04X", ConnectionRequest.PSM);
|
||||||
BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", ConnectionRequest.SourceChannel);
|
BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", ConnectionRequest.SourceChannel);
|
||||||
|
|
||||||
|
_delay_ms(15); // TODO - Determine why this is needed
|
||||||
|
|
||||||
/* Try to retrieve the existing channel's information structure if it exists */
|
/* Try to retrieve the existing channel's information structure if it exists */
|
||||||
Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(ConnectionRequest.SourceChannel, CHANNEL_SEARCH_REMOTENUMBER);
|
Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(ConnectionRequest.SourceChannel, CHANNEL_SEARCH_REMOTENUMBER);
|
||||||
|
@ -56,15 +56,15 @@ const struct
|
|||||||
|
|
||||||
const struct
|
const struct
|
||||||
{
|
{
|
||||||
uint8_t Header;
|
uint8_t Header;
|
||||||
uint8_t Size;
|
uint8_t Size;
|
||||||
|
|
||||||
ItemProtocol_t L2CAP;
|
ItemProtocol_t L2CAP;
|
||||||
ItemProtocolPSM_t RFCOMM;
|
ItemProtocolChannel_t RFCOMM;
|
||||||
} PROGMEM SerialPort_Attribute_ProtocolDescriptor =
|
} PROGMEM SerialPort_Attribute_ProtocolDescriptor =
|
||||||
{
|
{
|
||||||
(SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit),
|
(SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit),
|
||||||
(sizeof(ItemProtocol_t) + sizeof(ItemProtocolPSM_t)),
|
(sizeof(ItemProtocol_t) + sizeof(ItemProtocolChannel_t)),
|
||||||
{
|
{
|
||||||
(SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit),
|
(SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit),
|
||||||
sizeof(ItemUUID_t),
|
sizeof(ItemUUID_t),
|
||||||
@ -74,10 +74,10 @@ const struct
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
(SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit),
|
(SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit),
|
||||||
(sizeof(ItemUUID_t) + sizeof(Item16Bit_t)),
|
(sizeof(ItemUUID_t) + sizeof(Item8Bit_t)),
|
||||||
{
|
{
|
||||||
{(SDP_DATATYPE_UUID | SDP_DATASIZE_128Bit), RFCOMM_UUID},
|
{(SDP_DATATYPE_UUID | SDP_DATASIZE_128Bit), RFCOMM_UUID},
|
||||||
{(SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_16Bit), SWAPENDIAN_16(CHANNEL_PSM_RFCOMM)},
|
{(SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_8Bit), 0x03},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -145,20 +145,20 @@
|
|||||||
} Protocol;
|
} Protocol;
|
||||||
} ItemProtocol_t;
|
} ItemProtocol_t;
|
||||||
|
|
||||||
/** Structure for a list of Data Elements Sequences containing UUID Data Elements and 16-bit PSM values, for service
|
/** Structure for a list of Data Elements Sequences containing UUID Data Elements and 8-bit channel values, for service
|
||||||
* attributes requiring extended protocol lists.
|
* attributes requiring extended protocol lists.
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint8_t Header; /**< Data Element header, should be (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit) */
|
uint8_t Header; /**< Data Element header, should be (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit) */
|
||||||
uint8_t Size; /**< Size of the inner Data Element sequence */
|
uint8_t Size; /**< Size of the inner Data Element sequence */
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
ItemUUID_t UUID; /**< UUID to store in the protocol list Data Element sequence */
|
ItemUUID_t UUID; /**< UUID to store in the protocol list Data Element sequence */
|
||||||
Item16Bit_t PSM; /**< PSM that is to be used to access the service on created channels */
|
Item8Bit_t Channel; /**< Channel that is to be used to access the service */
|
||||||
} Protocol;
|
} Protocol;
|
||||||
} ItemProtocolPSM_t;
|
} ItemProtocolChannel_t;
|
||||||
|
|
||||||
/** Structure for a list of Data Elements containing language encodings, including the language ID, Encoding ID and
|
/** Structure for a list of Data Elements containing language encodings, including the language ID, Encoding ID and
|
||||||
* Attribute base offset.
|
* Attribute base offset.
|
||||||
@ -172,5 +172,6 @@
|
|||||||
|
|
||||||
/* External Variables: */
|
/* External Variables: */
|
||||||
extern const ServiceAttributeTable_t SerialPort_Attribute_Table[];
|
extern const ServiceAttributeTable_t SerialPort_Attribute_Table[];
|
||||||
|
extern const ServiceAttributeTable_t PnP_Attribute_Table[];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user