Rubén wrote:
>         I'm giving Joystick support to GGL, and it's almost done, but I
> found a little problem. The joystick buttons are reported in a evKey event,
> so, the GGL keyboard device gets its own events and also the joystick
> ones...
>         I open the joystick by opening a gii_input_t of type "linux-joy",
> and then calling ggiJoinInputs with the ggi_visual_t and the new
> gii_input_t.
>         I know that I can access to event->any.origin to distingish between
> keyboard and joystick events, but how can I know which value is the keyboard
> one and which is the joystick one? In a few proofs that I've made the
> keyboard events had the 0100 value and the joystick the 0200, but I don't
> know if it is always this way.
>         Can anybody help me, please?

I mailed a test program for gii a while back to the list. This is a
little better than the gii test demo and shows two methods:

1. giiQueryDeviceInfo
2. giiQueryDeviceInfobyNumber

and then check the number of axes.
1 has the disadvantage that one already must have received/processed an

A little bit from the program:

        if (device_no > -1) {
                printf("giiQueryDeviceInfo returned: %d\n", giiQueryDeviceInfo(inp,
device_no, &devinfo));
                printf("%s (%s):\n  can generate: %x\n  num buttons: %x\n  num axes:
                           devinfo.longname, devinfo.shortname,
                           devinfo.num_buttons, devinfo.num_axes


Reply via email to