mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-31 19:20:26 +00:00
fix compile, added HID PSMs
This commit is contained in:
parent
b35f641c7f
commit
3558ddaba3
@ -45,13 +45,16 @@
|
|||||||
|
|
||||||
hci_con_handle_t con_handle;
|
hci_con_handle_t con_handle;
|
||||||
|
|
||||||
|
uint16_t hid_control = 0;
|
||||||
|
uint16_t hid_interrupt = 0;
|
||||||
|
|
||||||
void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||||
|
|
||||||
bd_addr_t event_addr;
|
bd_addr_t event_addr;
|
||||||
uint16_t handle;
|
uint16_t handle;
|
||||||
uint16_t psm;
|
uint16_t psm;
|
||||||
uint16_t source_cid;
|
uint16_t local_cid;
|
||||||
uint16_t dest_cid;
|
uint16_t remote_cid;
|
||||||
|
|
||||||
switch (packet_type) {
|
switch (packet_type) {
|
||||||
|
|
||||||
@ -90,7 +93,7 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint
|
|||||||
handle, psm, local_cid, remote_cid);
|
handle, psm, local_cid, remote_cid);
|
||||||
|
|
||||||
// accept
|
// accept
|
||||||
bt_send_cmd(&l2cap_accept_connection, source_cid);
|
bt_send_cmd(&l2cap_accept_connection, local_cid);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case L2CAP_EVENT_CHANNEL_OPENED:
|
case L2CAP_EVENT_CHANNEL_OPENED:
|
||||||
@ -104,6 +107,18 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint
|
|||||||
print_bd_addr(event_addr);
|
print_bd_addr(event_addr);
|
||||||
printf(", handle 0x%02x, psm 0x%02x, local cid 0x%02x, remote cid 0x%02x\n",
|
printf(", handle 0x%02x, psm 0x%02x, local cid 0x%02x, remote cid 0x%02x\n",
|
||||||
handle, psm, local_cid, READ_BT_16(packet, 15));
|
handle, psm, local_cid, READ_BT_16(packet, 15));
|
||||||
|
|
||||||
|
if (psm == PSM_HID_CONTROL){
|
||||||
|
hid_control = local_cid;
|
||||||
|
}
|
||||||
|
if (psm == PSM_HID_INTERRUPT){
|
||||||
|
hid_interrupt = local_cid;
|
||||||
|
}
|
||||||
|
if (hid_control && hid_interrupt){
|
||||||
|
//HID Control: 0x06 bytes - SET_FEATURE_REPORT [ 53 F4 42 03 00 00 ]
|
||||||
|
// uint8_t set_feature_report[] = { 0x53, 0xf4, 0x42, 0x03, 0x00, 0x00};
|
||||||
|
// bt_send_l2cap(hid_control, (uint8_t*) &set_feature_report, sizeof(set_feature_report));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
printf("L2CAP connection to device ");
|
printf("L2CAP connection to device ");
|
||||||
print_bd_addr(event_addr);
|
print_bd_addr(event_addr);
|
||||||
|
@ -56,9 +56,11 @@
|
|||||||
// RFCOMM data
|
// RFCOMM data
|
||||||
#define RFCOMM_DATA_PACKET 0x07
|
#define RFCOMM_DATA_PACKET 0x07
|
||||||
|
|
||||||
// Fixed PSM nuumbers
|
// Fixed PSM numbers
|
||||||
#define PSM_SDP 0x01
|
#define PSM_SDP 0x01
|
||||||
#define PSM_RFCOMM 0x03
|
#define PSM_RFCOMM 0x03
|
||||||
|
#define PSM_HID_CONTROL 0x11
|
||||||
|
#define PSM_HID_INTERRUPT 0x13
|
||||||
|
|
||||||
// Events from host controller to host
|
// Events from host controller to host
|
||||||
#define HCI_EVENT_INQUIRY_COMPLETE 0x01
|
#define HCI_EVENT_INQUIRY_COMPLETE 0x01
|
||||||
|
Loading…
x
Reference in New Issue
Block a user