14 if (sscanf(code,
"%2hhx",&sideshine))
20 if(sscanf(code,
"%2hhx%2hhx%2hhx", &r, &g, &b) == 3){
30 if(!strncmp(led,
"num", 3) || strstr(led,
",num"))
32 if(!strncmp(led,
"caps", 4) || strstr(led,
",caps"))
34 if(!strncmp(led,
"scroll", 6) || strstr(led,
",scroll"))
36 if(!strncmp(led,
"all", 3) || strstr(led,
",all"))
49 kb->
vtable->updateindicators(kb, 0);
60 kb->
vtable->updateindicators(kb, 0);
71 kb->
vtable->updateindicators(kb, 0);
79 if(strstr(led,
":off"))
81 mode->
inotify[nnumber] &= ~bits;
97 if(strstr(name,
"dpi") == name || !strcmp(name,
"front") || !strcmp(name,
"back"))
102 if(strstr(name,
"dpi") == name || !strcmp(name,
"front") || !strcmp(name,
"back") || !strcmp(name,
"wheel") || !strcmp(name,
"thumb"))
105 if(!
IS_K95(kb) && ((name[0] ==
'g' && name[1] >=
'1' && name[1] <=
'9') || (name[0] ==
'm' && (name[1] ==
'r' || name[1] ==
'1' || name[1] ==
'2' || name[1] ==
'3'))))
108 if((!
IS_K65(kb) && !
IS_K63(kb)) && (!strcmp(name,
"volup") || !strcmp(name,
"voldn")))
111 if(
IS_K65(kb) && (strstr(name,
"num") == name || !strcmp(name,
"stop") || !strcmp(name,
"prev") || !strcmp(name,
"play") || !strcmp(name,
"next")))
114 if(
IS_K63(kb) && strstr(name,
"num") == name)
122 const uchar* mr = light->
r;
123 const uchar* mg = light->
g;
124 const uchar* mb = light->
b;
141 strncpy(names[i], name, 11);
148 if(r[i] != r[0] || g[i] != g[0] || b[i] != b[0]){
155 char* buffer = malloc(7);
156 snprintf(buffer, 7,
"%02x%02x%02x", r[0], g[0], b[0]);
159 const int BUFFER_LEN = 4096;
160 char* buffer = malloc(BUFFER_LEN);
167 snprintf(buffer + length, BUFFER_LEN - length, length == 0 ?
"%s%n" :
" %s%n", names[i], &newlen);
170 uchar kr = r[i], kg = g[i], kb = b[i];
174 if(r[j] != kr || g[j] != kg || b[j] != kb)
176 snprintf(buffer + length, BUFFER_LEN - length,
",%s%n", names[j], &newlen);
182 snprintf(buffer + length, BUFFER_LEN - length,
":%02x%02x%02x%n", kr, kg, kb, &newlen);
void cmd_ioff(usbdevice *kb, usbmode *mode, int dummy1, int dummy2, const char *led)
static int has_key(const char *name, const usbdevice *kb)
const key keymap[(((152+22+12)+25)+12)]
void cmd_rgb(usbdevice *kb, usbmode *mode, int dummy, int keyindex, const char *code)
void cmd_inotify(usbdevice *kb, usbmode *mode, int nnumber, int dummy, const char *led)
#define IS_MOUSE(vendor, product)
Mouse vs keyboard test.
const union devcmd * vtable
char * printrgb(const lighting *light, const usbdevice *kb)
Definitions for using USB interface.
static uchar iselect(const char *led)
void cmd_iauto(usbdevice *kb, usbmode *mode, int dummy1, int dummy2, const char *led)
void cmd_ion(usbdevice *kb, usbmode *mode, int dummy1, int dummy2, const char *led)