diff --git a/test/pts/Makefile b/test/pts/Makefile index 42dfa001f..912d55747 100644 --- a/test/pts/Makefile +++ b/test/pts/Makefile @@ -148,7 +148,7 @@ SRC_BLE_GATT_SERVICE_FILES_OBJ = ${SRC_BLE_GATT_SERVICE_FILES:.c=.o} EXAMPLES = iopt ble_peripheral_test ble_central_test l2cap_test classic_test bnep_test hsp_ag_test hsp_hs_test sco_loopback le_data_channel EXAMPLES += avdtp_source_test avdtp_sink_test avrcp_test gatt_profiles hrp_col_test hrp_server_test -# EXAMPLES += hog_demo_test hid_device_test hid_host_test +EXAMPLES += hog_demo_test hid_device_test hid_host_test EXAMPLES += csc_server_test csc_client_test cycling_power_server_test all: ${EXAMPLES} diff --git a/test/pts/hid_device.md b/test/pts/hid_device.md new file mode 100644 index 000000000..c1cb51c72 --- /dev/null +++ b/test/pts/hid_device.md @@ -0,0 +1,36 @@ +use hid_device_test with #define REPORT_ID_DECLARED: + +HID11/DEV/DCE/BV-10-I: l, (OK), L, (OK) + +HID11/DEV/DRE/BV-09-I: + +HID11/DEV/DCR/BV-01-I: (wait), c, M, M +HID11/DEV/DCR/BV-02-I: I, C, c, M, I, C, (wait), M + +HID11/DEV/DCT/BV-01-C: (wait) +HID11/DEV/DCT/BV-02-C: (wait) +HID11/DEV/DCT/BV-03-C: (wait) +HID11/DEV/DCT/BV-04-C: (wait) +HID11/DEV/DCT/BV-08-C: (wait) +HID11/DEV/DCT/BV-09-C: m? +HID11/DEV/DCT/BI-01-C: (wait) +HID11/DEV/DCT/BI-03-C: (wait) +HID11/DEV/DCT/BI-04-C: (wait) + +HID11/DEV/BDCT/BV-01-C: (wait) +HID11/DEV/BDCT/BV-02-C: (wait) +HID11/DEV/BDCT/BV-03-C: (wait) +HID11/DEV/BDCT/BI-01-C: (wait) + +HID11/DEV/DIT/BV-01-C: M +HID11/DEV/DIT/BV-02-C: (OK) +HID11/DEV/DIT/BI-01-C: (OK)x3 + +HID11/DEV/BDIT/BV-01-C: m, M +HID11/DEV/BDIT/BV-02-C: (OK)x2 +HID11/DEV/BDIT/BI-01-C: (OK)x2 + +HID11/DEV/SDD/BV-01-C: (wait) +HID11/DEV/SDD/BV-02-C: (wait) +HID11/DEV/SDD/BV-03-C: (wait) +HID11/DEV/SDD/BV-04-C: (long wait) \ No newline at end of file diff --git a/test/pts/hid_device_test.c b/test/pts/hid_device_test.c index edbffda4b..c3889dccc 100644 --- a/test/pts/hid_device_test.c +++ b/test/pts/hid_device_test.c @@ -61,7 +61,7 @@ #include "btstack_stdin.h" #endif -// #define REPORT_ID_DECLARED +#define REPORT_ID_DECLARED // to enable demo text on POSIX systems // #undef HAVE_BTSTACK_STDIN @@ -127,49 +127,6 @@ const uint8_t hid_descriptor_keyboard_boot_mode[] = { #define CHAR_TAB '\t' #define CHAR_BACKSPACE 0x7f -// Simplified US Keyboard with Shift modifier - -/** - * English (US) - */ -static const uint8_t keytable_us_none [] = { - CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, /* 0-3 */ - 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', /* 4-13 */ - 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', /* 14-23 */ - 'u', 'v', 'w', 'x', 'y', 'z', /* 24-29 */ - '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', /* 30-39 */ - CHAR_RETURN, CHAR_ESCAPE, CHAR_BACKSPACE, CHAR_TAB, ' ', /* 40-44 */ - '-', '=', '[', ']', '\\', CHAR_ILLEGAL, ';', '\'', 0x60, ',', /* 45-54 */ - '.', '/', CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, /* 55-60 */ - CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, /* 61-64 */ - CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, /* 65-68 */ - CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, /* 69-72 */ - CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, /* 73-76 */ - CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, /* 77-80 */ - CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, /* 81-84 */ - '*', '-', '+', '\n', '1', '2', '3', '4', '5', /* 85-97 */ - '6', '7', '8', '9', '0', '.', 0xa7, /* 97-100 */ -}; - -static const uint8_t keytable_us_shift[] = { - CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, /* 0-3 */ - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', /* 4-13 */ - 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', /* 14-23 */ - 'U', 'V', 'W', 'X', 'Y', 'Z', /* 24-29 */ - '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', /* 30-39 */ - CHAR_RETURN, CHAR_ESCAPE, CHAR_BACKSPACE, CHAR_TAB, ' ', /* 40-44 */ - '_', '+', '{', '}', '|', CHAR_ILLEGAL, ':', '"', 0x7E, '<', /* 45-54 */ - '>', '?', CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, /* 55-60 */ - CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, /* 61-64 */ - CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, /* 65-68 */ - CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, /* 69-72 */ - CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, /* 73-76 */ - CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, /* 77-80 */ - CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, CHAR_ILLEGAL, /* 81-84 */ - '*', '-', '+', '\n', '1', '2', '3', '4', '5', /* 85-97 */ - '6', '7', '8', '9', '0', '.', 0xb1, /* 97-100 */ -}; - // STATE static uint8_t hid_service_buffer[250]; @@ -185,7 +142,7 @@ static int send_mouse_on_interrupt_channel = 0; static int send_keyboard_on_interrupt_channel = 0; #ifdef HAVE_BTSTACK_STDIN -static const char * device_addr_string = "BC:EC:5D:E6:15:03"; +static const char * device_addr_string = "00:1B:DC:08:E2:5C"; #endif static enum { @@ -199,52 +156,24 @@ static enum { // static uint8_t keycode = 0; // static uint8_t report[] = { /* 0xa1, */ modifier, 0, 0, keycode, 0, 0, 0, 0, 0}; -// HID Keyboard lookup -static int lookup_keycode(uint8_t character, const uint8_t * table, int size, uint8_t * keycode){ - int i; - for (i=0;i