From e9caf663bc0faff05e1ac58b454144d3ae263c2d Mon Sep 17 00:00:00 2001 From: David Glushkov Date: Sun, 7 Jun 2026 18:09:19 +0000 Subject: [PATCH] Fix MSILaptopController ALC zone mapping and packet initialization --- .../MSILaptopController.cpp | 6 ++++++ .../MSILaptopControllerDetect.cpp | 20 ++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Controllers/MSILaptopController/MSILaptopController.cpp b/Controllers/MSILaptopController/MSILaptopController.cpp index 0abd6e5be..dcba4c344 100644 --- a/Controllers/MSILaptopController/MSILaptopController.cpp +++ b/Controllers/MSILaptopController/MSILaptopController.cpp @@ -70,6 +70,12 @@ void MSILaptopController::SetLEDs(std::vector leds, std::vector c buf[0x01] = MSI_LAPTOP_COMMAND; buf[0x03] = (type == MSI_LAPTOP_KLC) ? MSI_LAPTOP_KLC_PACKET_ID : MSI_LAPTOP_ALC_PACKET_ID; + // Fill unused LED IDs with 0xFF so they are ignored by the controller + for(int i = 0; i < (MSI_LAPTOP_PACKET_SIZE - MSI_LAPTOP_PAYLOAD_OFFSET) / 4; i++) + { + buf[MSI_LAPTOP_PAYLOAD_OFFSET + (i * 4)] = 0xFF; + } + for(unsigned int led_idx = 0; led_idx < led_count; led_idx++) { unsigned int offset = MSI_LAPTOP_PAYLOAD_OFFSET + (led_idx * 4); diff --git a/Controllers/MSILaptopController/MSILaptopControllerDetect.cpp b/Controllers/MSILaptopController/MSILaptopControllerDetect.cpp index d37ca510a..8f7dbf7d6 100644 --- a/Controllers/MSILaptopController/MSILaptopControllerDetect.cpp +++ b/Controllers/MSILaptopController/MSILaptopControllerDetect.cpp @@ -22,7 +22,7 @@ #define NA 0xFFFFFFFF #define MSI_LAPTOP_KLC_MATRIX_HEIGHT 6 #define MSI_LAPTOP_KLC_MATRIX_WIDTH 23 -#define MSI_LAPTOP_ALC_LIGHTBAR_LEDS 5 +#define MSI_LAPTOP_ALC_LIGHTBAR_LEDS 3 static const msi_laptop_led msi_raider_a18_klc_leds[] = { @@ -140,14 +140,24 @@ static unsigned int msi_raider_a18_klc_matrix_map[MSI_LAPTOP_KLC_MATRIX_HEIGHT][ { 90, 93, 92, NA, NA, NA, 38, NA, NA, NA,101, 94, 95, NA, 69, 70, 68, NA, 87, NA, 88, NA, NA }, }; +/*---------------------------------------------------------*\ +| Note on Raider A18 HX ALC (Lightbar) LED mappings: | +| Initial reverse engineering packet captures showed 6 zones| +| being updated (indexes 0x00 to 0x05). | +| However, indexes 0x04 (L4) and 0x05 (L5) are "dummy" zones| +| on this specific model and do not correspond to physical | +| LEDs. To avoid user confusion, they are omitted from the | +| UI profile here. | +| The SetLEDs function handles zero-padding the unused | +| payload slots with 0xFF so that omitting these zones | +| doesn't accidentally overwrite the 0x00 index (L1). | +\*---------------------------------------------------------*/ static const msi_laptop_led msi_raider_a18_alc_leds[] = { { "Lightbar 1", 0x00 }, { "Lightbar 2", 0x01 }, { "Lightbar 3", 0x02 }, - { "Lightbar 4", 0x03 }, - { "Lightbar 5", 0x04 }, - { "Logo", 0x05 }, + { "Logo", 0x03 }, }; static const MSILaptopModel msi_laptop_models[] = @@ -220,6 +230,6 @@ void DetectMSILaptop(hid_device_info* info, const std::string& name) } } -REGISTER_HID_DETECTOR_I("MSI Laptop Keyboard", DetectMSILaptop, STEELSERIES_VID, STEELSERIES_MSI_RAIDER_A18_KLC_PID, 0); +REGISTER_HID_DETECTOR("MSI Laptop Keyboard", DetectMSILaptop, STEELSERIES_VID, STEELSERIES_MSI_RAIDER_A18_KLC_PID); REGISTER_HID_DETECTOR_I("MSI Laptop Lightbar", DetectMSILaptop, STEELSERIES_VID, STEELSERIES_MSI_RAIDER_A18_ALC_PID, 0);