Skip to content

Commit

Permalink
HID: store the full list of reports in the hidinput
Browse files Browse the repository at this point in the history
We were only storing the report in case of QUIRK_MULTI_INPUT.
It is interesting for the upcoming  HID_QUIRK_INPUT_PER_APP to also
store the full list of reports that are attached to it.

We need the full list because a device (Advanced Silicon has some)
might want to use a different report ID for the Input reports and
the Output reports. Storing the full list allows the drivers to
have all the data.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Benjamin Tissoires authored and Jiri Kosina committed Apr 26, 2018
1 parent 190d7f0 commit e1b63c0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/hid/hid-input.c
Original file line number Diff line number Diff line change
Expand Up @@ -1526,9 +1526,12 @@ static struct hid_input *hidinput_allocate(struct hid_device *hid)
input_dev->id.product = hid->product;
input_dev->id.version = hid->version;
input_dev->dev.parent = &hid->dev;

hidinput->input = input_dev;
list_add_tail(&hidinput->list, &hid->inputs);

INIT_LIST_HEAD(&hidinput->reports);

return hidinput;
}

Expand Down Expand Up @@ -1678,6 +1681,9 @@ int hidinput_connect(struct hid_device *hid, unsigned int force)

if (hid->quirks & HID_QUIRK_MULTI_INPUT)
hidinput->report = report;

list_add_tail(&report->hidinput_list,
&hidinput->reports);
}
}

Expand Down
2 changes: 2 additions & 0 deletions include/linux/hid.h
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ struct hid_field {

struct hid_report {
struct list_head list;
struct list_head hidinput_list;
unsigned id; /* id of this report */
unsigned type; /* report type */
struct hid_field *field[HID_MAX_FIELDS]; /* fields of the report */
Expand Down Expand Up @@ -510,6 +511,7 @@ struct hid_input {
struct hid_report *report;
struct input_dev *input;
bool registered;
struct list_head reports; /* the list of reports */
};

enum hid_type {
Expand Down

0 comments on commit e1b63c0

Please sign in to comment.