From 452ea9ec91cc1ba4a30e6d55eb25f0f98b3c0676 Mon Sep 17 00:00:00 2001 From: Elteeb <1544408+Elteeb96@users.noreply.github.com> Date: Sun, 30 Jan 2022 19:33:45 -0600 Subject: [PATCH] =?UTF-8?q?Added=20rudimentary=20Z20=20support,=20added=20?= =?UTF-8?q?icons=20for=20macro=20keys=20and=20=E2=80=98feature=20buttons?= =?UTF-8?q?=E2=80=99.=20I.E.=20The=20=E2=80=98game=20mode=E2=80=99=20butto?= =?UTF-8?q?n=20on=20the=20Z20.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 9d73df25fdc896a0363b2fe0e43aca13dd8663b6) --- .../EVGAKeyboardController.cpp | 8 ++- .../EVGAKeyboardController.h | 5 +- .../EVGAUSBControllerDetect.cpp | 2 + .../RGBController_EVGAKeyboard.cpp | 63 +++++++++++++++++++ 4 files changed, 76 insertions(+), 2 deletions(-) diff --git a/Controllers/EVGAUSBController/EVGAKeyboardController.cpp b/Controllers/EVGAUSBController/EVGAKeyboardController.cpp index d071f63bd..243841cf9 100644 --- a/Controllers/EVGAUSBController/EVGAKeyboardController.cpp +++ b/Controllers/EVGAUSBController/EVGAKeyboardController.cpp @@ -9,7 +9,7 @@ #include "EVGAKeyboardController.h" -static uint8_t packet_map[EVGA_KEYBOARD_FULL_SIZE_KEYCOUNT] = +static uint8_t packet_map[EVGA_KEYBOARD_FULL_SIZE_KEYCOUNT + EVGA_KEYBOARD_Z20_EXTRA] = { /*00 ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 */ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, @@ -43,6 +43,12 @@ static uint8_t packet_map[EVGA_KEYBOARD_FULL_SIZE_KEYCOUNT] = /*100 NM8 NM9 NM0 NM. PRV PLY NXT MTE */ 62, 63, 114, 115, 18, 19, 20, 118 + /*Macros+ GM M1 M2 M3 M4 M5 */ + , 0, 21, 43, 65, 82, 102, + /*Left Lights L1 L2 L3 L4 L5 L6 L7 L8 L9 */ + 160, 161, 162, 163, 164, 165, 166, 167, 168, + /*Right Lights R1 R2 R3 R4 R5 R6 R7 R8 R9 */ + 176, 177, 178, 179, 180, 181, 182, 183, 184 }; EVGAKeyboardController::EVGAKeyboardController(hid_device* dev_handle, const char* path) diff --git a/Controllers/EVGAUSBController/EVGAKeyboardController.h b/Controllers/EVGAUSBController/EVGAKeyboardController.h index 77708157e..b61e2db8e 100644 --- a/Controllers/EVGAUSBController/EVGAKeyboardController.h +++ b/Controllers/EVGAUSBController/EVGAKeyboardController.h @@ -21,12 +21,15 @@ #define EVGA_KEYBOARD_CONTROLLER_ID_4_SIZE 17 #define EVGA_KEYBOARD_CONTROLLER_ID_6_SIZE 792 #define EVGA_KEYBOARD_CONTROLLER_ID_7_SIZE 136 +#define EVGA_KEYBOARD_CONTROLLER_ID_Z20_4_SIZE 35 +#define EVGA_KEYBOARD_CONTROLLER_ID_Z20_6_SIZE 828 +#define EVGA_KEYBOARD_CONTROLLER_ID_Z20_7_SIZE 187 #define EVGA_KEYBOARD_CONTROLLER_INTERRUPT_TIMEOUT 250 #define EVGA_KEYBOARD_CONTROLLER_BRIGHTNESS_MIN 0 #define EVGA_KEYBOARD_CONTROLLER_BRIGHTNESS_MAX 255 #define EVGA_KEYBOARD_FULL_SIZE_KEYCOUNT 108 - +#define EVGA_KEYBOARD_Z20_EXTRA 24 static const uint8_t direction_map[8][4] = { diff --git a/Controllers/EVGAUSBController/EVGAUSBControllerDetect.cpp b/Controllers/EVGAUSBController/EVGAUSBControllerDetect.cpp index c71b7a6e9..5193365ff 100644 --- a/Controllers/EVGAUSBController/EVGAUSBControllerDetect.cpp +++ b/Controllers/EVGAUSBController/EVGAUSBControllerDetect.cpp @@ -14,6 +14,7 @@ \*-----------------------------------------------------*/ #define Z15_ISO_PID 0x260E #define Z15_ANSI_PID 0x2608 +#define Z20_ANSI_PID 0x260A void DetectEVGAKeyboardControllers(hid_device_info* info, const std::string& name) { @@ -33,3 +34,4 @@ void DetectEVGAKeyboardControllers(hid_device_info* info, const std::string& nam REGISTER_HID_DETECTOR_IPU("EVGA Z15 Keyboard", DetectEVGAKeyboardControllers, EVGA_USB_VID, Z15_ISO_PID, 1, 0x08, 0x4B); REGISTER_HID_DETECTOR_IPU("EVGA Z15 Keyboard", DetectEVGAKeyboardControllers, EVGA_USB_VID, Z15_ANSI_PID, 1, 0x08, 0x4B); +REGISTER_HID_DETECTOR_IPU("EVGA Z20 Keyboard", DetectEVGAKeyboardControllers, EVGA_USB_VID, Z20_ANSI_PID, 1, 0x08, 0x4B); diff --git a/Controllers/EVGAUSBController/RGBController_EVGAKeyboard.cpp b/Controllers/EVGAUSBController/RGBController_EVGAKeyboard.cpp index 35cf69ca2..338e9e72a 100644 --- a/Controllers/EVGAUSBController/RGBController_EVGAKeyboard.cpp +++ b/Controllers/EVGAUSBController/RGBController_EVGAKeyboard.cpp @@ -22,6 +22,21 @@ static unsigned int full_matrix_map[6][21] = { 76, 77, 78, NA, NA, NA, 79, NA, NA, NA, 80, 81, 82, 83, 84, 85, 86, 102, NA, 103, NA} }; +static unsigned int Z20_right_side_matrix[1][9] = +{ + { 116, 118, 120, 122, 124, 126, 128, 130, 132} +}; + +static unsigned int Z20_left_side_matrix[1][9] = +{ + { 115, 117, 119, 121, 123, 125, 127, 129, 131} +}; + +static unsigned int Z20_macro_matrix[1][6] = +{ + {109, 110, 111, 112, 113, 114} +}; + static const char *led_names[] = { KEY_EN_ESCAPE, // 00 @@ -139,6 +154,14 @@ static const char *led_names[] = KEY_EN_MEDIA_PLAY_PAUSE, KEY_EN_MEDIA_NEXT, KEY_EN_MEDIA_MUTE, +}, +{ + "Key: Feature Button", "Key: Macro 1", "Key: Macro 2", "Key: Macro 3", "Key: Macro 4", "Key: Macro 5" +}, +{ +"Key: Number Pad 1", "Key: Number Pad 2", "Key: Number Pad 3", "Key: Number Pad 4", "Key: Number Pad 5", "Key: Number Pad 6", "Key: Number Pad 7", "Key: Number Pad 8", "Key: Number Pad 9"}, +{ +"Key: Number Pad 1", "Key: Number Pad 2", "Key: Number Pad 3", "Key: Number Pad 4", "Key: Number Pad 5", "Key: Number Pad 6", "Key: Number Pad 7", "Key: Number Pad 8", "Key: Number Pad 9"}, }; RGBController_EVGAKeyboard::RGBController_EVGAKeyboard(EVGAKeyboardController* controller_ptr) @@ -355,7 +378,47 @@ void RGBController_EVGAKeyboard::SetupZones() KB_zone.matrix_map->width = 21; KB_zone.matrix_map->map = (unsigned int *)&full_matrix_map; zones.push_back(KB_zone); + if(controller->GetDeviceName() == "EVGA Corporation EVGA Z20 Elite Gaming Keyboard"){ + zone KB_right_sidelights; + KB_right_sidelights.name = "Right Side Lights"; + KB_right_sidelights.type = 1; + KB_right_sidelights.leds_min = 9; + KB_right_sidelights.leds_max = 9; + KB_right_sidelights.leds_count = 9; + KB_right_sidelights.matrix_map = new matrix_map_type; + zone KB_left_sidelights; + KB_left_sidelights.name = "Left Side Lights"; + KB_left_sidelights.type = 1; + KB_left_sidelights.leds_min = 9; + KB_left_sidelights.leds_max = 9; + KB_left_sidelights.leds_count = 9; + KB_left_sidelights.matrix_map = new matrix_map_type; + + zone KB_macros; + KB_macros.name = "Macros"; + KB_macros.type = 1; + KB_macros.leds_min = 6; + KB_macros.leds_max = 6; + KB_macros.leds_count = 6; + KB_macros.matrix_map = new matrix_map_type; + + KB_right_sidelights.matrix_map->height = 1; + KB_right_sidelights.matrix_map->width = 9; + KB_right_sidelights.matrix_map->map = (unsigned int *)&Z20_right_side_matrix; + + KB_left_sidelights.matrix_map->height = 1; + KB_left_sidelights.matrix_map->width = 9; + KB_left_sidelights.matrix_map->map = (unsigned int *)&Z20_right_side_matrix; + + KB_macros.matrix_map->height = 1; + KB_macros.matrix_map->width = 6; + KB_macros.matrix_map->map = (unsigned int *)&Z20_macro_matrix; + + zones.push_back(KB_macros); + zones.push_back(KB_left_sidelights); + zones.push_back(KB_right_sidelights); + } /*-------------------------------------------------*\ | Clear any existing color/LED configuration | \*-------------------------------------------------*/