Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 114453
b: refs/heads/master
c: 2bea94d
h: refs/heads/master
i:
  114451: f735fab
v: v3
  • Loading branch information
Sergey Belyashov authored and Jiri Kosina committed Oct 14, 2008
1 parent a66c75d commit 0fd63a8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6f3c0e509640070e3c013cd9787a7d1892276b3f
refs/heads/master: 2bea94db87362ad90d0959201f5c401767042be1
28 changes: 27 additions & 1 deletion trunk/drivers/hid/hid-lgff.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,20 @@ static const signed short ff_joystick[] = {
-1
};

static const signed short ff_wheel[] = {
FF_CONSTANT,
FF_AUTOCENTER,
-1
};

static const struct dev_type devices[] = {
{ 0x046d, 0xc211, ff_rumble },
{ 0x046d, 0xc219, ff_rumble },
{ 0x046d, 0xc283, ff_joystick },
{ 0x046d, 0xc286, ff_joystick },
{ 0x046d, 0xc294, ff_joystick },
{ 0x046d, 0xc295, ff_joystick },
{ 0x046d, 0xca03, ff_joystick },
{ 0x046d, 0xca03, ff_wheel },
};

static int hid_lgff_play(struct input_dev *dev, void *data, struct ff_effect *effect)
Expand Down Expand Up @@ -102,6 +108,23 @@ static int hid_lgff_play(struct input_dev *dev, void *data, struct ff_effect *ef
return 0;
}

static void hid_lgff_set_autocenter(struct input_dev *dev, u16 magnitude)
{
struct hid_device *hid = input_get_drvdata(dev);
struct list_head *report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list;
struct hid_report *report = list_entry(report_list->next, struct hid_report, list);
__s32 *value = report->field[0]->value;
magnitude = (magnitude >> 12) & 0xf;
*value++ = 0xfe;
*value++ = 0x0d;
*value++ = magnitude; /* clockwise strength */
*value++ = magnitude; /* counter-clockwise strength */
*value++ = 0x80;
*value++ = 0x00;
*value = 0x00;
usbhid_submit_report(hid, report, USB_DIR_OUT);
}

int lgff_init(struct hid_device* hid)
{
struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, list);
Expand Down Expand Up @@ -147,6 +170,9 @@ int lgff_init(struct hid_device* hid)
if (error)
return error;

if ( test_bit(FF_AUTOCENTER, dev->ffbit) )
dev->ff->set_autocenter = hid_lgff_set_autocenter;

printk(KERN_INFO "Force feedback for Logitech force feedback devices by Johann Deneux <johann.deneux@it.uu.se>\n");

return 0;
Expand Down

0 comments on commit 0fd63a8

Please sign in to comment.