I have something of an unusual situation. I'm writing STB joystick code, but the STB kernel doesn't have support for the /dev/input/jsN device. The device is still represented through the /dev/input/eventN interface, but DirectFB doesn't pick it up as a joystick (it picks up axes but not buttons).
I've found where I can trick the directfb code into scanning for more buttons from the generic eventN device, and if I just change it there, the device does register in directfb as a joystick. The problem is, I'm unsure of the ramifications of the change. The other problem is, I don't know if it's feasible for my client to get a patched directfb installed on every device that's going to use their application. It may be feasible, but I'd like to see if there's a solution (even if it's an ugly hack solution, I mean it) that I could apply in my application that would feed directfb the right info to detect this eventN device as a joystick. Ok, so to the details. In inputdrivers/linux_input/linux_input.c:get_device_info(), line 976: http://git.directfb.org/?p=core/DirectFB.git;a=blob;f=inputdrivers/linux_input/linux_input.c;hb=d63edceff38d3ba40dad7588faf04b83f689c632#l976 976 for (i=BTN_MOUSE; i<BTN_JOYSTICK; i++) 977 if (test_bit( i, keybit )) 978 num_buttons++; BTN_MOUSE and BTN_JOYSTICK are #defined in <linux/input.h>, #define BTN_MOUSE 0x110 #define BTN_JOYSTICK 0x120 So, for these eventN devices, the only button values that are checked by directfb are mouse buttons (and keyboard buttons, just before this for loop). If I scan a broader range of constants, in this case BTN_JOYSTICK through KEY_MAX, num_buttons is incremented and code on line 1021 triggers and the device comes up as a joystick: http://git.directfb.org/?p=core/DirectFB.git;a=blob;f=inputdrivers/linux_input/linux_input.c;hb=d63edceff38d3ba40dad7588faf04b83f689c632#l1021 1021 else if (num_abs && num_buttons) /* Or a Joystick? */ 1022 info->desc.type |= DIDTF_JOYSTICK; Scanning to KEY_MAX is probably excessive, but examples that use the linux event device support the ioctl to KEY_MAX. Maybe just scanning through all the BTN_* to KEY_OK would be better. Now I get this: Input (02) WiseGroup.,Ltd MP-8866 Dual USB (primary joystick) Type: JOYSTICK Caps: AXES BUTTONS Max. Axis: 5 Max. Button: 11 instead of: Input (14) WiseGroup.,Ltd MP-8866 Dual USB Type: Caps: AXES Max. Axis: 5 I have a few questions about this. Assuming that I can't apply the linux joystick kernel module, and that I can't supply patched directfb libraries to all of the stb users(which I don't know), is there some way I could trick get_device_info() from my own application code to scan for more buttons on the linux input event devices? Does scanning a wider range of IDs jeopardize the mouse detection routines or anything else? I'm not able to get button state info from IDirectFBInputDevice->GetButtons(), and I strongly suspect it's because the button mask isn't getting populated from this new range of buttons. Is there a good way to manage this with minimal changes? Is this even the right way to approach this situation? Thank you, -b
_______________________________________________ directfb-dev mailing list directfb-dev@directfb.org http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev