From: "benjamin.tissoires" <benjamin.tissoires@gmail.com>
To: "benjamin.tissoires" <benjamin.tissoires@gmail.com>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Henrik Rydberg <rydberg@euromail.se>,
Jiri Kosina <jkosina@suse.cz>, Stephane Chatty <chatty@enac.fr>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 4/5] HID: autoload hid-multitouch as needed
Date: Tue, 6 Mar 2012 17:57:05 +0100 [thread overview]
Message-ID: <1331053026-21272-5-git-send-email-benjamin.tissoires@gmail.com> (raw)
In-Reply-To: <1331053026-21272-1-git-send-email-benjamin.tissoires@gmail.com>
From: Benjamin Tissoires <benjamin.tissoires@enac.fr>
The code is inspired from the one present in the bttv module.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
---
As I mentioned in the mail 0/5, I'd really like to have your opinion on this
one. I copied the code from bttv, but it forces us to change hid_device which
is not very good for ABI changes reasons.
Thanks,
Benjamin
drivers/hid/hid-core.c | 27 +++++++++++++++++++++++++++
include/linux/hid.h | 4 ++++
2 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 2390e00..0dcb6c6 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1204,6 +1204,28 @@ static struct bin_attribute dev_bin_attr_report_desc = {
.size = HID_MAX_DESCRIPTOR_SIZE,
};
+#if defined(CONFIG_MODULES) && defined(MODULE)
+static void hid_request_module_async(struct work_struct *work)
+{
+ request_module("hid-multitouch");
+}
+
+static void hid_request_hid_multitouch(struct hid_device *dev)
+{
+ dev->multitouch = 1;
+ INIT_WORK(&dev->request_module_wk, hid_request_module_async);
+ schedule_work(&dev->request_module_wk);
+}
+
+static void hid_flush_request_modules(struct hid_device *dev)
+{
+ flush_work_sync(&dev->request_module_wk);
+}
+#else
+#define hid_request_hid_multitouch(dev)
+#define hid_flush_request_modules(dev)
+#endif /* CONFIG_MODULES */
+
int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
{
static const char *types[] = { "Device", "Pointer", "Mouse", "Device",
@@ -1230,6 +1252,7 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
hdev->claimed |= HID_CLAIMED_INPUT;
if (hdev->quirks & HID_QUIRK_MULTITOUCH) {
/* this device should be handled by hid-multitouch, skip it */
+ hid_request_hid_multitouch(hdev);
return -ENODEV;
}
@@ -2089,6 +2112,8 @@ struct hid_device *hid_allocate_device(void)
INIT_LIST_HEAD(&hdev->debug_list);
sema_init(&hdev->driver_lock, 1);
+ hdev->multitouch = 0;
+
return hdev;
err:
put_device(&hdev->dev);
@@ -2103,6 +2128,8 @@ static void hid_remove_device(struct hid_device *hdev)
hid_debug_unregister(hdev);
hdev->status &= ~HID_STAT_ADDED;
}
+ if (hdev->multitouch)
+ hid_flush_request_modules(hdev);
}
/**
diff --git a/include/linux/hid.h b/include/linux/hid.h
index c235e4e..79f484b 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -498,6 +498,10 @@ struct hid_device { /* device report descriptor */
void *driver_data;
+ /* used to make hid-multitouch autoloadable */
+ struct work_struct request_module_wk;
+ bool multitouch;
+
/* temporary hid_ff handling (until moved to the drivers) */
int (*ff_init)(struct hid_device *);
--
1.7.7.6
next prev parent reply other threads:[~2012-03-06 16:57 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-06 16:57 [patch 0/5] Autohandling of multitouch devices through hid-multitouch benjamin.tissoires
2012-03-06 16:57 ` [PATCH 1/5] HID: multitouch: add support for eGalax 0x722a benjamin.tissoires
2012-03-09 12:29 ` Jiri Kosina
2012-03-10 6:31 ` Benjamin Tissoires
2012-03-12 12:40 ` Jiri Kosina
2012-03-12 13:02 ` Henrik Rydberg
2012-03-06 16:57 ` [PATCH 2/5] HID: multitouch: fix handling of buggy reports descriptors for Dell ST2220T benjamin.tissoires
2012-03-12 10:25 ` Jiri Kosina
2012-03-06 16:57 ` [PATCH 3/5] HID: handle all multitouch devices through hid-multitouch benjamin.tissoires
2012-03-06 16:57 ` benjamin.tissoires [this message]
2012-03-07 21:36 ` [PATCH 4/5] HID: autoload hid-multitouch as needed Jiri Kosina
2012-03-08 10:57 ` Henrik Rydberg
2012-03-08 11:21 ` Stéphane Chatty
2012-03-08 11:30 ` Henrik Rydberg
2012-03-08 11:48 ` Stéphane Chatty
2012-03-08 12:23 ` Henrik Rydberg
2012-03-08 22:47 ` Stéphane Chatty
2012-03-12 16:18 ` Jiri Kosina
2012-03-12 15:57 ` Jiri Kosina
[not found] ` <alpine.LNX.2.00.1203121650500.18356-ztGlSCb7Y1iN3ZZ/Hiejyg@public.gmane.org>
2012-03-12 17:42 ` Marcel Holtmann
2012-03-12 20:47 ` Stéphane Chatty
2012-03-12 22:21 ` Jiri Kosina
2012-03-13 10:17 ` Stéphane Chatty
2012-03-13 16:13 ` Jiri Kosina
[not found] ` <alpine.LNX.2.00.1203131710120.18356-ztGlSCb7Y1iN3ZZ/Hiejyg@public.gmane.org>
2012-03-13 18:14 ` Stéphane Chatty
2012-03-16 11:26 ` Jiri Kosina
2012-03-06 16:57 ` [PATCH 5/5] HID: multitouch: detect serial protocol benjamin.tissoires
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1331053026-21272-5-git-send-email-benjamin.tissoires@gmail.com \
--to=benjamin.tissoires@gmail.com \
--cc=chatty@enac.fr \
--cc=dmitry.torokhov@gmail.com \
--cc=jkosina@suse.cz \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rydberg@euromail.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).