From 8d1ae9333d1ef97d86ecd0d4712287c523f92096 Mon Sep 17 00:00:00 2001 From: "Lamarque V. Souza" Date: Thu, 6 Dec 2012 12:39:55 -0200 Subject: [PATCH] --- yaml --- r: 343115 b: refs/heads/master c: 4529eefad087f97b33c0f31984d924b1f15d7bae h: refs/heads/master i: 343113: c63bd2c868f59fe06ab3cedfdf3e51a4a350c6ad 343111: 6915d460377d8b8ecb65a8339f64aec0d1c90e9a v: v3 --- [refs] | 2 +- trunk/drivers/hid/hid-core.c | 11 ++++++++--- trunk/include/linux/hid.h | 1 + trunk/net/bluetooth/hidp/core.c | 9 ++++++++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index 3e38f734b05c..c1c5f5cbe9ab 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ae751fa82dd8e5a79932d6b55742e7e298afd733 +refs/heads/master: 4529eefad087f97b33c0f31984d924b1f15d7bae diff --git a/trunk/drivers/hid/hid-core.c b/trunk/drivers/hid/hid-core.c index a7550bb30836..2629d5240d63 100644 --- a/trunk/drivers/hid/hid-core.c +++ b/trunk/drivers/hid/hid-core.c @@ -2145,8 +2145,13 @@ static const struct hid_device_id hid_mouse_ignore_list[] = { { } }; -static bool hid_ignore(struct hid_device *hdev) +bool hid_ignore(struct hid_device *hdev) { + if (hdev->quirks & HID_QUIRK_NO_IGNORE) + return false; + if (hdev->quirks & HID_QUIRK_IGNORE) + return true; + switch (hdev->vendor) { case USB_VENDOR_ID_CODEMERCS: /* ignore all Code Mercenaries IOWarrior devices */ @@ -2201,6 +2206,7 @@ static bool hid_ignore(struct hid_device *hdev) return !!hid_match_id(hdev, hid_ignore_list); } +EXPORT_SYMBOL_GPL(hid_ignore); int hid_add_device(struct hid_device *hdev) { @@ -2212,8 +2218,7 @@ int hid_add_device(struct hid_device *hdev) /* we need to kill them here, otherwise they will stay allocated to * wait for coming driver */ - if (!(hdev->quirks & HID_QUIRK_NO_IGNORE) - && (hid_ignore(hdev) || (hdev->quirks & HID_QUIRK_IGNORE))) + if (hid_ignore(hdev)) return -ENODEV; /* diff --git a/trunk/include/linux/hid.h b/trunk/include/linux/hid.h index 7e1f37db7582..abce7eb4f258 100644 --- a/trunk/include/linux/hid.h +++ b/trunk/include/linux/hid.h @@ -721,6 +721,7 @@ struct hid_ll_driver { extern int hid_debug; +extern bool hid_ignore(struct hid_device *); extern int hid_add_device(struct hid_device *); extern void hid_destroy_device(struct hid_device *); diff --git a/trunk/net/bluetooth/hidp/core.c b/trunk/net/bluetooth/hidp/core.c index ccd985da6518..1f4a32bb2971 100644 --- a/trunk/net/bluetooth/hidp/core.c +++ b/trunk/net/bluetooth/hidp/core.c @@ -941,6 +941,13 @@ static int hidp_setup_hid(struct hidp_session *session, hid->hid_get_raw_report = hidp_get_raw_report; hid->hid_output_raw_report = hidp_output_raw_report; + /* True if device is blacklisted in drivers/hid/hid-core.c */ + if (hid_ignore(hid)) { + hid_destroy_device(session->hid); + session->hid = NULL; + return -ENODEV; + } + return 0; fault: @@ -1013,7 +1020,7 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, if (req->rd_size > 0) { err = hidp_setup_hid(session, req); - if (err) + if (err && err != -ENODEV) goto purge; }