User manual
Linux Guide taskit GmbH
}
}
// inform the input driver about the new keyarray
if(ioctl(fd, PORTUXINPUT_IOC_SETKEYARRAY, &characters)) {
perror("Error changing keyarray!");
return 1;
}
// assign the keyarray to the keys on row 1
for(arrayNR = 0; arrayNR < PORTUX_MAX_KEYARRAYS; arrayNR++) {
map[0][0][arrayNR].flags = PORTUXINPUT_MASK_KEYARRAY;
map[0][0][arrayNR].value = arrayNR;
}
if(ioctl(fd, PORTUXMATRIX_IOC_SETKEYMAP, &map))
perror("Error changing keyarray!");
By default the keyarray function is configured to display a selected character after a
timeout or after pressing another key (PORTUXINPUT_KEYARRAY_MODE_BLIND).
But it is also possible to configure the keyarray function in that way that it delivers a
backspace before every keypress (except the first keypress) in order to delete the last
character (PORTUXINPUT_KEYARRAY_MODE_BACKSPACE).
Example 5: Changing the keyarray function mode from mode blind to mode backspace:
/* This sample can be found on the starter-kit cd:
/dev/cdrom/examples/input/matrixsample5.c */
int fd = open("/dev/portuxinput", O_RDWR);
if(ioctl(fd, PORTUXINPUT_IOC_SETKEYARRAYMODE, \
PORTUXINPUT_KEYARRAY_MODE_BACKSPACE))
perror("Error changing keyarray mode.");
9.4. Customizing the keymap of the infrared interface (optional)
To customize the keymap of the IR remote control you have to open the portuxinput device
( /dev/misc/portuxinput ), change the content of the keymap struct and write it to the input
device.
Every change in the keymap will be lost after the next reboot, so you have to include the
sourcecode for changing the keymap in your application or compile it as an extra tool that
is executed before you start you application.
The maximum number of IR-command codes is 256 (PORTUXIR_MAX_COMMANDCODES).
Example: Change all keymaps and assign the character 'a' to every key then assign the
function to switch the keymaps to the first key (0x0):
/* This sample can be found on the starterkit cd:
/dev/cdrom/examples/input/irsample1.c */
Page 32 of 65 Version 1.26 (2008-04-30)