From 196cbe25975fa9b55250b8c60dea147c1ce52d97 Mon Sep 17 00:00:00 2001 From: Milanka Ringwald Date: Wed, 7 Apr 2021 10:20:24 +0200 Subject: [PATCH] hid_host: add new tests --- test/pts/hid_host.md | 14 ++++++++++++++ test/pts/hid_host_test.c | 13 +++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/test/pts/hid_host.md b/test/pts/hid_host.md index dd0a2d174..6541e8d6d 100644 --- a/test/pts/hid_host.md +++ b/test/pts/hid_host.md @@ -1,8 +1,18 @@ Tool: hid_host_test with #define REPORT_ID_DECLARED +HID11/HOS/HCE/BV-01-I: c +HID11/HOS/HCE/BV-02-I: c +HID11/HOS/HCE/BV-05-I: c HID11/HOS/HCE/BV-08-I: OK, c, (Confirmation) +HID11/HOS/HRE/BV-01-I: rm /tmp/btstack*.tlv, c, CTRL+c, wait +HID11/HOS/HRE/BV-02-I: rm /tmp/btstack*.tlv, c, CTRL+c, c, c +HID11/HOS/HRE/BV-05-I: rm /tmp/btstack*.tlv, c, CTRL+c, "OK", "OK" +HID11/HOS/HRE/BV-06-I: rm /tmp/btstack*.tlv, c, CTRL+c, c, c HID11/HOS/HRE/BV-09-I: c, s, S +HID11/DEV/DCE/BV-10-I: l, (OK), L, (OK) +HID11/HOS/HRE/BI-01-I: rm /tmp/btstack*.tlv, c +HID11/HOS/HRE/BI-02-I: rm /tmp/btstack*.tlv, c, c HID11/HOS/HCR/BV-01-I: c, C, c, (Confirmation), C, (Confirmation) HID11/HOS/HCR/BV-02-I: c, c, (Confirmation), (Confirmation) @@ -20,6 +30,8 @@ HID11/HOS/HCT/BV-08-C: c, s, S HID11/HOS/HCT/BI-01-C: c, (wait) HID11/HOS/HCT/BI-02-C: c, 1, (Confirmation), 3, (Confirmation), 3, (Confirmation) +HID11/HOS/BHCT/BV-02-C: a, 3 +HID11/HOS/BHCT/BV-03-C: a, 7 HID11/HOS/BHCT/BV-03-C: a, o // PTS test fails HID11/HOS/BHCT/BI-01-C: a, 3, (Confirmation) , 3, (Confirmation), 3, (Confirmation) @@ -34,3 +46,5 @@ HID11/HOS/BHIT/BV-02-C: a, o (ID 1, size 9) Channel ID: 0x0040 Length: 0x000A (10) [ 52 01 00 00 00 00 00 00 00 00 ] HID11/HOS/BHIT/BI-01-C: a + +HID11/HOS/CDD/BV-01-I: c, C, c, CRTL+c \ No newline at end of file diff --git a/test/pts/hid_host_test.c b/test/pts/hid_host_test.c index ef3dc2b20..4165023eb 100644 --- a/test/pts/hid_host_test.c +++ b/test/pts/hid_host_test.c @@ -110,6 +110,7 @@ static enum { static bool unplugged = false; static uint16_t hid_host_cid = 0; +static hci_con_handle_t hid_host_con_handle = HCI_CON_HANDLE_INVALID; static bool hid_host_descriptor_available = false; static hid_protocol_mode_t hid_host_protocol_mode = HID_PROTOCOL_MODE_REPORT_WITH_FALLBACK_TO_BOOT; @@ -282,6 +283,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack return; } app_state = APP_CONNECTED; + hid_host_con_handle = hid_subevent_connection_opened_get_con_handle(packet); hid_host_cid = hid_subevent_connection_opened_get_hid_cid(packet); printf("HID Host connected...\n"); break; @@ -298,6 +300,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack case HID_SUBEVENT_CONNECTION_CLOSED: hid_host_cid = 0; + hid_host_con_handle = HCI_CON_HANDLE_INVALID; printf("HID Host disconnected..\n"); break; @@ -406,6 +409,8 @@ static void show_usage(void){ printf("r - Set protocol in REPORT mode\n"); printf("b - Set protocol in BOOT mode\n"); + printf("\n"); + printf("z - set link supervision timeout to 0\n"); printf("Ctrl-c - exit\n"); printf("---\n"); } @@ -506,8 +511,8 @@ static void stdin_process(char cmd){ case '7':{ uint8_t report[] = {0, 0, 0, 0, 0, 0, 0, 0}; - printf("Set output report with id 0x01\n"); - status = hid_host_send_set_report(hid_host_cid, HID_REPORT_TYPE_OUTPUT, 0x01, report, sizeof(report)); + printf("Set input report with id 0x01\n"); + status = hid_host_send_set_report(hid_host_cid, HID_REPORT_TYPE_INPUT, 0x01, report, sizeof(report)); break; } @@ -525,6 +530,10 @@ static void stdin_process(char cmd){ break; } + case 'z': + printf("Set link supervision timeout to 0 \n"); + hci_send_cmd(&hci_write_link_supervision_timeout, hid_host_con_handle, 0); + break; case '\n': case '\r': break;