alpakka: test classic hid

This commit is contained in:
Matthias Ringwald 2023-09-28 10:14:20 +02:00
parent 8c35a1166e
commit 5045b73fdb
2 changed files with 12 additions and 14 deletions

View File

@ -59,7 +59,7 @@
// MBP 2016 static const char * remote_addr_string = "F4-0F-24-3B-1B-E1";
// iMpulse static const char * remote_addr_string = "64:6E:6C:C1:AA:B5";
// Logitec
static const char * remote_addr_string = "00:1F:20:86:DF:52";
static const char * remote_addr_string = "00:1A:7D:DA:71:04";
static bd_addr_t remote_addr;
@ -334,6 +334,8 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
} else {
printf("Cannot handle input report, HID Descriptor is not available, status 0x%02x\n", status);
}
gap_discoverable_control(0);
gap_connectable_control(0);
break;
case HID_SUBEVENT_REPORT:

View File

@ -363,6 +363,11 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * pack
printf("HID Connected, sending demo text...\n");
demo_text_timer_handler(NULL);
#endif
hid_device_request_can_send_now_event(hid_cid);
gap_discoverable_control(0);
gap_connectable_control(0);
break;
case HID_SUBEVENT_CONNECTION_CLOSED:
btstack_run_loop_remove_timer(&send_timer);
@ -371,19 +376,10 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * pack
hid_cid = 0;
break;
case HID_SUBEVENT_CAN_SEND_NOW:
if (send_keycode){
send_report(send_modifier, send_keycode);
// schedule key up
send_keycode = 0;
send_modifier = 0;
btstack_run_loop_set_timer_handler(&send_timer, trigger_key_up);
btstack_run_loop_set_timer(&send_timer, TYPING_KEYDOWN_MS);
} else {
send_report(0, 0);
// schedule next key down
btstack_run_loop_set_timer_handler(&send_timer, send_next);
btstack_run_loop_set_timer(&send_timer, TYPING_DELAY_MS);
}
send_report(send_modifier, send_keycode++);
btstack_run_loop_set_timer_handler(&send_timer, trigger_key_up);
btstack_run_loop_set_timer(&send_timer, 5);
btstack_run_loop_add_timer(&send_timer);
break;
default: