Listing 14. Looping over Scancodes

int codes[2];

for (i=0; i<130; i++) {
    codes[0] = i;
    if(ioctl(fd, EVIOCGKEYCODE, codes)) {
        perror("evdev ioctl");
    }
    printf("[0]= %d, [1] = %d\n",
           codes[0], codes[1]);
}