User manual
Linux Guide taskit GmbH
irmap map;
int IRcmd, mapNR;
int fd = open("/dev/portuxinput", O_RDWR);
// create the keymaps
for(mapNR = 0; mapNR < PORTUXIR_MAX_LAYER; mapNR++) {
// assign key 'a' to every key of the ir controller
for(IRcmd = 0; IRcmd < PORTUXIR_MAX_COMMANDCODES; IRcmd++)
map[mapNR][IRcmd].flags = 0; // no modifier
map[mapNR][IRcmd].value = KEY_A; // 'a'
}
// assign the key for switching the keymap to the first key
map[mapNR][0].flags = PORTUXINPUT_MASK_SETKEYMAP;
if(mapNR < PORTUXIR_MAX_LAYER – 1)
// switch to next keymap
map[mapNR][0].value = mapNR + 1;
else
// the key of the last keymap switches to the first
map[mapNR][0].value = 0;
}
if(ioctl(fd, PORTUXIR_IOC_SETKEYMAP, &map))
perror("Error changing keymap!");
9.5. Getting the input
If you are using the Nano-X Window System or Trolltechs Qtopia Core the PS/2
keyboard, the matrix keyboard and the IR remote controller will be detected as input
device automatically. If you are not using libraries that automatically detect these input
devices, you will have to by-pass the them as STDIN to your application to get the input:
./yourApplication < /dev/tty1
Now you can use the getchar or scanf function to read the input:
/* This sample can be found on the starter-kit cd:
/dev/cdrom/examples/input/inputsample1.c */
char c;
printf("\nPlease press any key and confirm with enter (OKAY):");
c = getchar();
printf("\nInput:%c = %i\n", c, (int)c);
Note: To confirm the input it is necessary to press ENTER / RETURN on linux, so it is
required to have assigned a key with that function. On the matrix keyboard by default the
green key: OKAY is assigned to that function.
9.6. Using the touchscreen
Page 33 of 65 Version 1.26 (2008-04-30)