Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d2c02da5 authored by Simon Wood's avatar Simon Wood Committed by Jiri Kosina
Browse files

HID:hid-lg4ff: Switch autocentering off when strength is set to zero.



When the autocenter is set to zero, this patch issues a command to
totally disable the autocenter - this results in less resistance
in the wheel.

Reported-by: default avatarElias Vanderstuyft <elias.vds@gmail.com>
Signed-off-by: default avatarSimon Wood <simon@mungewell.org>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent f8c23156
Loading
Loading
Loading
Loading
+25 −0
Original line number Original line Diff line number Diff line
@@ -220,6 +220,20 @@ static void hid_lg4ff_set_autocenter_default(struct input_dev *dev, u16 magnitud
	__s32 *value = report->field[0]->value;
	__s32 *value = report->field[0]->value;
	__u32 expand_a, expand_b;
	__u32 expand_a, expand_b;


	/* De-activate Auto-Center */
	if (magnitude == 0) {
		value[0] = 0xf5;
		value[1] = 0x00;
		value[2] = 0x00;
		value[3] = 0x00;
		value[4] = 0x00;
		value[5] = 0x00;
		value[6] = 0x00;

		hid_hw_request(hid, report, HID_REQ_SET_REPORT);
		return;
	}

	if (magnitude <= 0xaaaa) {
	if (magnitude <= 0xaaaa) {
		expand_a = 0x0c * magnitude;
		expand_a = 0x0c * magnitude;
		expand_b = 0x80 * magnitude;
		expand_b = 0x80 * magnitude;
@@ -237,6 +251,17 @@ static void hid_lg4ff_set_autocenter_default(struct input_dev *dev, u16 magnitud
	value[6] = 0x00;
	value[6] = 0x00;


	hid_hw_request(hid, report, HID_REQ_SET_REPORT);
	hid_hw_request(hid, report, HID_REQ_SET_REPORT);

	/* Activate Auto-Center */
	value[0] = 0x14;
	value[1] = 0x00;
	value[2] = 0x00;
	value[3] = 0x00;
	value[4] = 0x00;
	value[5] = 0x00;
	value[6] = 0x00;

	hid_hw_request(hid, report, HID_REQ_SET_REPORT);
}
}


/* Sends autocentering command compatible with Formula Force EX */
/* Sends autocentering command compatible with Formula Force EX */