aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSergey Belyashov <Sergey.Belyashov@gmail.com>2008-09-02 11:31:16 -0400
committerJiri Kosina <jkosina@suse.cz>2008-10-14 17:50:58 -0400
commit2bea94db87362ad90d0959201f5c401767042be1 (patch)
treeabe45311bce2ec24b77d8ed1b903a0abbf137a32 /drivers
parent6f3c0e509640070e3c013cd9787a7d1892276b3f (diff)
HID: Autocentering support for Logitech MOMO Racing Wheel
Current kernel has no support for autocentering for Logitech wheels. By default autocentering enabled in wheel and constant effect does not work properly. Using USB sniffer I found command which change autocentering settings: 0xFE, 0x0D, 0x0R, 0x0L, 0x80, 0x00, 0x00, where R - clockwise force, L - counter-clockwise (0x0-0xF, 0xC = 100%). Signed-off-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hid/hid-lgff.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/drivers/hid/hid-lgff.c b/drivers/hid/hid-lgff.c
index e379c167ac9e..51aff08e10ce 100644
--- a/drivers/hid/hid-lgff.c
+++ b/drivers/hid/hid-lgff.c
@@ -50,6 +50,12 @@ static const signed short ff_joystick[] = {
50 -1 50 -1
51}; 51};
52 52
53static const signed short ff_wheel[] = {
54 FF_CONSTANT,
55 FF_AUTOCENTER,
56 -1
57};
58
53static const struct dev_type devices[] = { 59static const struct dev_type devices[] = {
54 { 0x046d, 0xc211, ff_rumble }, 60 { 0x046d, 0xc211, ff_rumble },
55 { 0x046d, 0xc219, ff_rumble }, 61 { 0x046d, 0xc219, ff_rumble },
@@ -57,7 +63,7 @@ static const struct dev_type devices[] = {
57 { 0x046d, 0xc286, ff_joystick }, 63 { 0x046d, 0xc286, ff_joystick },
58 { 0x046d, 0xc294, ff_joystick }, 64 { 0x046d, 0xc294, ff_joystick },
59 { 0x046d, 0xc295, ff_joystick }, 65 { 0x046d, 0xc295, ff_joystick },
60 { 0x046d, 0xca03, ff_joystick }, 66 { 0x046d, 0xca03, ff_wheel },
61}; 67};
62 68
63static int hid_lgff_play(struct input_dev *dev, void *data, struct ff_effect *effect) 69static int hid_lgff_play(struct input_dev *dev, void *data, struct ff_effect *effect)
@@ -102,6 +108,23 @@ static int hid_lgff_play(struct input_dev *dev, void *data, struct ff_effect *ef
102 return 0; 108 return 0;
103} 109}
104 110
111static void hid_lgff_set_autocenter(struct input_dev *dev, u16 magnitude)
112{
113 struct hid_device *hid = input_get_drvdata(dev);
114 struct list_head *report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list;
115 struct hid_report *report = list_entry(report_list->next, struct hid_report, list);
116 __s32 *value = report->field[0]->value;
117 magnitude = (magnitude >> 12) & 0xf;
118 *value++ = 0xfe;
119 *value++ = 0x0d;
120 *value++ = magnitude; /* clockwise strength */
121 *value++ = magnitude; /* counter-clockwise strength */
122 *value++ = 0x80;
123 *value++ = 0x00;
124 *value = 0x00;
125 usbhid_submit_report(hid, report, USB_DIR_OUT);
126}
127
105int lgff_init(struct hid_device* hid) 128int lgff_init(struct hid_device* hid)
106{ 129{
107 struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, list); 130 struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, list);
@@ -147,6 +170,9 @@ int lgff_init(struct hid_device* hid)
147 if (error) 170 if (error)
148 return error; 171 return error;
149 172
173 if ( test_bit(FF_AUTOCENTER, dev->ffbit) )
174 dev->ff->set_autocenter = hid_lgff_set_autocenter;
175
150 printk(KERN_INFO "Force feedback for Logitech force feedback devices by Johann Deneux <johann.deneux@it.uu.se>\n"); 176 printk(KERN_INFO "Force feedback for Logitech force feedback devices by Johann Deneux <johann.deneux@it.uu.se>\n");
151 177
152 return 0; 178 return 0;