Skip to content

Commit

Permalink
core, tests: Fix the pulse test and print test info
Browse files Browse the repository at this point in the history
This fixes the loop count to repeat the pulses only two times. Each
pulse takes 100ms, it should now run for 300ms instead of 400ms
previously.

To aid users in understanding the tests, print information about each
test to the kernel log.

Signed-off-by: Kai Krakow <[email protected]>
  • Loading branch information
kakra committed Nov 30, 2024
1 parent 2848754 commit 6a43a76
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions hid-xpadneo/src/hid-xpadneo.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,13 @@ static int xpadneo_ff_play(struct input_dev *dev, void *data, struct ff_effect *
return 0;
}

static void xpadneo_test_rumble(struct xpadneo_devdata *xdata, struct ff_report pck)
static void xpadneo_test_rumble(char *which, struct xpadneo_devdata *xdata, struct ff_report pck)
{
enum xpadneo_rumble_motors enabled = pck.ff.enable;

hid_info(xdata->hdev, "testing %s: sustain %d0ms release %d0ms loop %d wait 30ms\n", which,
pck.ff.pulse_sustain_10ms, pck.ff.pulse_release_10ms, pck.ff.loop_count);

/*
* XPADNEO_QUIRK_NO_MOTOR_MASK:
* The controller does not support motor masking so we set all bits, and set the magnitude to 0 instead.
Expand Down Expand Up @@ -453,18 +456,18 @@ static void xpadneo_welcome_rumble(struct hid_device *hdev)
if (!(xdata->quirks & XPADNEO_QUIRK_NO_PULSE)) {
ff_pck.ff.pulse_sustain_10ms = 5;
ff_pck.ff.pulse_release_10ms = 5;
ff_pck.ff.loop_count = 3;
ff_pck.ff.loop_count = 2;
}

ff_pck.ff.enable = FF_RUMBLE_WEAK;
xpadneo_test_rumble(xdata, ff_pck);
xpadneo_test_rumble("weak motor", xdata, ff_pck);

ff_pck.ff.enable = FF_RUMBLE_STRONG;
xpadneo_test_rumble(xdata, ff_pck);
xpadneo_test_rumble("strong motor", xdata, ff_pck);

if (!(xdata->quirks & XPADNEO_QUIRK_NO_TRIGGER_RUMBLE)) {
ff_pck.ff.enable = FF_RUMBLE_TRIGGERS;
xpadneo_test_rumble(xdata, ff_pck);
xpadneo_test_rumble("trigger motors", xdata, ff_pck);
}
}

Expand Down

0 comments on commit 6a43a76

Please sign in to comment.