Store name in BloodyB820RController to avoid setting it in detector
This commit is contained in:
parent
9c26f79ca6
commit
b8628bb495
4 changed files with 12 additions and 5 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 };
|
||||
|
|
|
|||
|
|
@ -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<RGBColor> colors);
|
||||
void SendControlPacket(uint8_t data);
|
||||
private:
|
||||
std::string location;
|
||||
std::string name;
|
||||
hid_device* dev;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue