diff options
author | Lamarque V. Souza <lamarque@gmail.com> | 2012-12-06 09:39:55 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2012-12-07 05:12:27 -0500 |
commit | 4529eefad087f97b33c0f31984d924b1f15d7bae (patch) | |
tree | b88ae9ea27c1c46a7e991778ad91e4b89b36cda9 /drivers/hid | |
parent | ae751fa82dd8e5a79932d6b55742e7e298afd733 (diff) |
HID: hidp: fallback to input session properly if hid is blacklisted
This patch against kernel 3.7.0-rc8 fixes a kernel oops when turning on the
bluetooth mouse with id 0458:0058 [1].
The mouse in question supports both input and hid sessions, however it is
blacklisted in drivers/hid/hid-core.c so the input session is one that should
be used. Long ago (around kernel 3.0.0) some changes in the bluetooth
subsystem made the kernel do not fallback to input session when hid session is
not supported or blacklisted. This patch restore that behaviour by making the
kernel try the input session if hid_add_device returns ENODEV.
The patch exports hid_ignore() from hid-core.c so that it can be used in the
bluetooth subsystem.
[1] https://bugzilla.kernel.org/show_bug.cgi?id=39882
Signed-off-by: Lamarque V. Souza <lamarque@gmail.com>
Acked-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-core.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index a7550bb30836..2629d5240d63 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -2145,8 +2145,13 @@ static const struct hid_device_id hid_mouse_ignore_list[] = { | |||
2145 | { } | 2145 | { } |
2146 | }; | 2146 | }; |
2147 | 2147 | ||
2148 | static bool hid_ignore(struct hid_device *hdev) | 2148 | bool hid_ignore(struct hid_device *hdev) |
2149 | { | 2149 | { |
2150 | if (hdev->quirks & HID_QUIRK_NO_IGNORE) | ||
2151 | return false; | ||
2152 | if (hdev->quirks & HID_QUIRK_IGNORE) | ||
2153 | return true; | ||
2154 | |||
2150 | switch (hdev->vendor) { | 2155 | switch (hdev->vendor) { |
2151 | case USB_VENDOR_ID_CODEMERCS: | 2156 | case USB_VENDOR_ID_CODEMERCS: |
2152 | /* ignore all Code Mercenaries IOWarrior devices */ | 2157 | /* ignore all Code Mercenaries IOWarrior devices */ |
@@ -2201,6 +2206,7 @@ static bool hid_ignore(struct hid_device *hdev) | |||
2201 | 2206 | ||
2202 | return !!hid_match_id(hdev, hid_ignore_list); | 2207 | return !!hid_match_id(hdev, hid_ignore_list); |
2203 | } | 2208 | } |
2209 | EXPORT_SYMBOL_GPL(hid_ignore); | ||
2204 | 2210 | ||
2205 | int hid_add_device(struct hid_device *hdev) | 2211 | int hid_add_device(struct hid_device *hdev) |
2206 | { | 2212 | { |
@@ -2212,8 +2218,7 @@ int hid_add_device(struct hid_device *hdev) | |||
2212 | 2218 | ||
2213 | /* we need to kill them here, otherwise they will stay allocated to | 2219 | /* we need to kill them here, otherwise they will stay allocated to |
2214 | * wait for coming driver */ | 2220 | * wait for coming driver */ |
2215 | if (!(hdev->quirks & HID_QUIRK_NO_IGNORE) | 2221 | if (hid_ignore(hdev)) |
2216 | && (hid_ignore(hdev) || (hdev->quirks & HID_QUIRK_IGNORE))) | ||
2217 | return -ENODEV; | 2222 | return -ENODEV; |
2218 | 2223 | ||
2219 | /* | 2224 | /* |