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

Merge branch 'pearsonk-master' into spellingvar

This commit is contained in:
MatMoul 2017-04-06 21:07:52 +02:00
commit 6d2b681cce
2 changed files with 15 additions and 15 deletions

View File

@ -28,9 +28,9 @@ bool LedKeyboard::listKeyboards() {
devs = hid_enumerate(0x0, 0x0); devs = hid_enumerate(0x0, 0x0);
dev = devs; dev = devs;
while (dev) { while (dev) {
for (int i=0; i<(int)SuportedKeyboards.size(); i++) { for (int i=0; i<(int)SupportedKeyboards.size(); i++) {
if (dev->vendor_id == SuportedKeyboards[i][0]) { if (dev->vendor_id == SupportedKeyboards[i][0]) {
if (dev->product_id == SuportedKeyboards[i][1]) { if (dev->product_id == SupportedKeyboards[i][1]) {
cout<<"0x"<<std::hex<<dev->vendor_id \ cout<<"0x"<<std::hex<<dev->vendor_id \
<<" 0x"<<std::hex<<dev->product_id \ <<" 0x"<<std::hex<<dev->product_id \
<<" "<<dev->serial_number \ <<" "<<dev->serial_number \
@ -59,9 +59,9 @@ bool LedKeyboard::listKeyboards() {
libusb_device *device = devs[i]; libusb_device *device = devs[i];
libusb_device_descriptor desc; libusb_device_descriptor desc;
libusb_get_device_descriptor(device, &desc); libusb_get_device_descriptor(device, &desc);
for (int i=0; i<(int)SuportedKeyboards.size(); i++) { for (int i=0; i<(int)SupportedKeyboards.size(); i++) {
if (desc.idVendor == SuportedKeyboards[i][0]) { if (desc.idVendor == SupportedKeyboards[i][0]) {
if (desc.idProduct == SuportedKeyboards[i][1]) { if (desc.idProduct == SupportedKeyboards[i][1]) {
cout<<"0x"<<std::hex<<desc.idVendor \ cout<<"0x"<<std::hex<<desc.idVendor \
<<" 0x"<<std::hex<<desc.idProduct<<endl; <<" 0x"<<std::hex<<desc.idProduct<<endl;
break; break;
@ -95,12 +95,12 @@ bool LedKeyboard::open() {
dev = devs; dev = devs;
m_keyboardModel = KeyboardModel::unknown; m_keyboardModel = KeyboardModel::unknown;
while (dev) { while (dev) {
for (int i=0; i<(int)SuportedKeyboards.size(); i++) { for (int i=0; i<(int)SupportedKeyboards.size(); i++) {
if (dev->vendor_id == SuportedKeyboards[i][0]) { if (dev->vendor_id == SupportedKeyboards[i][0]) {
if (dev->product_id == SuportedKeyboards[i][1]) { if (dev->product_id == SupportedKeyboards[i][1]) {
m_vendorID = dev->vendor_id; m_vendorID = dev->vendor_id;
m_productID = dev->product_id; m_productID = dev->product_id;
m_keyboardModel = (KeyboardModel)SuportedKeyboards[i][2]; m_keyboardModel = (KeyboardModel)SupportedKeyboards[i][2];
break; break;
} }
} }
@ -139,12 +139,12 @@ bool LedKeyboard::open() {
libusb_device *device = devs[i]; libusb_device *device = devs[i];
libusb_device_descriptor desc; libusb_device_descriptor desc;
libusb_get_device_descriptor(device, &desc); libusb_get_device_descriptor(device, &desc);
for (int i=0; i<(int)SuportedKeyboards.size(); i++) { for (int i=0; i<(int)SupportedKeyboards.size(); i++) {
if (desc.idVendor == SuportedKeyboards[i][0]) { if (desc.idVendor == SupportedKeyboards[i][0]) {
if (desc.idProduct == SuportedKeyboards[i][1]) { if (desc.idProduct == SupportedKeyboards[i][1]) {
m_vendorID = desc.idVendor; m_vendorID = desc.idVendor;
m_productID = desc.idProduct; m_productID = desc.idProduct;
m_keyboardModel = (KeyboardModel)SuportedKeyboards[i][2]; m_keyboardModel = (KeyboardModel)SupportedKeyboards[i][2];
break; break;
} }
} }

View File

@ -16,7 +16,7 @@ class LedKeyboard {
private: private:
const std::vector<std::vector<uint16_t>> SuportedKeyboards = { const std::vector<std::vector<uint16_t>> SupportedKeyboards = {
{ 0x46d, 0xc330, (u_int16_t)KeyboardModel::g410 }, { 0x46d, 0xc330, (u_int16_t)KeyboardModel::g410 },
{ 0x46d, 0xc333, (u_int16_t)KeyboardModel::g610 }, { 0x46d, 0xc333, (u_int16_t)KeyboardModel::g610 },
{ 0x46d, 0xc338, (u_int16_t)KeyboardModel::g610 }, { 0x46d, 0xc338, (u_int16_t)KeyboardModel::g610 },