Skip to content

Commit 1abfcd8

Browse files
LawstorantJiri Kosina
authored andcommitted
HID: pidff: Update debug messages
Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com> Better indicate what operation is requested on a given effect (play or stop). Previously, we only had the info about requesting playback but this could be misleading when the looop count is 0. Add debug print that shows what device control command was actually sent to the device. Print out its hex hid usage. Make field_index const to make sure it won't be changed by mistake later. Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent 1d72e7b commit 1abfcd8

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

drivers/hid/usbhid/hid-pidff.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -623,8 +623,7 @@ static void pidff_set_gain_report(struct pidff_device *pidff, u16 gain)
623623
*/
624624
static void pidff_set_device_control(struct pidff_device *pidff, int field)
625625
{
626-
int i, index;
627-
int field_index = pidff->control_id[field];
626+
const int field_index = pidff->control_id[field];
628627

629628
if (field_index < 1)
630629
return;
@@ -634,8 +633,9 @@ static void pidff_set_device_control(struct pidff_device *pidff, int field)
634633
hid_dbg(pidff->hid, "DEVICE_CONTROL is a bitmask\n");
635634

636635
/* Clear current bitmask */
637-
for (i = 0; i < ARRAY_SIZE(pidff_device_control); i++) {
638-
index = pidff->control_id[i];
636+
for (int i = 0; i < ARRAY_SIZE(pidff_device_control); i++) {
637+
int index = pidff->control_id[i];
638+
639639
if (index < 1)
640640
continue;
641641

@@ -650,6 +650,8 @@ static void pidff_set_device_control(struct pidff_device *pidff, int field)
650650

651651
hid_hw_request(pidff->hid, pidff->reports[PID_DEVICE_CONTROL], HID_REQ_SET_REPORT);
652652
hid_hw_wait(pidff->hid);
653+
hid_dbg(pidff->hid, "Device control command 0x%02x sent",
654+
pidff_device_control[field]);
653655
}
654656

655657
/*
@@ -751,6 +753,9 @@ static void pidff_playback_pid(struct pidff_device *pidff, int pid_id, int n)
751753
{
752754
pidff->effect_operation[PID_EFFECT_BLOCK_INDEX].value[0] = pid_id;
753755

756+
hid_dbg(pidff->hid, "%s PID effect %d", n == 0 ? "stopping" : "playing",
757+
pid_id);
758+
754759
if (n == 0) {
755760
pidff->effect_operation_status->value[0] =
756761
pidff->operation_id[PID_EFFECT_STOP];
@@ -772,6 +777,8 @@ static int pidff_playback(struct input_dev *dev, int effect_id, int value)
772777
{
773778
struct pidff_device *pidff = dev->ff->private;
774779

780+
hid_dbg(pidff->hid, "requesting %s on FF effect %d",
781+
value == 0 ? "stop" : "playback", effect_id);
775782
pidff_playback_pid(pidff, pidff->pid_id[effect_id], value);
776783
return 0;
777784
}

0 commit comments

Comments
 (0)