Add Dell G7 15 7500 Support
Commit amended by Adam Honse <calcprogrammer1@gmail.com>
This commit is contained in:
parent
eef55e6d6e
commit
6997017879
4 changed files with 70 additions and 48 deletions
|
|
@ -24,7 +24,8 @@ typedef uint32_t alienware_platform_id;
|
|||
\*---------------------------------------------------------*/
|
||||
static const std::map<alienware_platform_id, uint8_t> zone_quirks_table =
|
||||
{
|
||||
{ 0x0C01, 4 } // Dell G5 SE 5505
|
||||
{ 0x0C01, 4 }, // Dell G5 SE 5505
|
||||
{ 0x0A01, 16 } // Dell G7 15 7500
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
|
|
@ -33,7 +34,12 @@ static const std::map<alienware_platform_id, uint8_t> zone_quirks_table =
|
|||
\*---------------------------------------------------------*/
|
||||
static const std::map<alienware_platform_id, std::vector<const char*>> zone_names_table =
|
||||
{
|
||||
{ 0x0C01, { "Left", "Middle", "Right", "Numpad" } }
|
||||
{ 0x0C01, { "Left", "Middle", "Right", "Numpad" } },
|
||||
{ 0x0A01, { "Left", "Center Left", "Center Right", "Right",
|
||||
"Light Bar 1", "Light Bar 2", "Light Bar 3",
|
||||
"Light Bar 4", "Light Bar 5", "Light Bar 6",
|
||||
"Light Bar 7", "Light Bar 8", "Light Bar 9",
|
||||
"Light Bar 10", "Light Bar 11", "Light Bar 12" } }
|
||||
};
|
||||
|
||||
static void SendHIDReport(hid_device *dev, const unsigned char* usb_buf, size_t usb_buf_size)
|
||||
|
|
@ -81,7 +87,7 @@ AlienwareController::AlienwareController(hid_device* dev_handle, const hid_devic
|
|||
/*-----------------------------------------------------*\
|
||||
| Get zone information by checking firmware |
|
||||
| configuration |
|
||||
\*-----------------------------------------------------*/
|
||||
\*-----------------------------------------------------*/
|
||||
report = Report(ALIENWARE_COMMAND_REPORT_CONFIG);
|
||||
alienware_platform_id platform_id = report.data[4] << 8 | report.data[5];
|
||||
|
||||
|
|
@ -278,8 +284,7 @@ bool AlienwareController::Dim(std::vector<uint8_t> zones, double percent)
|
|||
\*-----------------------------------------------------*/
|
||||
SendHIDReport(dev, usb_buf, sizeof(usb_buf));
|
||||
|
||||
HidapiAlienwareReport response;
|
||||
response = GetResponse();
|
||||
HidapiAlienwareReport response = GetResponse();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| For this command, error is if the output equals the |
|
||||
|
|
@ -319,8 +324,7 @@ bool AlienwareController::UserAnimation(uint16_t subcommand, uint16_t animation,
|
|||
| Every subcommand appears to report its result on a |
|
||||
| different byte |
|
||||
\*-----------------------------------------------------*/
|
||||
HidapiAlienwareReport response;
|
||||
response = GetResponse();
|
||||
HidapiAlienwareReport response = GetResponse();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| The only time the 0x03 byte is zero is if the |
|
||||
|
|
@ -384,8 +388,7 @@ bool AlienwareController::SelectZones(const std::vector<uint8_t>& zones)
|
|||
\*-----------------------------------------------------*/
|
||||
SendHIDReport(dev, usb_buf, sizeof(usb_buf));
|
||||
|
||||
HidapiAlienwareReport response;
|
||||
response = GetResponse();
|
||||
HidapiAlienwareReport response = GetResponse();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| For this command, error is if the output equals the |
|
||||
|
|
@ -448,8 +451,7 @@ bool AlienwareController::ModeAction
|
|||
\*-----------------------------------------------------*/
|
||||
SendHIDReport(dev, usb_buf, sizeof(usb_buf));
|
||||
|
||||
HidapiAlienwareReport response;
|
||||
response = GetResponse();
|
||||
HidapiAlienwareReport response = GetResponse();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| For this command, error is if the output equals the |
|
||||
|
|
@ -527,8 +529,7 @@ bool AlienwareController::SetColorDirect(RGBColor color, std::vector<uint8_t> zo
|
|||
\*-----------------------------------------------------*/
|
||||
SendHIDReport(dev, usb_buf, sizeof(usb_buf));
|
||||
|
||||
HidapiAlienwareReport response;
|
||||
response = GetResponse();
|
||||
HidapiAlienwareReport response = GetResponse();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| For this command, error is if the output equals the |
|
||||
|
|
@ -566,8 +567,7 @@ bool AlienwareController::Reset()
|
|||
\*-----------------------------------------------------*/
|
||||
SendHIDReport(dev, usb_buf, sizeof(usb_buf));
|
||||
|
||||
HidapiAlienwareReport response;
|
||||
response = GetResponse();
|
||||
HidapiAlienwareReport response = GetResponse();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| For this command, error is if the output equals the |
|
||||
|
|
@ -592,17 +592,13 @@ void AlienwareController::SetColor(uint8_t zone, RGBColor color)
|
|||
|
||||
void AlienwareController::SetColor(uint8_t zone, RGBColor color1, RGBColor color2)
|
||||
{
|
||||
if((color1 != zones[zone].color[0]))
|
||||
{
|
||||
zones[zone].color[0] = color1;
|
||||
dirty = true;
|
||||
}
|
||||
dirty = ((color1 != zones[zone].color[0]) || (color2 != zones[zone].color[1]));
|
||||
|
||||
if((color2 != zones[zone].color[1]))
|
||||
{
|
||||
zones[zone].color[1] = color2;
|
||||
dirty = true;
|
||||
}
|
||||
if(dirty)
|
||||
{
|
||||
zones[zone].color[0] = color1;
|
||||
zones[zone].color[1] = color2;
|
||||
}
|
||||
}
|
||||
|
||||
void AlienwareController::SetPeriod(uint8_t zone, uint16_t period)
|
||||
|
|
@ -625,14 +621,6 @@ void AlienwareController::SetTempo(uint8_t zone, uint16_t tempo)
|
|||
|
||||
void AlienwareController::SetDim(uint8_t zone, uint8_t dim)
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Clamp dim to values between 0 and 100 |
|
||||
\*-----------------------------------------------------*/
|
||||
if(dim > 100)
|
||||
{
|
||||
dim = 100;
|
||||
}
|
||||
|
||||
if(dim != zones[zone].dim)
|
||||
{
|
||||
zones[zone].dim = dim;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
/*---------------------------------------------------------*\
|
||||
| Alienware product ID |
|
||||
\*---------------------------------------------------------*/
|
||||
#define ALIENWARE_G5_SE_PID 0x0550
|
||||
#define ALIENWARE_G_SERIES_PID 0x0550
|
||||
|
||||
void DetectAlienwareControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
|
|
@ -26,4 +26,4 @@ void DetectAlienwareControllers(hid_device_info* info, const std::string& name)
|
|||
}
|
||||
}
|
||||
|
||||
REGISTER_HID_DETECTOR("Alienware G5 SE LED Controller", DetectAlienwareControllers, ALIENWARE_VID, ALIENWARE_G5_SE_PID);
|
||||
REGISTER_HID_DETECTOR("Dell G Series LED Controller", DetectAlienwareControllers, ALIENWARE_VID, ALIENWARE_G_SERIES_PID);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ RGBController_Alienware::RGBController_Alienware(AlienwareController* alienware_
|
|||
Color.color_mode = MODE_COLORS_PER_LED;
|
||||
Color.colors_min = 1;
|
||||
Color.colors_max = 1;
|
||||
Color.brightness_min = 0;
|
||||
Color.brightness_max = 100;
|
||||
Color.brightness = 100;
|
||||
modes.push_back(Color);
|
||||
|
||||
mode Pulse;
|
||||
|
|
@ -43,6 +46,9 @@ RGBController_Alienware::RGBController_Alienware(AlienwareController* alienware_
|
|||
Pulse.speed_min = ALIENWARE_TEMPO_MIN;
|
||||
Pulse.speed_max = ALIENWARE_TEMPO_MAX;
|
||||
Pulse.speed = ALIENWARE_TEMPO_MIN;
|
||||
Pulse.brightness_min = 0;
|
||||
Pulse.brightness_max = 100;
|
||||
Pulse.brightness = 100;
|
||||
modes.push_back(Pulse);
|
||||
|
||||
mode Morph;
|
||||
|
|
@ -56,6 +62,9 @@ RGBController_Alienware::RGBController_Alienware(AlienwareController* alienware_
|
|||
Morph.speed_min = ALIENWARE_TEMPO_MIN;
|
||||
Morph.speed_max = ALIENWARE_TEMPO_MAX;
|
||||
Morph.speed = ALIENWARE_TEMPO_MIN;
|
||||
Morph.brightness_min = 0;
|
||||
Morph.brightness_max = 100;
|
||||
Morph.brightness = 100;
|
||||
modes.push_back(Morph);
|
||||
|
||||
mode Spectrum;
|
||||
|
|
@ -66,6 +75,9 @@ RGBController_Alienware::RGBController_Alienware(AlienwareController* alienware_
|
|||
Spectrum.speed_min = ALIENWARE_TEMPO_SPECTRUM;
|
||||
Spectrum.speed_max = ALIENWARE_TEMPO_MAX;
|
||||
Spectrum.speed = ALIENWARE_TEMPO_SPECTRUM;
|
||||
Spectrum.brightness_min = 0;
|
||||
Spectrum.brightness_max = 100;
|
||||
Spectrum.brightness = 100;
|
||||
modes.push_back(Spectrum);
|
||||
|
||||
mode Rainbow;
|
||||
|
|
@ -76,6 +88,9 @@ RGBController_Alienware::RGBController_Alienware(AlienwareController* alienware_
|
|||
Rainbow.speed_min = ALIENWARE_TEMPO_SPECTRUM;
|
||||
Rainbow.speed_max = ALIENWARE_TEMPO_MAX;
|
||||
Rainbow.speed = ALIENWARE_TEMPO_SPECTRUM;
|
||||
Rainbow.brightness_min = 0;
|
||||
Rainbow.brightness_max = 100;
|
||||
Rainbow.brightness = 100;
|
||||
modes.push_back(Rainbow);
|
||||
|
||||
mode Breathing;
|
||||
|
|
@ -83,11 +98,14 @@ RGBController_Alienware::RGBController_Alienware(AlienwareController* alienware_
|
|||
Breathing.value = ALIENWARE_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Pulse.colors_min = 1;
|
||||
Pulse.colors_max = 1;
|
||||
Breathing.colors_min = 1;
|
||||
Breathing.colors_max = 1;
|
||||
Breathing.speed_min = ALIENWARE_TEMPO_MIN;
|
||||
Breathing.speed_max = ALIENWARE_TEMPO_MAX;
|
||||
Breathing.speed = ALIENWARE_TEMPO_MIN;
|
||||
Breathing.brightness_min = 0;
|
||||
Breathing.brightness_max = 100;
|
||||
Breathing.brightness = 100;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
SetupZones();
|
||||
|
|
@ -157,17 +175,19 @@ void RGBController_Alienware::SetCustomMode()
|
|||
|
||||
static bool modes_eq(const mode& mode1, const mode& mode2)
|
||||
{
|
||||
return( ( mode1.name == mode2.name )
|
||||
&& ( mode1.value == mode2.value )
|
||||
&& ( mode1.flags == mode2.flags )
|
||||
&& ( mode1.speed_min == mode2.speed_min )
|
||||
&& ( mode1.speed_max == mode2.speed_max )
|
||||
&& ( mode1.colors_min == mode2.colors_min )
|
||||
&& ( mode1.colors_max == mode2.colors_max )
|
||||
&& ( mode1.speed == mode2.speed )
|
||||
&& ( mode1.direction == mode2.direction )
|
||||
&& ( mode1.color_mode == mode2.color_mode )
|
||||
&& ( mode1.colors == mode2.colors ) );
|
||||
return( ( mode1.name == mode2.name )
|
||||
&& ( mode1.value == mode2.value )
|
||||
&& ( mode1.flags == mode2.flags )
|
||||
&& ( mode1.speed_min == mode2.speed_min )
|
||||
&& ( mode1.speed_max == mode2.speed_max )
|
||||
&& ( mode1.colors_min == mode2.colors_min )
|
||||
&& ( mode1.colors_max == mode2.colors_max )
|
||||
&& ( mode1.speed == mode2.speed )
|
||||
&& ( mode1.direction == mode2.direction )
|
||||
&& ( mode1.color_mode == mode2.color_mode )
|
||||
&& ( mode1.colors == mode2.colors )
|
||||
&& ( mode1.brightness_min == mode2.brightness_min )
|
||||
&& ( mode1.brightness_max == mode2.brightness_max ) );
|
||||
}
|
||||
|
||||
void RGBController_Alienware::DeviceUpdateMode()
|
||||
|
|
@ -204,30 +224,35 @@ void RGBController_Alienware::DeviceUpdateMode()
|
|||
alienware->SetPeriod(zone_idx, period);
|
||||
alienware->SetColor( zone_idx, colors[current_zone.start_idx]);
|
||||
alienware->SetTempo( zone_idx, ALIENWARE_TEMPO_MAX);
|
||||
alienware->SetDim( zone_idx, modes[current_mode_idx].brightness);
|
||||
break;
|
||||
|
||||
case ALIENWARE_MODE_PULSE:
|
||||
alienware->SetPeriod(zone_idx, period);
|
||||
alienware->SetColor( zone_idx, colors[current_zone.start_idx]);
|
||||
alienware->SetTempo( zone_idx, current_mode.speed);
|
||||
alienware->SetDim( zone_idx, modes[current_mode_idx].brightness);
|
||||
break;
|
||||
|
||||
case ALIENWARE_MODE_MORPH:
|
||||
alienware->SetPeriod(zone_idx, period);
|
||||
alienware->SetColor( zone_idx, current_mode.colors[zone_idx * 2], current_mode.colors[(zone_idx * 2) + 1]);
|
||||
alienware->SetTempo( zone_idx, current_mode.speed);
|
||||
alienware->SetDim( zone_idx, modes[current_mode_idx].brightness);
|
||||
break;
|
||||
|
||||
case ALIENWARE_MODE_SPECTRUM:
|
||||
case ALIENWARE_MODE_RAINBOW:
|
||||
alienware->SetPeriod(zone_idx, ALIENWARE_DURATION_SPECTRUM);
|
||||
alienware->SetTempo( zone_idx, current_mode.speed);
|
||||
alienware->SetDim( zone_idx, modes[current_mode_idx].brightness);
|
||||
break;
|
||||
|
||||
case ALIENWARE_MODE_BREATHING:
|
||||
alienware->SetPeriod(zone_idx, period);
|
||||
alienware->SetColor( zone_idx, colors[current_zone.start_idx], 0x0);
|
||||
alienware->SetTempo( zone_idx, current_mode.speed);
|
||||
alienware->SetDim( zone_idx, modes[current_mode_idx].brightness);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue