Daniel Laird schrieb:
> I have written a linux input driver for a front panel.
> We have mapped the front panel keys to BTN_0 -> BTN_9
> 
> When DirectFB linux_input module is used the get_device_info function does
> not seem to recognise these buttons.
> I looked into this function and there is this section:
>      if (test_bit( EV_KEY, evbit )) {
>           int i;
> 
>           /* get keyboard bits */
>           ioctl( fd, EVIOCGBIT(EV_KEY, KEY_MAX), keybit );
> 
>           /**  count typical keyboard keys only */
>           for (i=KEY_Q; i<KEY_M; i++)
>                if (test_bit( i, keybit ))
>                     num_keys++;
> 
>           for (i=KEY_OK; i<KEY_MAX; i++)
>                if (test_bit( i, keybit ))
>                     num_ext_keys++;
> 
>           for (i=BTN_MOUSE; i<BTN_JOYSTICK; i++)
>                if (test_bit( i, keybit ))
>                     num_buttons++;
>      }
> 
> The code obviously does not look for the complete range of BTN
> events(input.h in linux kernel).  If I change the last section to read
>           for (i=BTN_MISC; i<BTN_GEAR_UP; i++)
>                if (test_bit( i, keybit ))
>                     num_buttons++;
> 
> Then the complete rane of buttons are recognised.
> 
> Am I doing the correct thing?  It there any reason why this could not be
> patched for DFB-1.0.  If not i will submit a patch

It's not that easy. The event translation uses the BTN_MOUSE offset
to have the mouse buttons start at 0 = DIBI_LEFT. Up to 32 buttons
are supported. With this change the event translation would still
work for normal mice, but for your panel negative values will appear.
Making the event translation use BTN_MISC as the offset would break
DIBI_LEFT etc. for normal mice. The full button range is 82 buttons
which would also break :)

A way to fix it might be to detect in which of the button group
the device operates, i.e. BTN_MOUSE, BTN_JOYSTICK, BTN_GAMEPAD,
BTN_DIGI and BTN_WHEEL. Using that as the offset in translation.
Not sure about devices operating in more than one group.

-- 
Best regards,
   Denis Oliver Kropp

.------------------------------------------.
| DirectFB - Hardware accelerated graphics |
| http://www.directfb.org/                 |
"------------------------------------------"

_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to