mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
HID: Handle driver-specific device descriptor in core
The low-level driver can read the report descriptor, but it cannot determine driver-specific changes to it. The hid core can fixup and parse the report descriptor during driver attach, but does not have direct access to the descriptor when doing so. To be able to handle attach/detach of hid drivers properly, a semantic change to hid_parse_report() is needed. This function has been used in two ways, both as descriptor reader in the ll drivers and as a parsor in the probe of the drivers. This patch splits the usage by introducing hid_open_report(), and modifies the hid_parse() macro to call hid_open_report() instead. The only usage of hid_parse_report() is then to read and store the device descriptor. As a consequence, we can handle the report fixups automatically inside the hid core. Signed-off-by: Henrik Rydberg <rydberg@euromail.se> Tested-by: Nikolai Kondrashov <spbnick@gmail.com> Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
parent
2a039bf5a6
commit
a7197c2e41
2 changed files with 94 additions and 32 deletions
|
@ -467,6 +467,8 @@ struct hid_driver;
|
|||
struct hid_ll_driver;
|
||||
|
||||
struct hid_device { /* device report descriptor */
|
||||
__u8 *dev_rdesc;
|
||||
unsigned dev_rsize;
|
||||
__u8 *rdesc;
|
||||
unsigned rsize;
|
||||
struct hid_collection *collection; /* List of HID collections */
|
||||
|
@ -735,6 +737,7 @@ void hid_output_report(struct hid_report *report, __u8 *data);
|
|||
struct hid_device *hid_allocate_device(void);
|
||||
struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id);
|
||||
int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size);
|
||||
int hid_open_report(struct hid_device *device);
|
||||
int hid_check_keys_pressed(struct hid_device *hid);
|
||||
int hid_connect(struct hid_device *hid, unsigned int connect_mask);
|
||||
void hid_disconnect(struct hid_device *hid);
|
||||
|
@ -805,16 +808,7 @@ static inline void hid_map_usage_clear(struct hid_input *hidinput,
|
|||
*/
|
||||
static inline int __must_check hid_parse(struct hid_device *hdev)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (hdev->status & HID_STAT_PARSED)
|
||||
return 0;
|
||||
|
||||
ret = hdev->ll_driver->parse(hdev);
|
||||
if (!ret)
|
||||
hdev->status |= HID_STAT_PARSED;
|
||||
|
||||
return ret;
|
||||
return hid_open_report(hdev);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue