Skip to content

Commit 67c90d1

Browse files
enrikbbentiss
authored andcommitted
HID: mcp2221: don't connect hidraw
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). Cc: [email protected] Reported-by: Sven Zühlsdorf <[email protected]> Signed-off-by: Enrik Berkhan <[email protected]> Signed-off-by: Benjamin Tissoires <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 0e13e7b commit 67c90d1

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

drivers/hid/hid-mcp2221.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,12 +1110,19 @@ static int mcp2221_probe(struct hid_device *hdev,
11101110
return ret;
11111111
}
11121112

1113-
ret = hid_hw_start(hdev, HID_CONNECT_HIDRAW);
1113+
/*
1114+
* This driver uses the .raw_event callback and therefore does not need any
1115+
* HID_CONNECT_xxx flags.
1116+
*/
1117+
ret = hid_hw_start(hdev, 0);
11141118
if (ret) {
11151119
hid_err(hdev, "can't start hardware\n");
11161120
return ret;
11171121
}
11181122

1123+
hid_info(hdev, "USB HID v%x.%02x Device [%s] on %s\n", hdev->version >> 8,
1124+
hdev->version & 0xff, hdev->name, hdev->phys);
1125+
11191126
ret = hid_hw_open(hdev);
11201127
if (ret) {
11211128
hid_err(hdev, "can't open device\n");
@@ -1145,8 +1152,7 @@ static int mcp2221_probe(struct hid_device *hdev,
11451152
mcp->adapter.retries = 1;
11461153
mcp->adapter.dev.parent = &hdev->dev;
11471154
snprintf(mcp->adapter.name, sizeof(mcp->adapter.name),
1148-
"MCP2221 usb-i2c bridge on hidraw%d",
1149-
((struct hidraw *)hdev->hidraw)->minor);
1155+
"MCP2221 usb-i2c bridge");
11501156

11511157
ret = devm_i2c_add_adapter(&hdev->dev, &mcp->adapter);
11521158
if (ret) {

0 commit comments

Comments
 (0)