Hi Brant,

Though your problem should be looked and fixed, it is different from this one since the generic input device support is not implemented on windows yet.

Plus, it does nothing on any platform unless you make a configuration file for your device under $FG_ROOT/input/event/<Some Vendor>/<Some product>.xml.

Thus this problem doesn't affect the existing joystick feature.

Btw, is any one kindly enough to implement this feature on windows?

Tat


On 2009/09/15, at 8:30, Brant G <ioncannon21...@gmail.com> wrote:

Indeed. I have a X52 joystick and it's very confusing to configure in the joystick .xml file. When I updated to CVS recently, the hats buttons don't work properly in windows. This should be looked at and fixed.

On Mon, Sep 14, 2009 at 6:45 PM, Tatsuhiro Nishioka <tat.fgmac...@gmail.com > wrote:
Hi,

I've been testing X52 joystick with FGLinuxEventInput.cxx on liunx and found that button event names for joysticks/gamepad are very suspicious, and we need to consider some other means of naming button events.

The problem is that a joystick (, mouse or gamepad) button can have wrong event name if a device has more than 16 buttons. This is because Linux hid driver (drivers/hid/hid-input.c) assumes that a device has 16 buttons at most. e.g. If a joystick has more than 16 buttons, a button event name for button-#16 or higher are mistakenly assigned to ones in game pads, digitizer, or others. This is the excerpt from hid-input.c ( hidinput_configure_usage) that shows how Linux driver converts HID usage to a code of hid event written to /dev/input/js*

                case HID_UP_BUTTON:
code = ((usage->hid - 1) & 0xf); // Note: assuming #buttons <= 16.
                        switch (field->application) {
                                case HID_GD_MOUSE:
case HID_GD_POINTER: code += 0x110; break; case HID_GD_JOYSTICK: code += 0x120; break; case HID_GD_GAMEPAD: code += 0x130; break;
                                default:
                                        switch (field->physical) {
                                                case HID_GD_MOUSE:
case HID_GD_POINTER: code += 0x110; break; case HID_GD_JOYSTICK: code += 0x120; break; case HID_GD_GAMEPAD: code += 0x130; break; default: code += 0x100;
                                        }
                        }
                        map_key(code);
                        break;


As a matter of fact, event names for X52 buttons are assigned as follows in FGLinuxEventInput.cxx:

#00 button-trigger:         type=1, code=288 (trigger)
#01 button-thumb:           type=1, code=289 (FIRE button on stick)
#02 button-thumb2:          type=1, code=290 (A button on stick)
#03 button-top:             type=1, code=291 (B button on stick)
#04 button-top2:            type=1, code=292 (C button on stick)
#05 button-pinkie:          type=1, code=293 (pinkie button)
#06 button-base:            type=1, code=294 (D button on throttle)
#07 button-base2:           type=1, code=295 (E button on throttle)
#08 button-base3:           type=1, code=296 (T1)
#09 button-base4:           type=1, code=297 (T2)
#10 button-base5:           type=1, code=298 (T3)
#11 button-base6:           type=1, code=299 (T4)
#12 button-300:             type=1, code=300 (T5)
#13 button-301:             type=1, code=301 (T6)
#14 button-302:             type=1, code=302 (strong press of trigger)
#15 button-dead:            type=1, code=303 (top hat up)

// buttons below are mistakenly assigned to GamePad buttons
#16 button-a:               type=1, code=304 (top hat right)
#17 button-b:               type=1, code=305 (top hat down)
#18 button-c:               type=1, code=306 (top hat left)
#19 button-x:               type=1, code=307 (hat up on throttle)
#20 button-y:               type=1, code=308 (hat right on throttle)
#21 button-z:               type=1, code=309 (hat down on throttle)
#22 button-tl:              type=1, code=310 (hat left on throttle)
#23 button-tr:              type=1, code=311 (mode1 on stick)
#24 button-tl2:             type=1, code=312 (mode2 on stick)
#25 button-tr2:             type=1, code=313 (mode3 on stick)
#26 button-select: type=1, code=314 (Function button on throttle) #27 button-start: type=1, code=315 (Start button on throttle) #28 button-mode: type=1, code=316 (RESET button on throttle)
#29 button-thumbl:          type=1, code=317 (i button on throttle)
#30 button-thumbr: type=1, code=318 (mouse button on throttle) #31 button-319: type=1, code=319 (wheel button on throttle) // undefined in input.h

// buttons below are mistakenly assigned to Digitizer buttons
#32 button-pen:             type=1, code=320 (wheel down on throttle)
#33 button-rubber: type=1, code=321 (wheel up on throttle)

This shows that button #16 or higher have wrong event names that are not compatible with Mac or Windows.
# button-dead for top-hat up button is also weird.
I don't know why linux driver assumes the button number is less than 16, but this is a big problem.

I guess it is safer to use button-0, button-1, ... button-N for button event names so the names stays the same on different OSs. maybe we need to pull out some info using ioctl to find the first hid event code for a given device (e.g. 228 for joystick).

Best,

Tat


--- --- --- ---------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


--
Brant Gipson
--- --- --- ---------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel
------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to