Advertisement
Guest User

Small C code to analyze Linux kernel input events

a guest
Mar 2nd, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1. #include <linux/input.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. int main(int argc, char **argv) {
  6.  
  7.     FILE *fin;
  8.     struct input_event ie;
  9.     int i;
  10.    
  11.     fin = fopen ("dump.bin", "rb");
  12.    
  13.     while (fread(&ie, sizeof(struct input_event), 1, fin)) {
  14.    
  15.         printf ("Time: %d\tType: %d - Code: %d - Value: %d\n", (int)ie.time.tv_sec, ie.type, ie.code, ie.value);
  16.    
  17.     }
  18.    
  19.     fclose(fin);
  20.    
  21.     return 0;  
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement