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

Merge branch 'develop' into daemon

This commit is contained in:
MatMoul 2017-05-21 00:38:34 +02:00
commit c5938507e0
3 changed files with 34 additions and 3 deletions

View File

@ -18,7 +18,7 @@ includedir?=$(prefix)/include
PROGN=g810-led PROGN=g810-led
MAJOR=0 MAJOR=0
MINOR=2 MINOR=2
MICRO=3 MICRO=5
CFLAGS+=-DVERSION=\"$(MAJOR).$(MINOR).$(MICRO)\" CFLAGS+=-DVERSION=\"$(MAJOR).$(MINOR).$(MICRO)\"
APPSRCS=src/main.cpp src/helpers/*.cpp src/helpers/*.h APPSRCS=src/main.cpp src/helpers/*.cpp src/helpers/*.h

28
sample_profiles/colors Normal file
View File

@ -0,0 +1,28 @@
# Sample profile using Groups of Keys and Single Characters.
g logo 000096 # Blue
g indicators ffffff # White
g multimedia 009600 # Green
g fkeys ff7700 # Orange
g modifiers ff7700 # Orange
g arrows 0000ff # Red
g numeric 00ff00 # Green
g functions ffffff # White
g keys ff00ff # Purple
g gkeys ffffff # White
k tilde ff0000 # Red
k W 0000ff # Blue {
k A 0000ff
k S 0000ff
k D 0000ff # }
k 1 ff0000 # Red {
k 2 ff0000
k 3 ff0000
k 4 ff0000
k 5 ff0000
k 6 ff0000
k 7 ff0000
k 8 ff0000
k 9 ff0000
k 0 ff0000 # }
c # Commit changes

View File

@ -781,20 +781,23 @@ bool LedKeyboard::setNativeEffect(NativeEffect effect, NativeEffectPart part, ui
bool LedKeyboard::sendDataInternal(byte_buffer_t &data) { bool LedKeyboard::sendDataInternal(byte_buffer_t &data) {
if (! m_isOpen) return false;
if (data.size() > 0) { if (data.size() > 0) {
#if defined(hidapi) #if defined(hidapi)
if (! open()) return false;
data.insert(data.begin(), 0x00); data.insert(data.begin(), 0x00);
if (hid_write(m_hidHandle, const_cast<unsigned char*>(data.data()), data.size()) < 0) { if (hid_write(m_hidHandle, const_cast<unsigned char*>(data.data()), data.size()) < 0) {
std::cout<<"Error: Can not write to hidraw, try with the libusb version"<<std::endl; std::cout<<"Error: Can not write to hidraw, try with the libusb version"<<std::endl;
return false; return false;
} }
close();
/*
byte_buffer_t data2; byte_buffer_t data2;
data2.resize(21, 0x00); data2.resize(21, 0x00);
hid_read_timeout(m_hidHandle, const_cast<unsigned char*>(data2.data()), data2.size(), 1); hid_read_timeout(m_hidHandle, const_cast<unsigned char*>(data2.data()), data2.size(), 1);
*/
return true; return true;
#elif defined(libusb) #elif defined(libusb)
if (! m_isOpen) return false;
if (data.size() > 20) { if (data.size() > 20) {
if(libusb_control_transfer(m_hidHandle, 0x21, 0x09, 0x0212, 1, if(libusb_control_transfer(m_hidHandle, 0x21, 0x09, 0x0212, 1,
const_cast<unsigned char*>(data.data()), data.size(), 2000) < 0) const_cast<unsigned char*>(data.data()), data.size(), 2000) < 0)