This patch allows the throttle and rudder usages to be accurately mapped. 
In this way they can be distinguished from the general axes on a joystick.  
The patch also fixes the number of axes bug on the Saitek Cyborg 3D Rumble
Joystick (PID 0xFF52), by ignoring the vendor specific usages reported by 
this device.

I have taken out the map_led(LED_MISC) part from the default: label.  I 
assume that any real LED's will be caught by the HID_UP_LED: label.  All 
unknown output usages are also ignored with this patch.

Admittedly, there are other usages that can and should be included in the 
hidinput_configure_usage function.  I have only added those usages 
relevant for the Saitek Cyborg.  If a more complete patch is required make it
known.

Signed-off-by: Nadav Frum <[EMAIL PROTECTED]>

-- 
--- linux-2.6.13/drivers/usb/input/hid-input.c.usage    2005-08-29 
02:41:01.000000000 +0300
+++ linux-2.6.13/drivers/usb/input/hid-input.c  2005-10-18 15:36:31.000000000 
+0200
@@ -323,21 +323,34 @@
                        }
                        break;
 
+               case HID_UP_SIMULATION:
+
+                       switch (usage->hid) {
+                               case HID_SIM_RUDDER:
+                                       map_abs(ABS_RUDDER);
+                                       break;
+                               case HID_SIM_THROTTLE:
+                                       map_abs(ABS_THROTTLE);
+                                       break;
+                               default:
+                                       if (field->flags & 
HID_MAIN_ITEM_RELATIVE)
+                                               map_rel(REL_MISC);
+                                       else
+                                               map_abs(ABS_MISC);
+                                       break;
+                       }
+                       break;
+
                default:
                unknown:
-                       if (field->report_size == 1) {
-                               if (field->report->type == HID_OUTPUT_REPORT) {
-                                       map_led(LED_MISC);
-                                       break;
-                               }
+                       if (field->report->type != HID_INPUT_REPORT)
+                               goto ignore;
+                       if (field->report_size == 1)
                                map_key(BTN_MISC);
-                               break;
-                       }
-                       if (field->flags & HID_MAIN_ITEM_RELATIVE) {
+                       else if (field->flags & HID_MAIN_ITEM_RELATIVE)
                                map_rel(REL_MISC);
-                               break;
-                       }
-                       map_abs(ABS_MISC);
+                       else
+                               map_abs(ABS_MISC);
                        break;
        }
 
--- linux-2.6.13/drivers/usb/input/hid.h.usage  2005-08-29 02:41:01.000000000 
+0300
+++ linux-2.6.13/drivers/usb/input/hid.h        2005-09-29 15:59:52.000000000 
+0300
@@ -173,6 +173,7 @@
 
 #define HID_UP_UNDEFINED       0x00000000
 #define HID_UP_GENDESK         0x00010000
+#define HID_UP_SIMULATION      0x00020000
 #define HID_UP_KEYBOARD                0x00070000
 #define HID_UP_LED             0x00080000
 #define HID_UP_BUTTON          0x00090000
@@ -220,6 +221,9 @@
 #define HID_GD_RIGHT           0x00010092
 #define HID_GD_LEFT            0x00010093
 
+#define HID_SIM_RUDDER         0x000200ba
+#define HID_SIM_THROTTLE       0x000200bb
+
 /*
  * HID report types --- Ouch! HID spec says 1 2 3!
  */



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to