From patchwork Thu Jan 31 16:22:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 2074421 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 279B5DF2E5 for ; Thu, 31 Jan 2013 16:30:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755175Ab3AaQaa (ORCPT ); Thu, 31 Jan 2013 11:30:30 -0500 Received: from mail-wg0-f45.google.com ([74.125.82.45]:48451 "EHLO mail-wg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751688Ab3AaQa3 (ORCPT ); Thu, 31 Jan 2013 11:30:29 -0500 Received: by mail-wg0-f45.google.com with SMTP id dq12so2127163wgb.0 for ; Thu, 31 Jan 2013 08:30:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:subject:date:message-id:x-mailer:in-reply-to :references; bh=pQx7syo80YAqjxTy3MisUaZeH1bNDypuXUdLYT9hDt0=; b=Hq5r0uQ9aFb4KfoMjjVvA/ydJXcu7nbZmFhsuBsV4fGt7vpXV2SVz37Z4hWyPXZeaz ZI6Q5O2pTyHMZKXdt8V+aD0JPmchNJFQB3gwsGYL46LSpPPYHhMjf6iF2EaH/36am8l5 V2ghux+U91MluxIuZZgMLUaxhI40+HvSUIo5+JmRg0mRB5vsVKIAIut03jz9+9531LaX ooiip6xM4dH+KCHalEWoWkptHlXHwdBWMiWOlyXa7YEj/Yc6nDHGvH/A6H8L/R/B1vat 84ET19loxPGFaMraEd0SAhP72kwryuVHUfrXoeJ0kWTqu4fAzes2CZk9Rs9tXu+rDnoF lv2g== X-Received: by 10.180.73.212 with SMTP id n20mr16055524wiv.11.1359649374818; Thu, 31 Jan 2013 08:22:54 -0800 (PST) Received: from localhost.localdomain.com (lan31-8-82-247-176-67.fbx.proxad.net. [82.247.176.67]) by mx.google.com with ESMTPS id ec3sm9846164wib.1.2013.01.31.08.22.52 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 31 Jan 2013 08:22:53 -0800 (PST) From: Benjamin Tissoires To: Benjamin Tissoires , Dmitry Torokhov , Henrik Rydberg , Jiri Kosina , Stephane Chatty , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/9] HID: core: add "report" hook, called once the report has been parsed Date: Thu, 31 Jan 2013 17:22:23 +0100 Message-Id: <1359649351-11092-2-git-send-email-benjamin.tissoires@gmail.com> X-Mailer: git-send-email 1.8.1 In-Reply-To: <1359649351-11092-1-git-send-email-benjamin.tissoires@gmail.com> References: <1359649351-11092-1-git-send-email-benjamin.tissoires@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org This callback is called when the parsing of the report has been done by hid-core (so after the calls to .event). The hid drivers can now have access to the whole report by relying on the values stored in the different fields. Signed-off-by: Benjamin Tissoires --- drivers/hid/hid-core.c | 4 ++++ include/linux/hid.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 5ae2cb1..b671e4e 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1195,6 +1195,7 @@ int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, { struct hid_report_enum *report_enum = hid->report_enum + type; struct hid_report *report; + struct hid_driver *hdrv; unsigned int a; int rsize, csize = size; u8 *cdata = data; @@ -1231,6 +1232,9 @@ int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, if (hid->claimed != HID_CLAIMED_HIDRAW) { for (a = 0; a < report->maxfield; a++) hid_input_field(hid, report->field[a], cdata, interrupt); + hdrv = hid->driver; + if (hdrv && hdrv->report) + hdrv->report(hid, report); } if (hid->claimed & HID_CLAIMED_INPUT) diff --git a/include/linux/hid.h b/include/linux/hid.h index 828726c..e14b465 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -589,6 +589,7 @@ struct hid_usage_id { * @raw_event: if report in report_table, this hook is called (NULL means nop) * @usage_table: on which events to call event (NULL means all) * @event: if usage in usage_table, this hook is called (NULL means nop) + * @report: this hook is called after parsing a report (NULL means nop) * @report_fixup: called before report descriptor parsing (NULL means nop) * @input_mapping: invoked on input registering before mapping an usage * @input_mapped: invoked on input registering after mapping an usage @@ -627,6 +628,7 @@ struct hid_driver { const struct hid_usage_id *usage_table; int (*event)(struct hid_device *hdev, struct hid_field *field, struct hid_usage *usage, __s32 value); + void (*report)(struct hid_device *hdev, struct hid_report *report); __u8 *(*report_fixup)(struct hid_device *hdev, __u8 *buf, unsigned int *size);