diff options
author | Anssi Hannula <anssi.hannula@gmail.com> | 2006-07-19 01:40:47 -0400 |
---|---|---|
committer | Dmitry Torokhov <dtor@insightbb.com> | 2006-07-19 01:40:47 -0400 |
commit | 224ee88fe39564358ec99b46bf3ee6e6999ae17d (patch) | |
tree | 3b88e3aa94c73ea2ea9c17feb5537287df769265 /drivers/usb/input/hid-ff.c | |
parent | f6a01c85965c9e6fa8fb893c1fa5db16130d0ccb (diff) | |
download | talos-op-linux-224ee88fe39564358ec99b46bf3ee6e6999ae17d.tar.gz talos-op-linux-224ee88fe39564358ec99b46bf3ee6e6999ae17d.zip |
Input: add force feedback driver for PID devices
This replaces the older PID driver which was never completed.
Signed-off-by: Anssi Hannula <anssi.hannula@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/usb/input/hid-ff.c')
-rw-r--r-- | drivers/usb/input/hid-ff.c | 45 |
1 files changed, 17 insertions, 28 deletions
diff --git a/drivers/usb/input/hid-ff.c b/drivers/usb/input/hid-ff.c index d5c91ee67991..1b4882202144 100644 --- a/drivers/usb/input/hid-ff.c +++ b/drivers/usb/input/hid-ff.c @@ -44,45 +44,34 @@ struct hid_ff_initializer { int (*init)(struct hid_device*); }; +/* + * We try pidff when no other driver is found because PID is the + * standards compliant way of implementing force feedback in HID. + * pidff_init() will quickly abort if the device doesn't appear to + * be a PID device + */ static struct hid_ff_initializer inits[] = { #ifdef CONFIG_LOGITECH_FF - {0x46d, 0xc211, hid_lgff_init}, // Logitech Cordless rumble pad - {0x46d, 0xc283, hid_lgff_init}, // Logitech Wingman Force 3d - {0x46d, 0xc295, hid_lgff_init}, // Logitech MOMO force wheel - {0x46d, 0xc219, hid_lgff_init}, // Logitech Cordless rumble pad 2 -#endif -#ifdef CONFIG_HID_PID - {0x45e, 0x001b, hid_pid_init}, + { 0x46d, 0xc211, hid_lgff_init }, /* Logitech Cordless rumble pad */ + { 0x46d, 0xc283, hid_lgff_init }, /* Logitech Wingman Force 3d */ + { 0x46d, 0xc295, hid_lgff_init }, /* Logitech MOMO force wheel */ + { 0x46d, 0xc219, hid_lgff_init }, /* Logitech Cordless rumble pad 2 */ #endif #ifdef CONFIG_THRUSTMASTER_FF - {0x44f, 0xb304, hid_tmff_init}, + { 0x44f, 0xb304, hid_tmff_init }, #endif - {0, 0, NULL} /* Terminating entry */ + { 0, 0, hid_pidff_init} /* Matches anything */ }; -static struct hid_ff_initializer *hid_get_ff_init(__u16 idVendor, - __u16 idProduct) -{ - struct hid_ff_initializer *init; - for (init = inits; - init->idVendor - && !(init->idVendor == idVendor - && init->idProduct == idProduct); - init++); - - return init->idVendor? init : NULL; -} - int hid_ff_init(struct hid_device* hid) { struct hid_ff_initializer *init; + int vendor = le16_to_cpu(hid->dev->descriptor.idVendor); + int product = le16_to_cpu(hid->dev->descriptor.idProduct); - init = hid_get_ff_init(le16_to_cpu(hid->dev->descriptor.idVendor), - le16_to_cpu(hid->dev->descriptor.idProduct)); + for (init = inits; init->idVendor; init++) + if (init->idVendor == vendor && init->idProduct == product) + break; - if (!init) { - dbg("hid_ff_init could not find initializer"); - return -ENOSYS; - } return init->init(hid); } |