Store name in GaiZhongGaiControllers to avoid setting it in detector
This commit is contained in:
parent
0afcdbd0ca
commit
2927135cdd
4 changed files with 68 additions and 77 deletions
|
|
@ -22,10 +22,11 @@
|
|||
| https://oshwhub.com/morempty/CH552gyin-liang-xuan-niu |
|
||||
\*---------------------------------------------------------------*/
|
||||
|
||||
GaiZhongGaiKeyboardController::GaiZhongGaiKeyboardController(hid_device* dev_handle, hid_device_info* info)
|
||||
GaiZhongGaiKeyboardController::GaiZhongGaiKeyboardController(hid_device* dev_handle, hid_device_info* info, std::string dev_name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = info->path;
|
||||
name = dev_name;
|
||||
usb_pid = info->product_id;
|
||||
/*-----------------------------------------------------*\
|
||||
| Obtaining the Firmware Version |
|
||||
|
|
@ -163,6 +164,11 @@ std::string GaiZhongGaiKeyboardController::GetDeviceLocation()
|
|||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string GaiZhongGaiKeyboardController::GetNameString()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string GaiZhongGaiKeyboardController::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
|
|
|
|||
|
|
@ -40,10 +40,11 @@
|
|||
class GaiZhongGaiKeyboardController
|
||||
{
|
||||
public:
|
||||
GaiZhongGaiKeyboardController(hid_device* dev_handle, hid_device_info* info);
|
||||
GaiZhongGaiKeyboardController(hid_device* dev_handle, hid_device_info* info, std::string dev_name);
|
||||
~GaiZhongGaiKeyboardController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetNameString();
|
||||
std::string GetSerialString();
|
||||
std::string GetVersion();
|
||||
unsigned short GetUSBPID();
|
||||
|
|
@ -60,6 +61,7 @@ public:
|
|||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string name;
|
||||
std::string version;
|
||||
unsigned short usb_pid;
|
||||
uint8_t data_flash[128];
|
||||
|
|
|
|||
|
|
@ -25,11 +25,12 @@
|
|||
void DetectGaiZhongGaiKeyboardControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if( dev )
|
||||
|
||||
if(dev)
|
||||
{
|
||||
GaiZhongGaiKeyboardController* controller = new GaiZhongGaiKeyboardController(dev, info);
|
||||
GaiZhongGaiKeyboardController* controller = new GaiZhongGaiKeyboardController(dev, info, name);
|
||||
RGBController_GaiZhongGaiKeyboard* rgb_controller = new RGBController_GaiZhongGaiKeyboard(controller);
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
} /* DetectGaiZhongGaiKeyboardControllers() */
|
||||
|
|
|
|||
|
|
@ -383,85 +383,67 @@ uint16_t LightBoard_init(uint8_t* p_in)
|
|||
|
||||
RGBController_GaiZhongGaiKeyboard::RGBController_GaiZhongGaiKeyboard(GaiZhongGaiKeyboardController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
controller = controller_ptr;
|
||||
name = controller->GetNameString();
|
||||
|
||||
switch(controller->GetUSBPID())
|
||||
{
|
||||
case GAIZHONGGAI_68_PRO_PID:
|
||||
{
|
||||
name = "GaiZhongGai Keyboard Device";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "https://oshwhub.com/yangzen/zui-gai68-/";
|
||||
}
|
||||
break;
|
||||
case GAIZHONGGAI_42_PRO_PID:
|
||||
{
|
||||
name = "GaiZhongGai Keyboard Device";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "https://oshwhub.com/myng/42-jian-pan/";
|
||||
}
|
||||
break;
|
||||
case GAIZHONGGAI_17_TOUCH_PRO_PID:
|
||||
{
|
||||
name = "GaiZhongGai Keyboard Device";
|
||||
type = DEVICE_TYPE_KEYPAD;
|
||||
description = "https://oshwhub.com/yangzen/xing-huo-ji-hua-zui-gai-17-4-chu-mo-ji-xie-jian-pan-pro/";
|
||||
}
|
||||
break;
|
||||
case GAIZHONGGAI_17_PRO_PID:
|
||||
{
|
||||
name = "GaiZhongGai Keyboard Device";
|
||||
type = DEVICE_TYPE_KEYPAD;
|
||||
description = "https://oshwhub.com/hivisme/17jian-shuo-zi-xiao-jian-pan/";
|
||||
}
|
||||
break;
|
||||
case GAIZHONGGAI_20_PRO_PID:
|
||||
{
|
||||
name = "GaiZhongGai Keyboard Device";
|
||||
type = DEVICE_TYPE_KEYPAD;
|
||||
description = "https://oshwhub.com/runkuny/19keys_pad_normal/";
|
||||
}
|
||||
break;
|
||||
case GAIZHONGGAI_LIGHT_BOARD_PID:
|
||||
{
|
||||
name = "GaiZhongGai Controller Device";
|
||||
type = DEVICE_TYPE_ACCESSORY;
|
||||
description = "https://oshwhub.com/yangzen/xing-huo-2-qi-guang-ban-qu-dong-/";
|
||||
}
|
||||
break;
|
||||
case GAIZHONGGAI_RGB_HUB_GREEN_PID:
|
||||
{
|
||||
name = "GaiZhongGai Controller Device";
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
description = "https://oshwhub.com/yangzen/album/gai-zhong-gai-jian-pan-ge-ji/";
|
||||
}
|
||||
break;
|
||||
case GAIZHONGGAI_RGB_HUB_BLUE_PID:
|
||||
{
|
||||
name = "GaiZhongGai Controller Device";
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
description = "https://oshwhub.com/yangzen/album/gai-zhong-gai-jian-pan-ge-ji/";
|
||||
}
|
||||
break;
|
||||
case GAIZHONGGAI_DIAL_PID:
|
||||
{
|
||||
name = "GaiZhongGai DIAL Device";
|
||||
type = DEVICE_TYPE_UNKNOWN;
|
||||
description = "https://oshwhub.com/morempty/CH552gyin-liang-xuan-niu/";
|
||||
}
|
||||
break;
|
||||
case GAIZHONGGAI_68_PRO_PID:
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "https://oshwhub.com/yangzen/zui-gai68-/";
|
||||
break;
|
||||
|
||||
case GAIZHONGGAI_42_PRO_PID:
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "https://oshwhub.com/myng/42-jian-pan/";
|
||||
break;
|
||||
|
||||
case GAIZHONGGAI_17_TOUCH_PRO_PID:
|
||||
type = DEVICE_TYPE_KEYPAD;
|
||||
description = "https://oshwhub.com/yangzen/xing-huo-ji-hua-zui-gai-17-4-chu-mo-ji-xie-jian-pan-pro/";
|
||||
break;
|
||||
|
||||
case GAIZHONGGAI_17_PRO_PID:
|
||||
type = DEVICE_TYPE_KEYPAD;
|
||||
description = "https://oshwhub.com/hivisme/17jian-shuo-zi-xiao-jian-pan/";
|
||||
break;
|
||||
|
||||
case GAIZHONGGAI_20_PRO_PID:
|
||||
type = DEVICE_TYPE_KEYPAD;
|
||||
description = "https://oshwhub.com/runkuny/19keys_pad_normal/";
|
||||
break;
|
||||
|
||||
case GAIZHONGGAI_LIGHT_BOARD_PID:
|
||||
type = DEVICE_TYPE_ACCESSORY;
|
||||
description = "https://oshwhub.com/yangzen/xing-huo-2-qi-guang-ban-qu-dong-/";
|
||||
break;
|
||||
|
||||
case GAIZHONGGAI_RGB_HUB_GREEN_PID:
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
description = "https://oshwhub.com/yangzen/album/gai-zhong-gai-jian-pan-ge-ji/";
|
||||
break;
|
||||
|
||||
case GAIZHONGGAI_RGB_HUB_BLUE_PID:
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
description = "https://oshwhub.com/yangzen/album/gai-zhong-gai-jian-pan-ge-ji/";
|
||||
break;
|
||||
|
||||
case GAIZHONGGAI_DIAL_PID:
|
||||
type = DEVICE_TYPE_UNKNOWN;
|
||||
description = "https://oshwhub.com/morempty/CH552gyin-liang-xuan-niu/";
|
||||
break;
|
||||
}
|
||||
|
||||
vendor = "Yang";
|
||||
version = controller->GetVersion();
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
vendor = "Yang";
|
||||
version = controller->GetVersion();
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0xFFFF;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0xFFFF;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
SetupZones();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue