10         if(key1[i] != key2[i])  
 
   30         perror(
"macro_pt_enqueue: ");
 
   36         pt_head = pt_tail = new_elem;       
 
   38         pt_tail->
next = new_elem;           
 
   52     if (pt_head == 0 && pt_tail == 0) {
 
   53         ckb_err(
"macro_pt_dequeue: called on empty list.\n");
 
   57     pt_head = pt_head->
next;
 
   58     if (pt_head == 0) pt_tail = 0;      
 
   86     pthread_mutex_lock(
mmutex2(kb));
 
   94     pthread_mutex_unlock(
mmutex2(kb));       
 
   97     pthread_mutex_lock(
mmutex(kb)); 
 
  104             pthread_mutex_unlock(
mmutex(kb));           
 
  105             if (action->
delay != UINT_MAX && action->
delay) {    
 
  106                 usleep(action->
delay);
 
  107             } 
else if (kb->
delay != UINT_MAX && kb->
delay) {     
 
  116             pthread_mutex_lock(
mmutex(kb));
 
  120     pthread_mutex_lock(
mmutex2(kb));    
 
  123     pthread_cond_broadcast(
mvar(kb));   
 
  124     pthread_mutex_unlock(
mmutex2(kb));  
 
  126     pthread_mutex_unlock(
mmutex(kb));   
 
  150                         perror(
"inputupdate_keys got no more mem:");
 
  152                         pthread_t thread = 0;
 
  154                         params->
macro = macro;
 
  155                         int retval = pthread_create(&thread, 0, 
play_macro, (
void*)params);
 
  157                             perror(
"inputupdate_keys: Creating thread returned not null");
 
  172     int modcount = 0, keycount = 0, rmodcount = 0;
 
  174         char oldb = input->
prevkeys[byte], newb = input->
keys[byte];
 
  177         for(
int bit = 0; bit < 8; bit++){
 
  178             int keyindex = byte * 8 + bit;
 
  183             char mask = 1 << bit;
 
  184             char old = oldb & mask, 
new = newb & mask;
 
  192                             for(
int i = keycount + rmodcount; i > 0; i--)
 
  193                                 events[modcount + i] = events[modcount + i - 1];
 
  196                             events[modcount++] = scancode + 1;
 
  199                             events[modcount + keycount + rmodcount++] = -(scancode + 1);
 
  203                         for(
int i = rmodcount; i > 0; i--)
 
  204                             events[modcount + keycount + i] = events[modcount + keycount + i - 1];
 
  205                         events[modcount + keycount++] = 
new ? (scancode + 1) : -(scancode + 1);
 
  207 #define IS_WHEEL(scan, kb)  (((scan) == KEY_VOLUMEUP || (scan) == KEY_VOLUMEDOWN || (scan) == BTN_WHEELUP || (scan) == BTN_WHEELDOWN) && !IS_K65(kb)) 
  209                             for(
int i = rmodcount; i > 0; i--)
 
  210                                 events[modcount + keycount + i] = events[modcount + keycount + i - 1];
 
  211                             events[modcount + keycount++] = -(scancode + 1);
 
  212                             input->
keys[byte] &= ~mask;
 
  218                     for(
int notify = 0; notify < 
OUTFIFO_MAX; notify++){
 
  219                         if(mode->
notify[notify][byte] & mask){
 
  233         int totalkeys = modcount + keycount + rmodcount;
 
  234         for(
int i = 0; i < totalkeys; i++){
 
  235             int scancode = events[i];
 
  236             os_keypress(kb, (scancode < 0 ? -scancode : scancode) - 1, scancode > 0);
 
  268         new = (
new & ~mode->
ioff) | mode->
ion;
 
  272     if(old != 
new || force){
 
  281     for(
unsigned i = 0; i < 
sizeof(indicators) / 
sizeof(
uchar); i++){
 
  282         uchar mask = indicators[i];
 
  283         if((hw_old & mask) == (hw_new & mask))
 
  285         for(
int notify = 0; notify < 
OUTFIFO_MAX; notify++){
 
  286             if(mode->
inotify[notify] & mask)
 
  287                 nprintind(kb, notify, mask, hw_new & mask);
 
  304     memset(bind, 0, 
sizeof(*bind));
 
  312     if(sscanf(to, 
"#x%ux", &tocode) != 1 && sscanf(to, 
"#%u", &tocode) == 1 && tocode < 
N_KEYS_INPUT){
 
  313         pthread_mutex_lock(
imutex(kb));
 
  315         pthread_mutex_unlock(
imutex(kb));
 
  321             pthread_mutex_lock(
imutex(kb));
 
  323             pthread_mutex_unlock(
imutex(kb));
 
  332     pthread_mutex_lock(
imutex(kb));
 
  334     pthread_mutex_unlock(
imutex(kb));
 
  340     pthread_mutex_lock(
imutex(kb));
 
  342     pthread_mutex_unlock(
imutex(kb));
 
  347     if(!keys && !assignment){
 
  358     memset(¯o, 0, 
sizeof(macro));
 
  361     int left = strlen(keys), right = strlen(assignment);
 
  362     int position = 0, field = 0;
 
  364     while(position < left && sscanf(keys + position, 
"%10[^+]%n", keyname, &field) == 1){
 
  366         if((sscanf(keyname, 
"#%d", &keycode) && keycode >= 0 && keycode < 
N_KEYS_INPUT)
 
  367                   || (sscanf(keyname, 
"#x%x", &keycode) && keycode >= 0 && keycode < 
N_KEYS_INPUT)){
 
  375                     macro.
combo[i / 8] |= 1 << (i % 8);
 
  381         if(keys[position += field] == 
'+')
 
  388     for(
const char* c = assignment; *c != 0; c++){
 
  399     while(position < right && sscanf(assignment + position, 
"%23[^,]%n", keyname, &field) == 1){
 
  400         if(!strcmp(keyname, 
"clear"))
 
  405         unsigned int delay = UINT_MAX; 
 
  406         char real_keyname[12];  
 
  407         int scan_matches = sscanf(keyname, 
"%11[^=]=%ld", real_keyname, &long_delay);
 
  408         if (scan_matches == 2) {
 
  409             if (0 <= long_delay && long_delay < UINT_MAX) {
 
  410                 delay = (
unsigned int)long_delay;
 
  411                 strcpy(keyname, real_keyname); 
 
  415         int down = (keyname[0] == 
'+');
 
  416         if(down || keyname[0] == 
'-'){
 
  418             if((sscanf(keyname + 1, 
"#%d", &keycode) && keycode >= 0 && keycode < 
N_KEYS_INPUT)
 
  419                       || (sscanf(keyname + 1, 
"#x%x", &keycode) && keycode >= 0 && keycode < 
N_KEYS_INPUT)){
 
  428                     if(
keymap[i].name && !strcmp(keyname + 1, 
keymap[i].name)){
 
  438         if(assignment[position += field] == 
',')
 
  446             free(macros[i].actions);
 
  450                     memcpy(macros + j - 1, macros + j, 
sizeof(
keymacro));
 
  454                 memcpy(macros + i, ¯o, 
sizeof(
keymacro));
 
  468     pthread_mutex_lock(
imutex(kb));
 
  470     pthread_mutex_unlock(
imutex(kb));
 
uchar notify[10][((((152+3+12)+25)+7)/8)]
#define DELAY_SHORT(kb)
USB delays for when the keyboards get picky about timing That was the original comment, but it is used anytime. The short delay is used before any send or receive. 
#define ckb_err(fmt, args...)
uchar keys[((((152+3+12)+25)+7)/8)]
#define SET_KEYBIT(array, index)
void nprintkey(usbdevice *kb, int nnumber, int keyindex, int down)
void nprintind(usbdevice *kb, int nnumber, int led, int on)
uchar combo[((((152+3+12)+25)+7)/8)]
uchar prevkeys[((((152+3+12)+25)+7)/8)]
const key keymap[(((152+3+12)+25)+11)]
void os_sendindicators(usbdevice *kb)
os_sendindicators update the indicators for the special keys (Numlock, Capslock and what else...
int base[((152+3+12)+25)]