diff --git a/Controllers/A4TechController/A4Tech_Detector.cpp b/Controllers/A4TechController/A4Tech_Detector.cpp index 30d69c26..c728e048 100644 --- a/Controllers/A4TechController/A4Tech_Detector.cpp +++ b/Controllers/A4TechController/A4Tech_Detector.cpp @@ -46,9 +46,8 @@ void DetectBloodyB820R(hid_device_info* info, const std::string& name) if(dev) { - BloodyB820RController* controller = new BloodyB820RController(dev, info->path); + BloodyB820RController* controller = new BloodyB820RController(dev, info->path, name); RGBController_BloodyB820R* rgb_controller = new RGBController_BloodyB820R(controller); - rgb_controller->name = name; ResourceManager::get()->RegisterRGBController(rgb_controller); } diff --git a/Controllers/A4TechController/BloodyB820RController/BloodyB820RController.cpp b/Controllers/A4TechController/BloodyB820RController/BloodyB820RController.cpp index 952b58dc..d702058a 100644 --- a/Controllers/A4TechController/BloodyB820RController/BloodyB820RController.cpp +++ b/Controllers/A4TechController/BloodyB820RController/BloodyB820RController.cpp @@ -20,10 +20,11 @@ | the second packet. | \*-------------------------------------------------------------------------------------*/ -BloodyB820RController::BloodyB820RController(hid_device* dev_handle, const char* path) +BloodyB820RController::BloodyB820RController(hid_device* dev_handle, const char* path, std::string dev_name) { dev = dev_handle; location = path; + name = dev_name; SendControlPacket(BLOODY_B820R_GAIN_CONTROL); } @@ -52,6 +53,11 @@ std::string BloodyB820RController::GetLocation() return("HID: " + location); } +std::string BloodyB820RController::GetName() +{ + return(name); +} + void BloodyB820RController::SendControlPacket(uint8_t data) { uint8_t buffer[BLOODY_B820R_PACKET_SIZE] = { 0x07, 0x03, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00 }; diff --git a/Controllers/A4TechController/BloodyB820RController/BloodyB820RController.h b/Controllers/A4TechController/BloodyB820RController/BloodyB820RController.h index f567c0fa..1a32448b 100644 --- a/Controllers/A4TechController/BloodyB820RController/BloodyB820RController.h +++ b/Controllers/A4TechController/BloodyB820RController/BloodyB820RController.h @@ -39,15 +39,17 @@ enum class BloodyB820RController { public: - BloodyB820RController(hid_device* dev_handle, const char* path); + BloodyB820RController(hid_device* dev_handle, const char* path, std::string dev_name); ~BloodyB820RController(); std::string GetSerial(); std::string GetLocation(); + std::string GetName(); void SetLEDDirect(std::vector colors); void SendControlPacket(uint8_t data); private: std::string location; + std::string name; hid_device* dev; }; diff --git a/Controllers/A4TechController/BloodyB820RController/RGBController_BloodyB820R.cpp b/Controllers/A4TechController/BloodyB820RController/RGBController_BloodyB820R.cpp index d1796dc1..f3ad57b5 100644 --- a/Controllers/A4TechController/BloodyB820RController/RGBController_BloodyB820R.cpp +++ b/Controllers/A4TechController/BloodyB820RController/RGBController_BloodyB820R.cpp @@ -154,7 +154,7 @@ RGBController_BloodyB820R::RGBController_BloodyB820R(BloodyB820RController *cont { controller = controller_ptr; - name = "Bloody B820R"; + name = controller->GetName(); vendor = "A4Tech"; type = DEVICE_TYPE_KEYBOARD; description = "A4Tech Bloody Keyboard";