16 if((fifo = kb->
outfifo[nodenumber] - 1) != -1){
17 va_start(va_args, format);
19 dprintf(fifo,
"mode %d ",
INDEX_OF(mode, profile->
mode) + 1);
20 vdprintf(fifo, format, va_args);
26 if((fifo = kb->
outfifo[i] - 1) != -1){
27 va_start(va_args, format);
29 dprintf(fifo,
"mode %d ",
INDEX_OF(mode, profile->
mode) + 1);
30 vdprintf(fifo, format, va_args);
38 nprintf(kb, nnumber, 0,
"key %c%s\n", down ?
'+' :
'-', map->
name);
40 nprintf(kb, nnumber, 0,
"key %c#%d\n", down ?
'+' :
'-', keyindex);
58 nprintf(kb, nnumber, 0,
"i %c%s\n", on ?
'+' :
'-', name);
64 pthread_mutex_lock(
imutex(kb));
65 if(!strcmp(toggle,
"on") || *toggle == 0)
67 else if(!strcmp(toggle,
"off"))
69 pthread_mutex_unlock(
imutex(kb));
73 #define HWMODE_OR_RETURN(kb, index) \
75 if((index) >= HWMODE_K95) \
78 if((index) >= HWMODE_K70) \
86 unsigned index = INDEX_OF(mode, profile->mode); \
88 HWMODE_OR_RETURN(kb, index)
92 if(!strcmp(setting,
":mode")){
94 nprintf(kb, nnumber, mode,
"switch\n");
96 }
else if(!strcmp(setting,
":rgb")){
99 nprintf(kb, nnumber, mode,
"rgb %s\n", rgb);
102 }
else if(!strcmp(setting,
":hwrgb")){
106 nprintf(kb, nnumber, mode,
"hwrgb %s\n", rgb);
109 }
else if(!strcmp(setting,
":profilename")){
112 nprintf(kb, nnumber, 0,
"profilename %s\n", name[0] ? name :
"Unnamed");
114 }
else if(!strcmp(setting,
":name")){
117 nprintf(kb, nnumber, mode,
"name %s\n", name[0] ? name :
"Unnamed");
119 }
else if(!strcmp(setting,
":hwprofilename")){
124 nprintf(kb, nnumber, 0,
"hwprofilename %s\n", name[0] ? name :
"Unnamed");
126 }
else if(!strcmp(setting,
":hwname")){
130 nprintf(kb, nnumber, mode,
"hwname %s\n", name[0] ? name :
"Unnamed");
132 }
else if(!strcmp(setting,
":profileid")){
134 char* guid =
getid(&profile->
id);
136 memcpy(&modified, &profile->
id.
modified,
sizeof(modified));
137 nprintf(kb, nnumber, 0,
"profileid %s %x\n", guid, modified);
139 }
else if(!strcmp(setting,
":id")){
143 memcpy(&modified, &mode->
id.
modified,
sizeof(modified));
144 nprintf(kb, nnumber, mode,
"id %s %x\n", guid, modified);
146 }
else if(!strcmp(setting,
":hwprofileid")){
152 memcpy(&modified, &kb->
hw->
id[0].
modified,
sizeof(modified));
153 nprintf(kb, nnumber, 0,
"hwprofileid %s %x\n", guid, modified);
155 }
else if(!strcmp(setting,
":hwid")){
158 char* guid =
getid(&kb->
hw->
id[index + 1]);
160 memcpy(&modified, &kb->
hw->
id[index + 1].
modified,
sizeof(modified));
161 nprintf(kb, nnumber, mode,
"hwid %s %x\n", guid, modified);
163 }
else if(!strcmp(setting,
":keys")){
168 int byte = i / 8, bit = 1 << (i & 7);
173 }
else if(!strcmp(setting,
":i")){
178 }
else if(!strcmp(setting,
":dpi")){
181 nprintf(kb, nnumber, mode,
"dpi %s\n", dpi);
184 }
else if(!strcmp(setting,
":hwdpi")){
188 nprintf(kb, nnumber, mode,
"hwdpi %s\n", dpi);
191 }
else if(!strcmp(setting,
":dpisel")){
194 }
else if(!strcmp(setting,
":hwdpisel")){
198 }
else if(!strcmp(setting,
":lift")){
201 }
else if(!strcmp(setting,
":hwlift")){
205 }
else if(!strcmp(setting,
":snap")){
207 nprintf(kb, nnumber, mode,
"snap %s\n", mode->
dpi.
snap ?
"on" :
"off");
208 }
else if(!strcmp(setting,
":hwsnap")){
211 nprintf(kb, nnumber, mode,
"hwsnap %s\n", kb->
hw->
dpi[index].
snap ?
"on" :
"off");
218 pthread_mutex_lock(
imutex(kb));
219 _cmd_get(kb, mode, nnumber, setting);
220 pthread_mutex_unlock(
imutex(kb));
230 ckb_info(
"RESTART called with %s\n", content);
231 nprintf(kb, -1, 0,
"RESTART called with %s\n", content);
void nprintf(usbdevice *kb, int nodenumber, usbmode *mode, const char *format,...)
char * getprofilename(usbprofile *profile)
#define CLEAR_KEYBIT(array, index)
char * getmodename(usbmode *mode)
const key keymap[(((152+22+12)+25)+12)]
static void _cmd_get(usbdevice *kb, usbmode *mode, int nnumber, const char *setting)
char * gethwprofilename(hwprofile *profile)
#define SET_KEYBIT(array, index)
char * gethwmodename(hwprofile *profile, int index)
void nprintkey(usbdevice *kb, int nnumber, int keyindex, int down)
void nprintind(usbdevice *kb, int nnumber, int led, int on)
void cmd_notify(usbdevice *kb, usbmode *mode, int nnumber, int keyindex, const char *toggle)
#define ckb_info(fmt, args...)
#define INDEX_OF(entry, array)
void cmd_get(usbdevice *kb, usbmode *mode, int nnumber, int dummy, const char *setting)
char * printrgb(const lighting *light, const usbdevice *kb)
void cmd_restart(usbdevice *kb, usbmode *mode, int nnumber, int dummy, const char *content)
uchar notify[10][((((152+22+12)+25)+7)/8)]
char * printdpi(const dpiset *dpi, const usbdevice *kb)
uchar keys[((((152+22+12)+25)+7)/8)]