59 #define TRY_WITH_RESET(action) \
61 if(usb_tryreset(kb)){ \
69 char* word = malloc(strlen(line) + 1);
71 const char* newline = 0;
78 while(sscanf(line,
"%s%n", word, &wordlen) == 1){
85 newline = strchr(line,
'\n');
87 newline = line + strlen(line);
111 if(sscanf(word,
"@%u", &newnotify) == 1 && newnotify <
OUTFIFO_MAX){
112 notifynumber = newnotify;
132 if(sscanf(word,
"%u", ¬ify) == 1)
138 if(sscanf(word,
"%u", ¬ify) == 1 && notify != 0)
143 vt->get(kb, mode, notifynumber, 0, word);
147 if(!strcmp(word,
"ansi"))
149 else if(!strcmp(word,
"iso"))
155 if(!strcmp(word,
"on"))
157 else if(!strcmp(word,
"off"))
162 if(sscanf(word,
"%d", &newscroll) != 1)
168 kb->scroll_rate = newscroll;
175 if(sscanf(word,
"%u", &newmode) == 1 && newmode > 0 && newmode <=
MODE_COUNT)
176 mode = profile->
mode + newmode - 1;
182 if(sscanf(word,
"%u", &framerate) == 1 && framerate > 0){
185 uint delay = 1000 / framerate / per_frame;
197 if(sscanf(word,
"%u", &dither) == 1 && dither <= 1){
206 if(sscanf(word,
"%ld", &delay) == 1 && 0 <= delay && delay < UINT_MAX) {
208 kb->
delay = (
unsigned int)delay;
209 }
else if(strcmp(word,
"on") == 0) {
211 kb->
delay = UINT_MAX;
219 char mybuffer[] =
"no reason specified";
220 if (sscanf(line,
" %[^\n]", word) == -1) {
223 vt->
do_cmd[command](kb, mode, notifynumber, 0, word);
245 vt->setmodeindex(kb, index);
262 if(vt->fwupdate(kb, mode, notifynumber, 0, word)){
269 if(sscanf(word,
"%u", &rate) == 1 && (rate == 1 || rate == 2 || rate == 4 || rate == 8))
275 vt->eraseprofile(kb, mode, notifynumber, 0, 0);
282 vt->
do_cmd[command](kb, mode, notifynumber, 0, word);
287 if(sscanf(word,
"%02x%02x%02x", &r, &g, &b) == 3){
290 vt->rgb(kb, mode, notifynumber, i, word);
296 if(!strcmp(word,
"clear")){
298 vt->macro(kb, mode, notifynumber, 0, 0);
306 sscanf(word,
"%*[^:]%n", &left);
313 if(command ==
MACRO || command ==
DPI){
319 int position = 0, field = 0;
321 while(position < left && sscanf(word + position,
"%10[^:,]%n", keyname, &field) == 1){
323 if(!strcmp(keyname,
"all")){
326 vt->
do_cmd[command](kb, mode, notifynumber, i, right);
327 }
else if((sscanf(keyname,
"#%d", &keycode) && keycode >= 0 && keycode <
N_KEYS_EXTENDED)
328 || (sscanf(keyname,
"#x%x", &keycode) && keycode >= 0 && keycode <
N_KEYS_EXTENDED)){
330 vt->
do_cmd[command](kb, mode, notifynumber, keycode,
right);
335 vt->
do_cmd[command](kb, mode, notifynumber, i,
right);
340 if(word[position += field] ==
',')
#define IS_FULLRANGE(kb)
Full color range (16.8M) vs partial color range (512)
int readcmd(usbdevice *kb, const char *line)
const key keymap[(((152+22+12)+25)+12)]
#define SCROLL_ACCELERATED
cmdhandler do_cmd[(CMD_LAST-CMD_VT_FIRST+1)]
cmdhandler_mac do_macro[(CMD_LAST-CMD_VT_FIRST+1)]
#define INDEX_OF(entry, array)
#define NEEDS_FW_UPDATE(kb)
cmdhandler_io do_io[(CMD_LAST-CMD_VT_FIRST+1)]
const union devcmd * vtable
#define IS_MOUSE_DEV(kb)
For calling with a usbdevice*, vendor and product are extracted and IS_MOUSE() is returned...
#define HAS_FEATURES(kb, feat)
Definitions for using USB interface.
int rmnotifynode(usbdevice *kb, int notify)
Removes a notification node for the specified keyboard.
static const char *const cmd_strings[(CMD_LAST-CMD_FIRST+2)-1]
int mknotifynode(usbdevice *kb, int notify)
Creates a notification node for the specified keyboard.
#define TRY_WITH_RESET(action)