6 Commits
docs ... 0.0.5

Author SHA1 Message Date
Makarenko Oleg
5416f537bf Merge pull request #12 from JacKeTUs/quirks-init
Move quirks initialization to the hid_pidff_init function
2024-07-16 12:37:11 +03:00
Oleg
3db0eef19a Rename hid_pidff_init 2024-07-16 12:30:29 +03:00
Oleg
d132ca633f Move quirks initialization to the hid_pidff_init function 2024-07-15 18:17:17 +03:00
Makarenko Oleg
a0b20c7055 Merge pull request #10 from JacKeTUs/no_delay_quirk_fix
Fix NO_DELAY_EFFECT quirk implementation
2024-07-15 04:51:15 +03:00
Oleg
11ed3dd91e Fix NO_DELAY_EFFECT quirk implementation 2024-07-15 04:50:08 +03:00
Makarenko Oleg
eb3766ac30 Merge pull request #8 from JacKeTUs/docs
Fix module names in README.md
2024-07-15 04:38:01 +03:00
3 changed files with 13 additions and 34 deletions

View File

@@ -69,9 +69,9 @@ static int universal_pidff_probe(struct hid_device *hdev,
goto err;
}
ret = hid_pidff_init_with_quirks(hdev, id);
ret = hid_pidff_init_quirks(hdev, id);
if (ret) {
hid_warn(hdev, "Force feedback not supported\n");
hid_warn(hdev, "Force feedback is not supported\n");
goto err;
}

View File

@@ -369,7 +369,9 @@ static void pidff_set_effect_report(struct pidff_device *pidff,
pidff->effect_direction->value[0] =
pidff_rescale(direction, 0xffff, pidff->effect_direction);
if (!(pidff->quirks & PIDFF_QUIRK_NO_DELAY_EFFECT)) {
pidff->set_effect[PID_START_DELAY].value[0] = effect->replay.delay;
}
hid_hw_request(pidff->hid, pidff->reports[PID_SET_EFFECT],
HID_REQ_SET_REPORT);
@@ -814,7 +816,9 @@ static void pidff_autocenter(struct pidff_device *pidff, u16 magnitude)
pidff->set_effect[PID_TRIGGER_REPEAT_INT].value[0] = 0;
pidff_set(&pidff->set_effect[PID_GAIN], magnitude);
pidff->set_effect[PID_DIRECTION_ENABLE].value[0] = 1;
if (!(pidff->quirks & PIDFF_QUIRK_NO_DELAY_EFFECT)) {
pidff->set_effect[PID_START_DELAY].value[0] = 0;
}
hid_hw_request(pidff->hid, pidff->reports[PID_SET_EFFECT],
HID_REQ_SET_REPORT);
@@ -1316,9 +1320,9 @@ static int pidff_check_autocenter(struct pidff_device *pidff,
}
/*
* Check if the device is PID and initialize it
* Check if the device is PID and initialize it, with quirks
*/
int hid_pidff_init(struct hid_device *hid)
int hid_pidff_init_quirks(struct hid_device *hid, const struct hid_device_id *id)
{
struct pidff_device *pidff;
struct hid_input *hidinput = list_entry(hid->inputs.next,
@@ -1340,6 +1344,8 @@ int hid_pidff_init(struct hid_device *hid)
return -ENOMEM;
pidff->hid = hid;
pidff->quirks |= id->driver_data;
hid_dbg(dev, "Device quirks: %d\n", pidff->quirks);
hid_device_io_start(hid);
@@ -1417,29 +1423,3 @@ int hid_pidff_init(struct hid_device *hid)
kfree(pidff);
return error;
}
/*
* Check if the device is PID and initialize it
* Add quirks after initialisation
*/
int hid_pidff_init_with_quirks(struct hid_device *hid, const struct hid_device_id *id)
{
int error = hid_pidff_init(hid);
if (error)
return error;
struct hid_input *hidinput = list_entry(hid->inputs.next,
struct hid_input, list);
struct input_dev *dev = hidinput->input;
struct pidff_device *pidff = dev->ff->private;
/* set quirks on the pidff device */
hid_device_io_start(hid);
pidff->quirks |= id->driver_data;
hid_device_io_stop(hid);
hid_dbg(dev, "Device quirks: %d\n", pidff->quirks);
return 0;
}

View File

@@ -20,7 +20,6 @@
#define PIDFF_QUIRK_NO_DELAY_EFFECT BIT(2)
int hid_pidff_init(struct hid_device *hid);
int hid_pidff_init_with_quirks(struct hid_device *hid, const struct hid_device_id *id);
int hid_pidff_init_quirks(struct hid_device *hid, const struct hid_device_id *id);
#endif