Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp502488imn; Tue, 26 Jul 2022 01:29:51 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uknJnKDfF/dZhtZ7tO42P0T2m+A/ZFgHgEeYdyPJHuYSrz7H3OX0avRXQvcYIHrnSAPXPa X-Received: by 2002:a05:6a00:a8b:b0:4cd:6030:4df3 with SMTP id b11-20020a056a000a8b00b004cd60304df3mr16404724pfl.40.1658824191549; Tue, 26 Jul 2022 01:29:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658824191; cv=none; d=google.com; s=arc-20160816; b=yJSlpDoFW/aQ4MPQB8K/A5lfF9ZPNSSD15shUvBtXwA/qBirpqdGy3bL7T9IY3GLoa 9wizBVd/7+rs8NNUaW9KmgVYxvDHQhBGc458NyIU8WQWgdsqsNLWrCgkfHqSXCKBGQHr UhqLWfA8gBRkdhLMAEUhKoEu87nb9XkpOycs56PCP7xjXJlB0K30ulHvlQoDA9/bsyOt 7zh5V95evwPpc9FXvfGwNWanNb85CyjTJa+5xGSeF1kINcUXQckp04FR4hAXn3e3v32u 1Pef0wjvv3UoBjz5qwNX8uwZ8ynx40MwrwWlIa3vpBx0sxy/0t6jWDFzdgSKde1bHIqA qX1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=jNd57rxcgORv8yodjUK2q3rmg/Mmvv+7fzvKACi1t7Y=; b=zfdqJN06G+2K6McGKHLYRR1zHhV0z9bf+dxyXRWl7Cz50jE21R3QsoUl+11YC7oX+v luVATjruSbXu84d4pFeAz/CGuO1B+2E/6umQbkItt3DfUpoQL6DupSgc0j0cjDlM0Tka mKRvEuk24exVDl6G6LIVkjEgXV1URxKXcIaTPKo7F78GWzL1rkrAsJLAgmWE6N8JCigG CNWI+ZB1r7wVN7gFcv7doSMc6TRqpaSekMBUchhS4S3ob8Gd9nQ/hksazvJHKzoFfuKK 9cBEMbZsnUElizZm+dhmInXlYDPkfB4Z9og5h1E1BqxYa2+9XiFvaHX8AizbHKJsfypb qX6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=B3c1Gvvs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 78-20020a630051000000b0040dbc216491si17519247pga.823.2022.07.26.01.29.37; Tue, 26 Jul 2022 01:29:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=B3c1Gvvs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238077AbiGZIFX (ORCPT + 99 others); Tue, 26 Jul 2022 04:05:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238245AbiGZIFU (ORCPT ); Tue, 26 Jul 2022 04:05:20 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 357A06466; Tue, 26 Jul 2022 01:05:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658822718; x=1690358718; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=EASm9B3SSa1L11yX9tNoIuowNnNMNvB6r5SRcH0bz/o=; b=B3c1GvvsZmNs2zQVX/lXSQJPouLmkGFP7HFobNvk6jkOnGBmvZAKv7ir pnX7Pzk0zRMUlFE3+ojfYoRZ9D0YafWrsbqDOq9SdejR5TcBhST5/FcTr o7owfrG+aVIOQvtYppiTE37FVmlHI3jQ/XiIhvlt9IETI7ukcxF1pdlUs ecXbx3NATuLVPVJ9jhD0o+xkuknAIRF8XVUJmyJmhGyEu0c0ISW1yZHGN CFCxlQpZ0H869S2LBwpHGDw/pySBxLR7I9NrRAKPFuillnz3PdRs2c92J Tn4VH7AfEjeRR50HwIs7aBHEeHWxJJwW7w+pBi7a0onNHQgiMIs38i5xl Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10419"; a="287902192" X-IronPort-AV: E=Sophos;i="5.93,193,1654585200"; d="scan'208";a="287902192" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jul 2022 01:05:09 -0700 X-IronPort-AV: E=Sophos;i="5.93,193,1654585200"; d="scan'208";a="658568779" Received: from icoprean-mobl1.ger.corp.intel.com (HELO tkristo-desk.intel.com) ([10.252.56.129]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jul 2022 01:05:07 -0700 From: Tero Kristo To: linux-input@vger.kernel.org, benjamin.tissoires@redhat.com, jikos@kernel.org Cc: linux-kernel@vger.kernel.org, dmitry.torokhov@gmail.com Subject: [PATCH] HID: i2c-hid: fix the report-id passed in via set_or_send_report Date: Tue, 26 Jul 2022 11:05:04 +0300 Message-Id: <20220726080504.4185715-1-tero.kristo@linux.intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The formatting of the data passed to the i2c HID data register was changed with the re-work of the i2c-hid-core. Previously the report ID passed in was encoded as 0xF if the report-id was greater than 0xF (similar to what is done with the command portion.) Now with the rework, a full report-id is passed in always, and this causes the messages to be rejected by the i2c controller. Fix this by encoding the report-id field in the same manner as previously was done. Fixes: dbe0dd5fd2e0 ("HID: i2c-hid: explicitly code setting and sending reports") Signed-off-by: Tero Kristo --- drivers/hid/i2c-hid/i2c-hid-core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c index c078f09a2318..156b12f840c4 100644 --- a/drivers/hid/i2c-hid/i2c-hid-core.c +++ b/drivers/hid/i2c-hid/i2c-hid-core.c @@ -296,6 +296,9 @@ static size_t i2c_hid_format_report(u8 *buf, int report_id, { size_t length = sizeof(__le16); /* reserve space to store size */ + if (report_id > 0xF) + report_id = 0xF; + if (report_id) buf[length++] = report_id; -- 2.25.1