User manual
Linux Guide taskit GmbH
.value = {
.flags = 0,
.value = KEY_B // assign key 'b' (small b)
}
};
if(ioctl(fd, PORTUXMATRIX_IOC_SETKEY, &entry))
perror("Error changing key!");
return 0;
}
Compiling: arm-linux-3.4.2-gcc -Wall matrixsample1.c -o matrixsample1
Example 2: To change the whole keymap and assign the key '(' (shifted '9') to every key
you have to code:
/* This sample can be found on the starter-kit cd:
/dev/cdrom/examples/input/matrixsample2.c */
...
matrixmap map;
int x, y;
int fd = open("/dev/portuxinput", O_RDWR);
for(x = 0; x < PORTUXMATRIX_MAX_X; x++)
for(y = 0; y < PORTUXMATRIX_MAX_Y; y++) {
// assign a shifted '9' -> '(' to the key
map[0][y][x].flags = PORTUXINPUT_MASK_LSHIFT;
map[0][y][x].value = KEY_9;
}
if(ioctl(fd, PORTUXMATRIX_IOC_SETKEYMAP, &map))
perror("Error changing keymap!");
Example 3: Change all keymaps(layer) and assign the character 'A' to every key of the first
layer and 'B' to the second layer then assign the function for switching the
keymaps to the first key (0x0) on every layer:
/* This sample can be found on the starter-kit cd:
/dev/cdrom/examples/input/matrixsample3.c */
...
matrixmap map;
int x, y, layer;
int fd = open("/dev/portuxinput", O_RDWR);
// create 2 keymaps
// PORTUXMATRIX_MAX_LAYER = 2; defined in portuxinput.h
for(layer = 0; layer < PORTUXNIPUT_MAX_LAYER; layer++) {
for(x = 0; x < PORTUXMATRIX_MAX_X; x++) {
Page 30 of 65 Version 1.26 (2008-04-30)