aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/input/hid-ff.c
diff options
context:
space:
mode:
authorAnssi Hannula <anssi.hannula@gmail.com>2006-07-19 01:40:47 -0400
committerDmitry Torokhov <dtor@insightbb.com>2006-07-19 01:40:47 -0400
commit224ee88fe39564358ec99b46bf3ee6e6999ae17d (patch)
tree3b88e3aa94c73ea2ea9c17feb5537287df769265 /drivers/usb/input/hid-ff.c
parentf6a01c85965c9e6fa8fb893c1fa5db16130d0ccb (diff)
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.c45
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 {
44 int (*init)(struct hid_device*); 44 int (*init)(struct hid_device*);
45}; 45};
46 46
47/*
48 * We try pidff when no other driver is found because PID is the
49 * standards compliant way of implementing force feedback in HID.
50 * pidff_init() will quickly abort if the device doesn't appear to
51 * be a PID device
52 */
47static struct hid_ff_initializer inits[] = { 53static struct hid_ff_initializer inits[] = {
48#ifdef CONFIG_LOGITECH_FF 54#ifdef CONFIG_LOGITECH_FF
49 {0x46d, 0xc211, hid_lgff_init}, // Logitech Cordless rumble pad 55 { 0x46d, 0xc211, hid_lgff_init }, /* Logitech Cordless rumble pad */
50 {0x46d, 0xc283, hid_lgff_init}, // Logitech Wingman Force 3d 56 { 0x46d, 0xc283, hid_lgff_init }, /* Logitech Wingman Force 3d */
51 {0x46d, 0xc295, hid_lgff_init}, // Logitech MOMO force wheel 57 { 0x46d, 0xc295, hid_lgff_init }, /* Logitech MOMO force wheel */
52 {0x46d, 0xc219, hid_lgff_init}, // Logitech Cordless rumble pad 2 58 { 0x46d, 0xc219, hid_lgff_init }, /* Logitech Cordless rumble pad 2 */
53#endif
54#ifdef CONFIG_HID_PID
55 {0x45e, 0x001b, hid_pid_init},
56#endif 59#endif
57#ifdef CONFIG_THRUSTMASTER_FF 60#ifdef CONFIG_THRUSTMASTER_FF
58 {0x44f, 0xb304, hid_tmff_init}, 61 { 0x44f, 0xb304, hid_tmff_init },
59#endif 62#endif
60 {0, 0, NULL} /* Terminating entry */ 63 { 0, 0, hid_pidff_init} /* Matches anything */
61}; 64};
62 65
63static struct hid_ff_initializer *hid_get_ff_init(__u16 idVendor,
64 __u16 idProduct)
65{
66 struct hid_ff_initializer *init;
67 for (init = inits;
68 init->idVendor
69 && !(init->idVendor == idVendor
70 && init->idProduct == idProduct);
71 init++);
72
73 return init->idVendor? init : NULL;
74}
75
76int hid_ff_init(struct hid_device* hid) 66int hid_ff_init(struct hid_device* hid)
77{ 67{
78 struct hid_ff_initializer *init; 68 struct hid_ff_initializer *init;
69 int vendor = le16_to_cpu(hid->dev->descriptor.idVendor);
70 int product = le16_to_cpu(hid->dev->descriptor.idProduct);
79 71
80 init = hid_get_ff_init(le16_to_cpu(hid->dev->descriptor.idVendor), 72 for (init = inits; init->idVendor; init++)
81 le16_to_cpu(hid->dev->descriptor.idProduct)); 73 if (init->idVendor == vendor && init->idProduct == product)
74 break;
82 75
83 if (!init) {
84 dbg("hid_ff_init could not find initializer");
85 return -ENOSYS;
86 }
87 return init->init(hid); 76 return init->init(hid);
88} 77}