-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmsi_keyboard.cpp
More file actions
39 lines (35 loc) · 881 Bytes
/
msi_keyboard.cpp
File metadata and controls
39 lines (35 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "msi_keyboard.h"
bool msi::setColor(hid_device *dev, msi::color c, msi::region r, msi::level l)
{
if (r == msi::all)
{
return setColor(dev,c,msi::right,l) &&
setColor(dev,c,msi::middle,l) &&
setColor(dev,c,msi::left,l);
}
unsigned char buffer[8] = {
1,
2,
66, // set
(unsigned char)r, // region (starting from 0 due to the extra region "all")
(unsigned char)c, // color (starting from 0)
(unsigned char)l, // level (starting from 0)
0,
236 // EOR (end of request)
};
return hid_send_feature_report(dev,buffer,8) == 8;
}
bool msi::setMode(hid_device *dev, msi::mode m)
{
unsigned char buffer[8] = {
1,
2,
65, // commit
(unsigned char)(m+1), // mode (starting from 1)
0,
0,
0,
236 // EOR (end of request)
};
return hid_send_feature_report(dev,buffer,8) == 8;
}