Publish LumaOps source
This commit is contained in:
+123
@@ -0,0 +1,123 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| AsusAuraMonitorController.cpp |
|
||||
| |
|
||||
| Driver for ASUS Aura monitor |
|
||||
| |
|
||||
| Mola19 08 Mar 2022 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <cstring>
|
||||
#include "AsusAuraMonitorController.h"
|
||||
#include "LogManager.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
AuraMonitorController::AuraMonitorController(hid_device* dev_handle, const char* path, uint16_t pid, std::string dev_name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
device_pid = pid;
|
||||
name = dev_name;
|
||||
}
|
||||
|
||||
AuraMonitorController::~AuraMonitorController()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
std::string AuraMonitorController::GetDeviceLocation()
|
||||
{
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string AuraMonitorController::GetNameString()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string AuraMonitorController::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
int ret = hid_get_serial_number_string(dev, serial_string, 128);
|
||||
|
||||
if(ret != 0)
|
||||
{
|
||||
return("");
|
||||
}
|
||||
|
||||
return(StringUtils::wstring_to_string(serial_string));
|
||||
}
|
||||
|
||||
void AuraMonitorController::BeginUpdate()
|
||||
{
|
||||
unsigned char usb_buf[8];
|
||||
|
||||
if (device_pid == AURA_ROG_PG32UQ_PID || device_pid == AURA_ROG_STRIX_XG32VC_PID)
|
||||
{
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
usb_buf[0x00] = 0x03;
|
||||
usb_buf[0x01] = 0x02;
|
||||
usb_buf[0x02] = 0xA1;
|
||||
usb_buf[0x03] = 0x80;
|
||||
|
||||
usb_buf[0x04] = 0x20;
|
||||
hid_send_feature_report(dev, usb_buf, 8);
|
||||
|
||||
usb_buf[0x04] = 0x30;
|
||||
hid_send_feature_report(dev, usb_buf, 8);
|
||||
}
|
||||
}
|
||||
|
||||
void AuraMonitorController::UpdateLed
|
||||
(
|
||||
int led,
|
||||
unsigned char red,
|
||||
unsigned char green,
|
||||
unsigned char blue
|
||||
)
|
||||
{
|
||||
unsigned char usb_buf[8];
|
||||
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
usb_buf[0x00] = 0x03;
|
||||
usb_buf[0x01] = 0x02;
|
||||
usb_buf[0x02] = 0xA1;
|
||||
usb_buf[0x03] = 0x80;
|
||||
|
||||
unsigned char offset = (device_pid == AURA_ROG_STRIX_XG279Q_PID) ? 0 : 16;
|
||||
|
||||
usb_buf[0x04] = offset + led * 3;
|
||||
usb_buf[0x05] = red;
|
||||
|
||||
hid_send_feature_report(dev, usb_buf, 8);
|
||||
|
||||
usb_buf[0x04] = offset + led * 3 + 1;
|
||||
usb_buf[0x05] = blue;
|
||||
|
||||
hid_send_feature_report(dev, usb_buf, 8);
|
||||
|
||||
usb_buf[0x04] = offset + led * 3 + 2;
|
||||
usb_buf[0x05] = green;
|
||||
|
||||
hid_send_feature_report(dev, usb_buf, 8);
|
||||
}
|
||||
|
||||
void AuraMonitorController::ApplyChanges()
|
||||
{
|
||||
unsigned char usb_buf[8];
|
||||
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
usb_buf[0x00] = 0x03;
|
||||
usb_buf[0x01] = 0x02;
|
||||
usb_buf[0x02] = 0xA1;
|
||||
usb_buf[0x03] = 0x80;
|
||||
usb_buf[0x04] = 0xA0;
|
||||
usb_buf[0x05] = 0x01;
|
||||
|
||||
hid_send_feature_report(dev, usb_buf, 8);
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| AsusAuraMonitorController.h |
|
||||
| |
|
||||
| Driver for ASUS Aura monitor |
|
||||
| |
|
||||
| Mola19 08 Mar 2022 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <hidapi.h>
|
||||
#include "RGBController.h"
|
||||
|
||||
enum
|
||||
{
|
||||
AURA_ROG_STRIX_XG27AQ_PID = 0x198C,
|
||||
AURA_ROG_STRIX_XG27AQM_PID = 0x19BB,
|
||||
AURA_ROG_STRIX_XG279Q_PID = 0x1919,
|
||||
AURA_ROG_STRIX_XG27W_PID = 0x1933,
|
||||
AURA_ROG_STRIX_XG32VC_PID = 0x1968,
|
||||
AURA_ROG_PG32UQ_PID = 0x19B9,
|
||||
};
|
||||
|
||||
class AuraMonitorController
|
||||
{
|
||||
public:
|
||||
AuraMonitorController(hid_device* dev_handle, const char* path, uint16_t pid, std::string dev_name);
|
||||
virtual ~AuraMonitorController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetNameString();
|
||||
std::string GetSerialString();
|
||||
|
||||
void BeginUpdate();
|
||||
void UpdateLed(int led, unsigned char red, unsigned char green, unsigned char blue);
|
||||
void ApplyChanges();
|
||||
|
||||
uint16_t device_pid;
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string name;
|
||||
};
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_AsusAuraMonitor.cpp |
|
||||
| |
|
||||
| RGBController for ASUS Aura monitor |
|
||||
| |
|
||||
| Mola19 08 Mar 2022 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_AsusAuraMonitor.h"
|
||||
|
||||
/**------------------------------------------------------------------*\
|
||||
@name Asus Aura Monitor
|
||||
@category Accessory
|
||||
@type USB
|
||||
@save :x:
|
||||
@direct :white_check_mark:
|
||||
@effects :x:
|
||||
@detectors DetectAsusAuraUSBMonitor
|
||||
@comment
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
RGBController_AuraMonitor::RGBController_AuraMonitor(AuraMonitorController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->GetNameString();
|
||||
vendor = "ASUS";
|
||||
type = DEVICE_TYPE_MONITOR;
|
||||
description = "ASUS Aura Monitor Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_AuraMonitor::~RGBController_AuraMonitor()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_AuraMonitor::SetupZones()
|
||||
{
|
||||
zone underglow_zone;
|
||||
|
||||
underglow_zone.name = "Backlight";
|
||||
underglow_zone.type = ZONE_TYPE_LINEAR;
|
||||
underglow_zone.leds_min = 3;
|
||||
underglow_zone.leds_max = 3;
|
||||
underglow_zone.leds_count = 3;
|
||||
underglow_zone.matrix_map = NULL;
|
||||
|
||||
zones.push_back(underglow_zone);
|
||||
|
||||
for(unsigned int i = 0; i < 3; i++)
|
||||
{
|
||||
led underglow_led;
|
||||
|
||||
underglow_led.name = "Backlight LED " + std::to_string(i + 1);
|
||||
|
||||
leds.push_back(underglow_led);
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_AuraMonitor::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_AuraMonitor::DeviceUpdateLEDs()
|
||||
{
|
||||
controller->BeginUpdate();
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[i]);
|
||||
unsigned char green = RGBGetGValue(colors[i]);
|
||||
unsigned char blue = RGBGetBValue(colors[i]);
|
||||
|
||||
controller->UpdateLed(i, red, green, blue);
|
||||
}
|
||||
|
||||
controller->ApplyChanges();
|
||||
}
|
||||
|
||||
void RGBController_AuraMonitor::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_AuraMonitor::UpdateSingleLED(int led)
|
||||
{
|
||||
controller->BeginUpdate();
|
||||
|
||||
unsigned char red = RGBGetRValue(colors[led]);
|
||||
unsigned char green = RGBGetGValue(colors[led]);
|
||||
unsigned char blue = RGBGetBValue(colors[led]);
|
||||
|
||||
controller->UpdateLed(led, red, green, blue);
|
||||
|
||||
controller->ApplyChanges();
|
||||
}
|
||||
|
||||
void RGBController_AuraMonitor::DeviceUpdateMode()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support Mode changing |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_AuraMonitor::DeviceSaveMode()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support Mode saving |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| RGBController_AsusAuraMonitor.h |
|
||||
| |
|
||||
| RGBController for ASUS Aura monitor |
|
||||
| |
|
||||
| Mola19 08 Mar 2022 |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "AsusAuraMonitorController.h"
|
||||
|
||||
class RGBController_AuraMonitor : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_AuraMonitor(AuraMonitorController* controller_ptr);
|
||||
~RGBController_AuraMonitor();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void DeviceUpdateMode();
|
||||
void DeviceSaveMode();
|
||||
|
||||
private:
|
||||
AuraMonitorController* controller;
|
||||
};
|
||||
Reference in New Issue
Block a user