All of lore.kernel.org
 help / color / mirror / Atom feed
From: Enrik Berkhan <Enrik.Berkhan@inka.de>
To: linux-input@vger.kernel.org
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	Rishi Gupta <gupt21@gmail.com>,
	Enrik Berkhan <Enrik.Berkhan@inka.de>
Subject: [PATCH v1 1/4] HID: mcp2221: don't connect hidraw
Date: Mon, 26 Sep 2022 22:22:36 +0200	[thread overview]
Message-ID: <20220926202239.16379-2-Enrik.Berkhan@inka.de> (raw)
In-Reply-To: <20220926202239.16379-1-Enrik.Berkhan@inka.de>

The MCP2221 driver should not connect to the hidraw userspace interface,
as it needs exclusive access to the chip.

If you want to use /dev/hidrawX with the MCP2221, you need to avoid
binding this driver to the device and use the hid generic driver instead
(e.g. using udev rules).

Signed-off-by: Enrik Berkhan <Enrik.Berkhan@inka.de>
---
 drivers/hid/hid-mcp2221.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hid-mcp2221.c b/drivers/hid/hid-mcp2221.c
index de52e9f7bb8c..0ca2a7b96825 100644
--- a/drivers/hid/hid-mcp2221.c
+++ b/drivers/hid/hid-mcp2221.c
@@ -840,12 +840,17 @@ static int mcp2221_probe(struct hid_device *hdev,
 		return ret;
 	}
 
-	ret = hid_hw_start(hdev, HID_CONNECT_HIDRAW);
+	/* This driver uses the .raw_event callback and therefore does not need any
+	 * HID_CONNECT_xxx flags. */
+	ret = hid_hw_start(hdev, 0);
 	if (ret) {
 		hid_err(hdev, "can't start hardware\n");
 		return ret;
 	}
 
+	hid_info(hdev, "USB HID v%x.%02x Device [%s] on %s\n", hdev->version >> 8,
+			hdev->version & 0xff, hdev->name, hdev->phys);
+
 	ret = hid_hw_open(hdev);
 	if (ret) {
 		hid_err(hdev, "can't open device\n");
@@ -870,8 +875,7 @@ static int mcp2221_probe(struct hid_device *hdev,
 	mcp->adapter.retries = 1;
 	mcp->adapter.dev.parent = &hdev->dev;
 	snprintf(mcp->adapter.name, sizeof(mcp->adapter.name),
-			"MCP2221 usb-i2c bridge on hidraw%d",
-			((struct hidraw *)hdev->hidraw)->minor);
+			"MCP2221 usb-i2c bridge");
 
 	ret = i2c_add_adapter(&mcp->adapter);
 	if (ret) {
-- 
2.34.1


  reply	other threads:[~2022-09-26 21:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-26 20:22 [RESEND PATCH v1 0/4] Fixes for the mcp2221 HID-to-I2C-bridge driver Enrik Berkhan
2022-09-26 20:22 ` Enrik Berkhan [this message]
2022-09-26 20:22 ` [PATCH v1 2/4] HID: mcp2221: enable HID I/O during GPIO probe Enrik Berkhan
2022-09-26 20:22 ` [PATCH v1 3/4] HID: mcp2221: protect shared data with spin lock Enrik Berkhan
2022-09-26 20:22 ` [PATCH v1 4/4] HID: mcp2221: avoid stale rxbuf pointer Enrik Berkhan
2022-11-03 22:27 ` [PATCH v2 0/3] Fixes for the mcp2221 HID-to-I2C-bridge driver Enrik Berkhan
2022-11-03 22:27   ` [PATCH v2 1/3] HID: mcp2221: don't connect hidraw Enrik Berkhan
2022-12-19 14:11     ` Benjamin Tissoires
2022-11-03 22:27   ` [PATCH v2 2/3] HID: mcp2221: enable HID I/O during GPIO probe Enrik Berkhan
2022-11-03 22:27   ` [PATCH v2 3/3] HID: mcp2221: avoid stale rxbuf pointer Enrik Berkhan
  -- strict thread matches above, loose matches on Subject: below --
2022-08-30 18:02 [PATCH v1 0/4] Fixes for the mcp2221 HID-to-I2C-bridge driver Enrik Berkhan
2022-08-30 18:02 ` [PATCH v1 1/4] HID: mcp2221: don't connect hidraw Enrik Berkhan

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=20220926202239.16379-2-Enrik.Berkhan@inka.de \
    --to=enrik.berkhan@inka.de \
    --cc=gupt21@gmail.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.