mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2025-12-26 08:47:50 -05:00
* Renamed LenovoRGBController_Gen7_8 to RGBController_Lenovo_Gen7_8 to align with naming convention * Fixed #include statements pointing to wrong header(s) * Corrected variable names in RGBController_Lenovo_Gen7USB.cpp * Other style and formatting changes
68 lines
3.2 KiB
C++
68 lines
3.2 KiB
C++
/*-------------------------------------------------------------------*\
|
|
| LenovoUSBDetect.h |
|
|
| |
|
|
| Describes zones for various Lenovo Legion Devices |
|
|
| |
|
|
| Cooper Hall (geobot19) 17 Apr 2022 |
|
|
| |
|
|
\*-------------------------------------------------------------------*/
|
|
|
|
#include "Detector.h"
|
|
#include "LogManager.h"
|
|
#include "RGBController.h"
|
|
|
|
#include "LenovoDevices.h"
|
|
#include "RGBController_LenovoUSB.h"
|
|
#include "RGBController_Lenovo_Gen7_8.h"
|
|
#include <hidapi/hidapi.h>
|
|
|
|
/*-----------------------------------------------------*\
|
|
| vendor IDs |
|
|
\*-----------------------------------------------------*/
|
|
#define ITE_VID 0x048D
|
|
|
|
/*-----------------------------------------------------*\
|
|
| Interface, Usage, and Usage Page |
|
|
\*-----------------------------------------------------*/
|
|
enum
|
|
{
|
|
LENOVO_PAGE = 0xFF89,
|
|
LENOVO_USAGE = 0x07
|
|
};
|
|
|
|
void DetectLenovoLegionUSBControllers(hid_device_info* info, const std::string& name)
|
|
{
|
|
hid_device* dev = hid_open_path(info->path);
|
|
|
|
if(dev)
|
|
{
|
|
LenovoUSBController* controller = new LenovoUSBController(dev, info->path, info->product_id);
|
|
RGBController_LenovoUSB* rgb_controller = new RGBController_LenovoUSB(controller);
|
|
rgb_controller->name = name;
|
|
|
|
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
|
}
|
|
}
|
|
|
|
void DetectLenovoLegionUSBControllersGen7And8(hid_device_info* info, const std::string& name)
|
|
{
|
|
hid_device* dev = hid_open_path(info->path);
|
|
|
|
if(dev)
|
|
{
|
|
LenovoGen7And8USBController* controller = new LenovoGen7And8USBController(dev, info->path, info->product_id);
|
|
LenovoRGBController_Gen7_8* rgb_controller = new LenovoRGBController_Gen7_8(controller);
|
|
rgb_controller->name = name;
|
|
|
|
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
|
}
|
|
}
|
|
|
|
REGISTER_HID_DETECTOR_PU("Lenovo Legion Y740", DetectLenovoLegionUSBControllers, ITE_VID, LEGION_Y740, LENOVO_PAGE, LENOVO_USAGE);
|
|
REGISTER_HID_DETECTOR_PU("Lenovo Legion 7 Gen 5", DetectLenovoLegionUSBControllers, ITE_VID, LEGION_Y750, LENOVO_PAGE, LENOVO_USAGE);
|
|
REGISTER_HID_DETECTOR_PU("Lenovo Legion 7S Gen 5", DetectLenovoLegionUSBControllers, ITE_VID, LEGION_Y750S, LENOVO_PAGE, LENOVO_USAGE);
|
|
REGISTER_HID_DETECTOR_PU("Lenovo Legion 7 Gen 6", DetectLenovoLegionUSBControllers, ITE_VID, LEGION_Y760, LENOVO_PAGE, LENOVO_USAGE);
|
|
REGISTER_HID_DETECTOR_PU("Lenovo Legion 7S Gen 6", DetectLenovoLegionUSBControllers, ITE_VID, LEGION_Y760S, LENOVO_PAGE, LENOVO_USAGE);
|
|
REGISTER_HID_DETECTOR_PU("Lenovo Legion 7 Gen 7", DetectLenovoLegionUSBControllersGen7And8, ITE_VID, LEGION_7GEN7, LENOVO_PAGE, LENOVO_USAGE);
|
|
REGISTER_HID_DETECTOR_PU("Lenovo Legion 7 Gen 8", DetectLenovoLegionUSBControllersGen7And8, ITE_VID, LEGION_7GEN8, LENOVO_PAGE, LENOVO_USAGE);
|