From 663027751831eb0e80d64c90aaf82d2921533aed Mon Sep 17 00:00:00 2001 From: tmk Date: Fri, 19 Apr 2013 23:43:52 +0900 Subject: [PATCH] Add support of mouse horizontal wheel to iWRAP --- protocol/iwrap/iWRAP5.txt | 139 ++++++++++++++++++++------------------ protocol/iwrap/iwrap.c | 21 +++--- protocol/iwrap/mouse.desc | 41 ++++++++++- 3 files changed, 121 insertions(+), 80 deletions(-) diff --git a/protocol/iwrap/iWRAP5.txt b/protocol/iwrap/iWRAP5.txt index e5ecc5c8ea..65bbe0421b 100644 --- a/protocol/iwrap/iWRAP5.txt +++ b/protocol/iwrap/iWRAP5.txt @@ -204,64 +204,73 @@ CALL 78:dd:08:b7:e4:a2 11 HID Setting ======== +Following settings need to be done before wiring into keyboard. +- UART speed: 38400bps(115200bps didn't work with software serial) +- No SSP procedure(without MITM protection) +- No Power Saving + +# clear pairing record and set default SET BT PAIR * SET RESET +SET CONTROL INIT SET CONTROL MUX 0 +SET CONTROL BAUD 38400,8n1 +SET BT NAME TMK Blootooth WT12 SET BT CLASS 0005c0 SET BT AUTH * 0000 -SET BT SSP 2 0 -SET CONTROL CONFIG 800 -SET PROFILE HID 0f c0 0100 00 en 0409 Bluetooth keyboard +SET BT SSP 3 0 +SET CONTROL CONFIG 4800 +SET PROFILE HID 0f c0 0100 00 en 0409 TMK Bluetooth keyboard(WT12) SET PROFILE SPP -SET CONTROL INIT SET CONTROL MUX 0 -SET BT NAME TMK Blootooth WT12 -SET PROFILE HID 0f c0 0100 00 en 0409 TMK Bluetooth keyboard(WT12) -SDP ADD 1124 HID -SET BT PAIRCOUNT 4 -SET BT POWER 3 3 3 +# power saving? SET BT SNIFF 100 20 1 8 -RESET - -SET CONTROL BAUD 38400,8n1 - -# combo keyboard + mouse -HID SET 7f 05010906a1010507850119e029e715002501750195088102950175088101950575010508850119012905910295017503910395067508150025650507190029658100c005010902a1010901a1008502050919012903150025019503750181020501093815f1250f9501750581060501093009311581257f750895028106c0c0 - -HID SET d1 05010906a1010507850119e029e715002501750195088102950175088101950575010508850119012905910295017503910395067508150025650507190029658100c005010902a1010901a1008502050919012903150025019503750181020501093815f1250f9501750581060501093009311581257f750895028106c0c0050c0901a1018503050c1500250109e909ea09e209cd19b529b87501950881020a8a010a21020a2a021a23022a27027501950881020a83010a96010a92010a9e010a94010a060209b209b4750195088102c0 ---------------------- +# Report Descriptor +# combo keyboard + mouse + consumer +HID SET d2 05010906a1010507850119e029e715002501750195088102950175088101950575010508850119012905910295017503910395067508150025650507190029658100c005010902a1010901a1008502050919012908150025017501950881020501093009311581257f750895028106093895018106050c0a380295018106c0c0050c0901a1018503050c1500250109e909ea09e209cd19b529b87501950881020a8a010a21020a2a021a23022a27027501950881020a83010a96010a92010a9e010a94010a060209b209b4750195088102c0 + + + + + + +---------- +after setting +---------- +set SET BT BDADDR 00:07:80:47:22:14 -SET BT NAME TMK BT WT12 +SET BT NAME TMK Blootooth WT12 SET BT CLASS 0005c0 SET BT AUTH * 0000 SET BT IDENT BT:47 f000 5.0.1 Bluegiga iWRAP SET BT LAP 9e8b33 SET BT PAGEMODE 4 2000 1 -SET BT PAIRCOUNT 4 -SET BT PAIR 78:dd:08:b7:e4:a2 fe2fd79e86c6bbfa9351a032bceb2648 +SET BT PAIR 78:dd:08:b7:e4:a2 9e3d85c91bcae73fef8cc10bec18b42f SET BT POWER 3 3 3 -SET BT ROLE 1 f 12c0 -SET BT SNIFF 100 20 1 8 +SET BT ROLE 0 f 7d00 +SET BT SNIFF 0 20 1 8 SET BT SSP 3 0 -SET BT MTU 672 +SET BT MTU 667 SET CONTROL BAUD 38400,8n1 SET CONTROL CD 00 0 SET CONTROL ECHO 7 -SET CONTROL ESCAPE - 20 1 +SET CONTROL ESCAPE 43 00 1 SET CONTROL GAIN 0 5 SET CONTROL INIT SET CONTROL MUX 0 SET CONTROL MSC DTE 00 00 00 00 00 00 +SET CONTROL MUX 1 SET CONTROL PIO 00 00 SET CONTROL READY 00 -SET PROFILE HID 0f c0 0100 00 en 0409 TMK Bluetooth keyboard +SET PROFILE HID 0f c0 0100 00 en 0409 TMK Bluetooth keyboard(WT12) SET -SET control config list -SET CONTROL CONFIG 0000 0000 0000 410e CLOCK_CACHE INTERLACED_INQ INTERLACED_PAGE KLUDGE UART_LATENCY - + +set control config list +SET CONTROL CONFIG 0000 0000 0000 4900 KLUDGE INTERACTIVE_PIN UART_LATENCY +info config WRAP THOR AI (5.0.1 build 620) Copyright (c) 2003-2012 Bluegiga Technologies Inc. Compiled on Oct 1 2012 10:56:21, running on WT12-A module, psr v31 @@ -269,42 +278,59 @@ Compiled on Oct 1 2012 10:56:21, running on WT12-A module, psr v31 - BOCK4 version 620 (Oct 1 2012 10:56:03) (max acl/sco 7/1) - Bluetooth version 3.0, Power class 2 - Loader 8615, firmware 8825 (56-bit encryption), native execution mode - - up 0 days, 00:13, 0 connections (pool 1) + - up 0 days, 01:50, 2 connections (pool 2) - User configuration: -&028b = 0000 1388 -&028c = 0001 0020 0100 0001 0008 0000 -&028d = 0000 +&028d = 0001 &0295 = 0000 0005 000b 0000 0003 0000 0000 0000 0000 0000 0000 -&0298 = c006 +&0298 = c053 &0299 = 0000 0000 &02a3 = 0030 0030 0030 0030 &02a4 = 009d 0000 &02a5 = 0053 0045 0054 0020 0043 004f 004e 0054 0052 004f 004c 0020 004d 0055 0058 0020 0030 &02a7 = 0000 05c0 -&02a8 = 400e 0000 0000 +&02a8 = 0800 0000 0000 0000 &02aa = 0004 2000 0001 0033 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 -&02ab = 0001 000f 12c0 -&02ac = 0000 0020 002b 0000 0000 0000 0000 0000 0000 0000 000a 0000 0000 0000 0004 0000 0000 0000 0000 02a0 0000 0000 0000 0000 -&02ad = 4d54 204b 5442 5720 3154 0032 +&02ac = 0000 0000 002b 0000 0000 0000 0000 0000 0000 0000 0002 0000 0000 0000 0010 0000 0000 0000 0000 029b 0000 0000 0000 0000 +&02ad = 4d54 204b 6c42 6f6f 6f74 746f 2068 5457 3231 &02b0 = fa65 b0aa 934a 077b a600 d1cc fe58 8dd5 -&02b3 = 0004 0004 0004 0000 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 000d 0007 0005 8afb 0005 0000 1c13 0000 0c3d 0005 b435 0006 b450 0006 0000 1416 000d -&02b7 = 000f 00c0 0100 0000 0065 006e 0409 4d54 204b 6c42 6575 6f74 746f 2068 656b 6279 616f 6472 0000 ---------------------- +&02b3 = 0004 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0003 0005 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0005 +&02b7 = 000f 00c0 0100 0000 0065 006e 0409 4d54 204b 6c42 6575 6f74 746f &02bb = 8000 +READY. +---------- ----------- -after SET RESET ----------- + +----- +After 5.0.1 Firmware update +Firmware: ai-5.0.1-620-25b.bc4.dfu +PSR: wt12-a.ai-5.0.1-620-25b.psrf +----- +info config WRAP THOR AI (5.0.1 build 620) Copyright (c) 2003-2012 Bluegiga Technologies Inc. +Compiled on Oct 1 2012 10:56:21, running on WT12-A module, psr v31 + BGIO FTP HFP HFP_AG HID HID_CONSUMER_PAGE HSP MAP MDP OTA PBAP PIO=0x00fc SSP SUBRATE TEST VOLUME + - BOCK4 version 620 (Oct 1 2012 10:56:03) (max acl/sco 7/1) + - Bluetooth version 3.0, Power class 2 + - Loader 8615, firmware 8825 (56-bit encryption), native execution mode + - up 0 days, 00:03, 0 connections (pool 1) + - User configuration: +&0295 = 0000 0005 000b 0000 0003 0000 0000 0000 0000 0000 0000 +&0299 = 0000 0000 +&02aa = 0004 2000 0001 0033 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 +&02ac = 0000 0000 002b 0000 0000 0000 0000 0000 0000 0000 0002 0000 0000 0000 0010 0000 0000 0000 0000 029b 0000 0000 0000 0000 +&02ad = 5457 3231 412d +&02b0 = fa65 b0aa 934a 077b a600 d1cc fe58 8dd5 READY. + set SET BT BDADDR 00:07:80:47:22:14 -SET BT NAME WT12 +SET BT NAME WT12-A SET BT CLASS 001f00 SET BT IDENT BT:47 f000 5.0.1 Bluegiga iWRAP SET BT LAP 9e8b33 SET BT PAGEMODE 4 2000 1 +SET BT PAIR 78:dd:08:b7:e4:a2 af18f81faa107e6dd068762ef921f48b SET BT POWER 3 3 3 SET BT ROLE 0 f 7d00 SET BT SNIFF 0 20 1 8 @@ -321,25 +347,6 @@ SET CONTROL READY 00 SET PROFILE SPP Bluetooth Serial Port SET - +set control config list SET CONTROL CONFIG 0000 0000 0000 0100 KLUDGE - - -info config -WRAP THOR AI (5.0.1 build 620) -Copyright (c) 2003-2012 Bluegiga Technologies Inc. -Compiled on Oct 1 2012 10:56:21, running on WT12-A module, psr v31 - BGIO FTP HFP HFP_AG HID HID_CONSUMER_PAGE HSP MAP MDP OTA PBAP PIO=0x00fc SSP SUBRATE TEST VOLUME - - BOCK4 version 620 (Oct 1 2012 10:56:03) (max acl/sco 7/1) - - Bluetooth version 3.0, Power class 2 - - Loader 8615, firmware 8825 (56-bit encryption), native execution mode - - up 0 days, 00:00, 0 connections (pool 1) - - User configuration: -&0295 = 0000 0005 000b 0000 0003 0000 0000 0000 0000 0000 0000 -&0299 = 0000 0000 -&02aa = 0004 2000 0001 0033 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 -&02ac = 0000 0000 002b 0000 0000 0000 0000 0000 0000 0000 0002 0000 0000 0000 0010 0000 0000 0000 0000 029b 0000 0000 0000 0000 -&02ad = 5457 3231 -&02b0 = fa65 b0aa 934a 077b a600 d1cc fe58 8dd5 -READY. ----------- +--------- diff --git a/protocol/iwrap/iwrap.c b/protocol/iwrap/iwrap.c index d65d9e38ef..6a404116a1 100644 --- a/protocol/iwrap/iwrap.c +++ b/protocol/iwrap/iwrap.c @@ -335,7 +335,7 @@ static void send_keyboard(report_keyboard_t *report) xmit(0x9f); xmit(0x0a); // Length xmit(0xa1); // DATA(Input) - xmit(0x01); + xmit(0x01); // Report ID xmit(report->mods); xmit(0x00); // reserved byte(always 0) xmit(report->keys[0]); @@ -351,22 +351,17 @@ static void send_mouse(report_mouse_t *report) { #if defined(MOUSEKEY_ENABLE) || defined(PS2_MOUSE_ENABLE) if (!iwrap_connected() && !iwrap_check_connection()) return; - MUX_HEADER(0x01, 0x07); + MUX_HEADER(0x01, 0x09); // HID raw mode header xmit(0x9f); - xmit(0x05); // Length + xmit(0x07); // Length xmit(0xa1); // DATA(Input) - xmit(0x02); - /* vertical wheel support */ - int8_t wheel = report->v; - if (wheel < -15) { - wheel = -15; - } else if (wheel > 15) { - wheel = 15; - } - xmit(((wheel&0x1f)<<3) | (report->buttons&0x07)); + xmit(0x02); // Report ID + xmit(report->buttons); xmit(report->x); xmit(report->y); + xmit(report->v); + xmit(report->h); MUX_FOOTER(0x01); #endif } @@ -465,7 +460,7 @@ static void send_consumer(uint16_t data) xmit(0x9f); xmit(0x05); // Length xmit(0xa1); // DATA(Input) - xmit(0x03); + xmit(0x03); // Report ID xmit(bits1); xmit(bits2); xmit(bits3); diff --git a/protocol/iwrap/mouse.desc b/protocol/iwrap/mouse.desc index f2c4325009..11898f2b1c 100644 --- a/protocol/iwrap/mouse.desc +++ b/protocol/iwrap/mouse.desc @@ -1 +1,40 @@ -05010902a1010901a1008502050919012903150025019503750181020501093815f1250f9501750581060501093009311581257f750895028106c0c0 +05010902a1010901a1008502050919012908150025017501950881020501093009311581257f750895028106093895018106050c0a380295018106c0c0 + +Length: 67(0x43) +virtical/horizontal wheel support + + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x02, // USAGE (Mouse) + 0xa1, 0x01, // COLLECTION (Application) + 0x09, 0x01, // USAGE (Pointer) + 0xa1, 0x00, // COLLECTION (Physical) + 0x85, 0x02, // REPORT_ID (2) + // ---------------------------- Buttons + 0x05, 0x09, // USAGE_PAGE (Button) + 0x19, 0x01, // USAGE_MINIMUM (Button 1) + 0x29, 0x08, // USAGE_MAXIMUM (Button 8) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0x01, // LOGICAL_MAXIMUM (1) + 0x75, 0x01, // REPORT_SIZE (1) + 0x95, 0x08, // REPORT_COUNT (8) + 0x81, 0x02, // INPUT (Data,Var,Abs) + // ---------------------------- X,Y position + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x30, // USAGE (X) + 0x09, 0x31, // USAGE (Y) + 0x15, 0x81, // LOGICAL_MINIMUM (-127) + 0x25, 0x7f, // LOGICAL_MAXIMUM (127) + 0x75, 0x08, // REPORT_SIZE (8) + 0x95, 0x02, // REPORT_COUNT (2) + 0x81, 0x06, // INPUT (Data,Var,Rel) + // ---------------------------- Vertical wheel + 0x09, 0x38, // USAGE (Wheel) + 0x95, 0x01, // REPORT_COUNT (1) + 0x81, 0x06, // INPUT (Data,Var,Rel) + // ---------------------------- Horizontal wheel + 0x05, 0x0c, // USAGE_PAGE (Consumer Devices) + 0x0a, 0x38, 0x02, // USAGE (AC Pan) + 0x95, 0x01, // REPORT_COUNT (1) + 0x81, 0x06, // INPUT (Data,Var,Rel) + 0xc0, // END_COLLECTION + 0xc0, // END_COLLECTION