diff options
-rw-r--r-- | drivers/hid/hid-core.c | 11 | ||||
-rw-r--r-- | include/linux/hid.h | 1 | ||||
-rw-r--r-- | net/bluetooth/hidp/core.c | 9 |
3 files changed, 17 insertions, 4 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 | /* |
diff --git a/include/linux/hid.h b/include/linux/hid.h index 7e1f37db7582..abce7eb4f258 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
@@ -721,6 +721,7 @@ struct hid_ll_driver { | |||
721 | 721 | ||
722 | extern int hid_debug; | 722 | extern int hid_debug; |
723 | 723 | ||
724 | extern bool hid_ignore(struct hid_device *); | ||
724 | extern int hid_add_device(struct hid_device *); | 725 | extern int hid_add_device(struct hid_device *); |
725 | extern void hid_destroy_device(struct hid_device *); | 726 | extern void hid_destroy_device(struct hid_device *); |
726 | 727 | ||
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index ccd985da6518..1f4a32bb2971 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c | |||
@@ -941,6 +941,13 @@ static int hidp_setup_hid(struct hidp_session *session, | |||
941 | hid->hid_get_raw_report = hidp_get_raw_report; | 941 | hid->hid_get_raw_report = hidp_get_raw_report; |
942 | hid->hid_output_raw_report = hidp_output_raw_report; | 942 | hid->hid_output_raw_report = hidp_output_raw_report; |
943 | 943 | ||
944 | /* True if device is blacklisted in drivers/hid/hid-core.c */ | ||
945 | if (hid_ignore(hid)) { | ||
946 | hid_destroy_device(session->hid); | ||
947 | session->hid = NULL; | ||
948 | return -ENODEV; | ||
949 | } | ||
950 | |||
944 | return 0; | 951 | return 0; |
945 | 952 | ||
946 | fault: | 953 | fault: |
@@ -1013,7 +1020,7 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, | |||
1013 | 1020 | ||
1014 | if (req->rd_size > 0) { | 1021 | if (req->rd_size > 0) { |
1015 | err = hidp_setup_hid(session, req); | 1022 | err = hidp_setup_hid(session, req); |
1016 | if (err) | 1023 | if (err && err != -ENODEV) |
1017 | goto purge; | 1024 | goto purge; |
1018 | } | 1025 | } |
1019 | 1026 | ||