mirror of
https://github.com/MatMoul/g810-led.git
synced 2024-12-23 01:06:11 +00:00
Rename keyboard protocol version
This commit is contained in:
parent
bc3280f851
commit
a4a0b83542
@ -28,14 +28,14 @@ bool Keyboard::attach() {
|
||||
if (desc.idProduct == 0xc337) { pid = desc.idProduct; break; } // G810 spectrum
|
||||
if (desc.idProduct == 0xc330) { pid = desc.idProduct; break; } // G410 spectrum
|
||||
if (desc.idProduct == 0xc333) { pid = desc.idProduct; break; } // G610 spectrum
|
||||
if (desc.idProduct == 0xc32b) { // G910 spark
|
||||
if (desc.idProduct == 0xc32b) { // G910 spark
|
||||
pid = desc.idProduct;
|
||||
kbdProtocol = KeyboardProtocol::spark;
|
||||
kbdProtocol = KeyboardProtocol::g910;
|
||||
break;
|
||||
}
|
||||
if (desc.idProduct == 0xc335) {
|
||||
if (desc.idProduct == 0xc335) { // G910 spectrum
|
||||
pid = desc.idProduct;
|
||||
kbdProtocol = KeyboardProtocol::spark;
|
||||
kbdProtocol = KeyboardProtocol::g910;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -85,13 +85,13 @@ bool Keyboard::commit() {
|
||||
bool retval = false;
|
||||
unsigned char *data = new unsigned char[20];
|
||||
switch (kbdProtocol) {
|
||||
case KeyboardProtocol::spectrum:
|
||||
case KeyboardProtocol::generic:
|
||||
data[0] = 0x11;
|
||||
data[1] = 0xff;
|
||||
data[2] = 0x0c;
|
||||
data[3] = 0x5a;
|
||||
break;
|
||||
case KeyboardProtocol::spark:
|
||||
case KeyboardProtocol::g910:
|
||||
data[0] = 0x11;
|
||||
data[1] = 0xff;
|
||||
data[2] = 0x0f;
|
||||
@ -488,7 +488,7 @@ bool Keyboard::sendDataInternal(unsigned char *data, int data_size) {
|
||||
|
||||
bool Keyboard::populateAddressGroupInternal(KeyAddressGroup addressGroup, unsigned char *data) {
|
||||
switch (kbdProtocol) {
|
||||
case KeyboardProtocol::spectrum:
|
||||
case KeyboardProtocol::generic:
|
||||
switch (addressGroup) {
|
||||
case KeyAddressGroup::logo:
|
||||
data[0] = 0x11; // Base address
|
||||
@ -535,7 +535,7 @@ bool Keyboard::populateAddressGroupInternal(KeyAddressGroup addressGroup, unsign
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case KeyboardProtocol::spark: // gkeys and mkeys seem not changeable
|
||||
case KeyboardProtocol::g910: // gkeys and mkeys seem not changeable
|
||||
switch (addressGroup) {
|
||||
case KeyAddressGroup::logo:
|
||||
data[0] = 0x11; // Base address
|
||||
|
@ -8,7 +8,7 @@ class Keyboard {
|
||||
|
||||
public:
|
||||
|
||||
enum class KeyboardProtocol { spectrum, spark };
|
||||
enum class KeyboardProtocol { generic, g910 };
|
||||
enum class PowerOnEffect { rainbow, color };
|
||||
enum class KeyAddressGroup { logo, indicators, multimedia, keys, gkeys };
|
||||
enum class Key { // 127 items
|
||||
@ -57,7 +57,7 @@ class Keyboard {
|
||||
|
||||
bool m_isAttached = false;
|
||||
bool m_isKernellDetached = false;
|
||||
KeyboardProtocol kbdProtocol = KeyboardProtocol::spectrum;
|
||||
KeyboardProtocol kbdProtocol = KeyboardProtocol::generic;
|
||||
libusb_device **devs;
|
||||
libusb_device_handle *dev_handle;
|
||||
libusb_context *ctx = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user