mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-23 09:41:03 +00:00
hid_device: fix get protocol mode
This commit is contained in:
parent
8c94c0448e
commit
5139b81e65
@ -450,7 +450,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * pack
|
||||
}
|
||||
device->report_status = HID_HANDSHAKE_PARAM_TYPE_SUCCESSFUL;
|
||||
// hid_device_request_can_send_now_event(channel);
|
||||
// printf("HID_MESSAGE_TYPE_GET_PROTOCOL l2cap_request_can_send_now_event\n");
|
||||
// printf("HID_MESSAGE_TYPE_GET_PROTOCOL l2cap_request_can_send_now_event\n");
|
||||
l2cap_request_can_send_now_event(device->control_cid);
|
||||
break;
|
||||
|
||||
@ -504,7 +504,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * pack
|
||||
(*hci_device_report_data)(device->cid, device->report_type, device->report_id, packet_size - 2, &packet[2]);
|
||||
break;
|
||||
default:
|
||||
printf("HID_DEVICE_W2_SEND_UNSUPPORTED_REQUEST %d \n", message_type);
|
||||
// printf("HID_DEVICE_W2_SEND_UNSUPPORTED_REQUEST %d \n", message_type);
|
||||
device->state = HID_DEVICE_W2_SEND_UNSUPPORTED_REQUEST;
|
||||
// l2cap_request_can_send_now_event(device->control_cid);
|
||||
hid_device_request_can_send_now_event(channel);
|
||||
@ -651,9 +651,11 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * pack
|
||||
hid_device_send_control_message(device->cid, &report[0], 1);
|
||||
break;
|
||||
}
|
||||
|
||||
// printf("send HID_MESSAGE_TYPE_DATA, protocol_mode %d \n", device->protocol_mode);
|
||||
report[0] = (HID_MESSAGE_TYPE_DATA << 4) | device->protocol_mode;
|
||||
hid_device_send_control_message(device->cid, &report[0], 1);
|
||||
report[0] = (HID_MESSAGE_TYPE_DATA << 4);
|
||||
report[1] = device->protocol_mode;
|
||||
hid_device_send_control_message(device->cid, &report[0], 2);
|
||||
break;
|
||||
|
||||
|
||||
|
@ -434,48 +434,48 @@ static void stdin_process(char character){
|
||||
uint8_t modifier;
|
||||
uint8_t keycode;
|
||||
int found;
|
||||
switch (character){
|
||||
case 'D':
|
||||
printf("Disconnect from %s...\n", bd_addr_to_str(device_addr));
|
||||
hid_device_disconnect(hid_cid);
|
||||
break;
|
||||
case 'c':
|
||||
printf("Connecting %s...\n", bd_addr_to_str(device_addr));
|
||||
hid_device_connect(device_addr, &hid_cid);
|
||||
return;
|
||||
case 'I':
|
||||
printf("Disconnect from intrrupt channel %s...\n", bd_addr_to_str(device_addr));
|
||||
hid_device_disconnect_interrupt_channel(hid_cid);
|
||||
break;
|
||||
case 'C':
|
||||
printf("Disconnect from control channel %s...\n", bd_addr_to_str(device_addr));
|
||||
hid_device_disconnect_control_channel(hid_cid);
|
||||
break;
|
||||
case 'l':
|
||||
printf("set limited discoverable mode\n");
|
||||
gap_discoverable_control(1);
|
||||
// TODO move into HCI init
|
||||
hci_send_cmd(&hci_write_current_iac_lap_two_iacs, 2, GAP_IAC_GENERAL_INQUIRY, GAP_IAC_LIMITED_INQUIRY);
|
||||
return;
|
||||
case 'm':
|
||||
send_mouse_on_interrupt_channel = 1;
|
||||
hid_device_request_can_send_now_event(hid_cid);
|
||||
break;
|
||||
case 'M':
|
||||
send_keyboard_on_interrupt_channel = 1;
|
||||
hid_device_request_can_send_now_event(hid_cid);
|
||||
break;
|
||||
case 'L':
|
||||
gap_discoverable_control(0);
|
||||
printf("reset limited discoverable mode\n");
|
||||
return;
|
||||
case '\n':
|
||||
case '\r':
|
||||
break;
|
||||
default:
|
||||
// show_usage();
|
||||
break;
|
||||
}
|
||||
// switch (character){
|
||||
// case 'D':
|
||||
// printf("Disconnect from %s...\n", bd_addr_to_str(device_addr));
|
||||
// hid_device_disconnect(hid_cid);
|
||||
// break;
|
||||
// case 'c':
|
||||
// printf("Connecting %s...\n", bd_addr_to_str(device_addr));
|
||||
// hid_device_connect(device_addr, &hid_cid);
|
||||
// return;
|
||||
// case 'I':
|
||||
// printf("Disconnect from intrrupt channel %s...\n", bd_addr_to_str(device_addr));
|
||||
// hid_device_disconnect_interrupt_channel(hid_cid);
|
||||
// break;
|
||||
// case 'C':
|
||||
// printf("Disconnect from control channel %s...\n", bd_addr_to_str(device_addr));
|
||||
// hid_device_disconnect_control_channel(hid_cid);
|
||||
// break;
|
||||
// case 'l':
|
||||
// printf("set limited discoverable mode\n");
|
||||
// gap_discoverable_control(1);
|
||||
// // TODO move into HCI init
|
||||
// hci_send_cmd(&hci_write_current_iac_lap_two_iacs, 2, GAP_IAC_GENERAL_INQUIRY, GAP_IAC_LIMITED_INQUIRY);
|
||||
// return;
|
||||
// case 'm':
|
||||
// send_mouse_on_interrupt_channel = 1;
|
||||
// hid_device_request_can_send_now_event(hid_cid);
|
||||
// break;
|
||||
// case 'M':
|
||||
// send_keyboard_on_interrupt_channel = 1;
|
||||
// hid_device_request_can_send_now_event(hid_cid);
|
||||
// break;
|
||||
// case 'L':
|
||||
// gap_discoverable_control(0);
|
||||
// printf("reset limited discoverable mode\n");
|
||||
// return;
|
||||
// case '\n':
|
||||
// case '\r':
|
||||
// break;
|
||||
// default:
|
||||
// // show_usage();
|
||||
// break;
|
||||
// }
|
||||
|
||||
switch (app_state){
|
||||
case APP_BOOTING:
|
||||
@ -593,18 +593,18 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * pack
|
||||
break;
|
||||
|
||||
case HID_SUBEVENT_CAN_SEND_NOW:
|
||||
if (send_mouse_on_interrupt_channel){
|
||||
send_mouse_on_interrupt_channel = 0;
|
||||
printf("send mouse on interrupt channel\n");
|
||||
send_mouse_report_on_interrupt_channel(0,0,0);
|
||||
break;
|
||||
}
|
||||
if (send_keyboard_on_interrupt_channel){
|
||||
send_keyboard_on_interrupt_channel = 0;
|
||||
send_keyboard_report_on_interrupt_channel(send_modifier, send_keycode);
|
||||
send_keycode = 0;
|
||||
send_modifier = 0;
|
||||
}
|
||||
// if (send_mouse_on_interrupt_channel){
|
||||
// send_mouse_on_interrupt_channel = 0;
|
||||
// printf("send mouse on interrupt channel\n");
|
||||
// send_mouse_report_on_interrupt_channel(0,0,0);
|
||||
// break;
|
||||
// }
|
||||
// if (send_keyboard_on_interrupt_channel){
|
||||
// send_keyboard_on_interrupt_channel = 0;
|
||||
// send_keyboard_report_on_interrupt_channel(send_modifier, send_keycode);
|
||||
// send_keycode = 0;
|
||||
// send_modifier = 0;
|
||||
// }
|
||||
|
||||
if (send_keycode){
|
||||
send_keyboard_report_on_interrupt_channel(send_modifier, send_keycode);
|
||||
|
Loading…
x
Reference in New Issue
Block a user