1
0
mirror of https://github.com/MatMoul/g810-led.git synced 2024-12-23 09:16:11 +00:00

Rename keyboard protocol version

This commit is contained in:
MatMoul 2016-12-06 22:54:04 +01:00
parent bc3280f851
commit a4a0b83542
2 changed files with 10 additions and 10 deletions

View File

@ -30,12 +30,12 @@ bool Keyboard::attach() {
if (desc.idProduct == 0xc333) { pid = desc.idProduct; break; } // G610 spectrum
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

View File

@ -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;