From patchwork Thu Feb 24 18:30:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henrik Rydberg X-Patchwork-Id: 588111 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1OITfan009800 for ; Thu, 24 Feb 2011 18:29:41 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755186Ab1BXS3k (ORCPT ); Thu, 24 Feb 2011 13:29:40 -0500 Received: from ch-smtp01.sth.basefarm.net ([80.76.149.212]:53922 "EHLO ch-smtp01.sth.basefarm.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755175Ab1BXS3k (ORCPT ); Thu, 24 Feb 2011 13:29:40 -0500 Received: from c83-248-192-164.bredband.comhem.se ([83.248.192.164]:46279 helo=polaris) by ch-smtp01.sth.basefarm.net with smtp (Exim 4.73) (envelope-from ) id 1PsfwS-0005wN-4E; Thu, 24 Feb 2011 19:29:35 +0100 Received: by polaris (sSMTP sendmail emulation); Thu, 24 Feb 2011 19:31:06 +0100 From: "Henrik Rydberg" To: Jiri Kosina Cc: Dmitry Torokhov , Benjamin Tissoires , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Henrik Rydberg Subject: [PATCH] hid: Do not create input devices for feature reports Date: Thu, 24 Feb 2011 19:30:59 +0100 Message-Id: <1298572259-18173-1-git-send-email-rydberg@euromail.se> X-Mailer: git-send-email 1.7.4.1 X-Originating-IP: 83.248.192.164 X-Scan-Result: No virus found in message 1PsfwS-0005wN-4E. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1PsfwS-0005wN-4E c0d73142cdcee31a185c1170d0316a03 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 24 Feb 2011 18:29:41 +0000 (UTC) diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 7f552bf..ebcc02a 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -290,14 +290,6 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel goto ignore; } - if (field->report_type == HID_FEATURE_REPORT) { - if (device->driver->feature_mapping) { - device->driver->feature_mapping(device, hidinput, field, - usage); - } - goto ignore; - } - if (device->driver->input_mapping) { int ret = device->driver->input_mapping(device, hidinput, field, usage, &bit, &max); @@ -835,6 +827,24 @@ static void hidinput_close(struct input_dev *dev) hid_hw_close(hid); } +static void report_features(struct hid_device *hid) +{ + struct hid_driver *drv = hid->driver; + struct hid_report_enum *rep_enum; + struct hid_report *rep; + int i, j; + + if (!drv->feature_mapping) + return; + + rep_enum = &hid->report_enum[HID_FEATURE_REPORT]; + list_for_each_entry(rep, &rep_enum->report_list, list) + for (i = 0; i < rep->maxfield; i++) + for (j = 0; j < rep->field[i]->maxusage; j++) + drv->feature_mapping(hid, rep->field[i], + rep->field[i]->usage + j); +} + /* * Register the input device; print a message. * Configure the input layer interface @@ -863,7 +873,9 @@ int hidinput_connect(struct hid_device *hid, unsigned int force) return -1; } - for (k = HID_INPUT_REPORT; k <= HID_FEATURE_REPORT; k++) { + report_features(hid); + + for (k = HID_INPUT_REPORT; k <= HID_OUTPUT_REPORT; k++) { if (k == HID_OUTPUT_REPORT && hid->quirks & HID_QUIRK_SKIP_OUTPUT_REPORTS) continue; diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 07d3183..2bbc954 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -122,7 +122,7 @@ struct mt_class mt_classes[] = { { } }; -static void mt_feature_mapping(struct hid_device *hdev, struct hid_input *hi, +static void mt_feature_mapping(struct hid_device *hdev, struct hid_field *field, struct hid_usage *usage) { if (usage->hid == HID_DG_INPUTMODE) { diff --git a/include/linux/hid.h b/include/linux/hid.h index d91c25e..fc5faf6 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -638,7 +638,7 @@ struct hid_driver { struct hid_input *hidinput, struct hid_field *field, struct hid_usage *usage, unsigned long **bit, int *max); void (*feature_mapping)(struct hid_device *hdev, - struct hid_input *hidinput, struct hid_field *field, + struct hid_field *field, struct hid_usage *usage); #ifdef CONFIG_PM int (*suspend)(struct hid_device *hdev, pm_message_t message);