Reading data-only from Wacom tablet

1.1k Views Asked by At

Is there any way to read data from Wacom tablet without raising mouse-events on Linux?

I'm now using Ubuntu 12.04 LTS and Wacom Intuos 5. It's OK to use the tablet on Ubuntu and I'm using tablet via Ggtkmm3.0. But I would like to get ONLY the tablet's axis data without binding to the window. Gtkmm's window can get tablet-event but I think it is not periodic because it's event-driven.

1

There are 1 best solutions below

0
Wataru On

Using Linux Input Subsystem will be available to take your task.

The code is here, this is print out cordinate (X, Y) and pressure. (for example, filename is lis_read.c)

#include <stdio.h>
#include <stdlib.h>
#include <linux/input.h>
#include <unistd.h>

int main (int argc, char *argv[]) {
    struct input_event event;

    for (;;) {
        if (read(0, &event, sizeof(event)) != sizeof(event)) {
            exit(EXIT_FAILURE);
        }

        switch(event.type) {
        case EV_ABS:
            switch (event.code) {
            case ABS_X:
                printf("ABS_X: %d\n", event.value);
                break;
            case ABS_Y:
                printf("ABS_Y: %d\n", event.value);
                break;
            case ABS_PRESSURE:
                printf("ABS_PRESSURE: %d\n", event.value);
                break;
            default:
                break;
            }
            break;
        }
    }

    return EXIT_SUCCESS;
}

You can build this:

% gcc -o lis_read lis_read.c

If your pentablet device path is /dev/input/event7, then this program usage is:

% ./lis_read < /dev/input/event7

Root permission will be needed this program.