Skip to contentSkip to conversation

HID: Show I2C bus type in hid_connect()

PATCH Applied Mika Westerberg 4 participants 6 messages Sep 28, 2015 – Sep 29, 2015 HID

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 HID: Show I2C bus type in hid_connect()

For I2C HID devices output currently looks like:

hid-multitouch ... input,hidraw0: <UNKNOWN> HID v1.00 Mouse ...

Add knowledge about I2C bus to hid_connect() so that it shows "I2C" correctly instead of "<UNKNOWN>".

---
 drivers/hid/hid-core.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/hid/hid-core.c +3 -0
index 70a11ac38119..7f1baba081a1 100644
@@ -1678,6 +1678,9 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
 	case BUS_BLUETOOTH:
 		bus = "BLUETOOTH";
 		break;
+	case BUS_I2C:
+		bus = "I2C";
+		break;
 	default:
 		bus = "<UNKNOWN>";
 	}
Signature · 1 line
2.5.1
#1 lore raw

PATCH 2/2 HID: i2c-hid: Fill in physical device providing HID functionality

Currently hid_connect() prints out following when I2C connected HID devices is connected:

hid-multitouch 0018:03EB:2136.0001: ... [ATML3432:00 03EB:2136] on

After "on " should read physical device name but it is left empty by the driver.

Make it look better and fill in the physical device name.

---
 drivers/hid/i2c-hid/i2c-hid.c | 1 +
 1 file changed, 1 insertion(+)
drivers/hid/i2c-hid/i2c-hid.c +1 -0
index 2871f3c81a4c..10bd8e6e4c9c 100644
@@ -1028,6 +1028,7 @@ static int i2c_hid_probe(struct i2c_client *client,
 
 	snprintf(hid->name, sizeof(hid->name), "%s %04hX:%04hX",
 		 client->name, hid->vendor, hid->product);
+	strlcpy(hid->phys, dev_name(&client->dev), sizeof(hid->phys));
 
 	ret = hid_add_device(hid);
 	if (ret) {
Signature · 1 line
2.5.1
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] HID: i2c-hid: Fill in physical device providing HID functionality

Quoted 20 lines · Mika Westerberg

Currently hid_connect() prints out following when I2C connected HID devices is connected:

hid-multitouch 0018:03EB:2136.0001: ... [ATML3432:00 03EB:2136] on

After "on " should read physical device name but it is left empty by the driver.

Make it look better and fill in the physical device name.

---
 drivers/hid/i2c-hid/i2c-hid.c | 1 +
 1 file changed, 1 insertion(+)
drivers/hid/i2c-hid/i2c-hid.c +0 -0
index 2871f3c81a4c..10bd8e6e4c9c 100644

drivers/hid/i2c-hid/i2c-hid.c static int i2c_hid_probe(struct i2c_client *client,

Quoted 8 lines
drivers/hid/i2c-hid/i2c-hid.c +1 -1
@@ -1028,6 +1028,7 @@ static int i2c_hid_probe(struct i2c_client *client,
 
        snprintf(hid->name, sizeof(hid->name), "%s %04hX:%04hX",
                 client->name, hid->vendor, hid->product);
+       strlcpy(hid->phys, dev_name(&client->dev), sizeof(hid->phys));
 
        ret = hid_add_device(hid);
        if (ret) {
--

Tested and

Acked-by on v1 2/2
#3 lore raw

Re: [PATCH 2/2] HID: i2c-hid: Fill in physical device providing HID functionality

In reply to Mika Westerberg
Quoted 5 lines · Mika Westerberg

Currently hid_connect() prints out following when I2C connected HID devices is connected:

hid-multitouch 0018:03EB:2136.0001: ... [ATML3432:00 03EB:2136] on

Quoted 7 lines

After "on " should read physical device name but it is left empty by the driver.

Make it look better and fill in the physical device name.

---

Cheers,
Benjamin

Quoted 18 lines
 drivers/hid/i2c-hid/i2c-hid.c | 1 +
 1 file changed, 1 insertion(+)
drivers/hid/i2c-hid/i2c-hid.c +1 -0
index 2871f3c81a4c..10bd8e6e4c9c 100644
@@ -1028,6 +1028,7 @@ static int i2c_hid_probe(struct i2c_client *client,
 
 	snprintf(hid->name, sizeof(hid->name), "%s %04hX:%04hX",
 		 client->name, hid->vendor, hid->product);
+	strlcpy(hid->phys, dev_name(&client->dev), sizeof(hid->phys));
 
 	ret = hid_add_device(hid);
 	if (ret) {
Signature · 1 line
2.5.1
maintainer Applied
#4 lore raw

Re: [PATCH 2/2] HID: i2c-hid: Fill in physical device providing HID functionality

In reply to Mika Westerberg
Quoted 11 lines · Mika Westerberg

Currently hid_connect() prints out following when I2C connected HID devices is connected:

hid-multitouch 0018:03EB:2136.0001: ... [ATML3432:00 03EB:2136] on

After "on " should read physical device name but it is left empty by the driver.

Make it look better and fill in the physical device name.

Applied to hid.git#for-4.4/i2c-hid.

Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs
#5 lore raw
In reply to Mika Westerberg
Quoted 17 lines · Mika Westerberg

For I2C HID devices output currently looks like:

hid-multitouch ... input,hidraw0: <UNKNOWN> HID v1.00 Mouse ...

Add knowledge about I2C bus to hid_connect() so that it shows "I2C" correctly instead of "<UNKNOWN>".

---
 drivers/hid/hid-core.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/hid/hid-core.c +0 -0
index 70a11ac38119..7f1baba081a1 100644

drivers/hid/hid-core.c int hid_connect(struct hid_device *hdev, unsigned int connect_mask) · line 1686

Quoted 9 lines
drivers/hid/hid-core.c +3 -0
@@ -1678,6 +1678,9 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
        case BUS_BLUETOOTH:
                bus = "BLUETOOTH";
                break;
+       case BUS_I2C:
+               bus = "I2C";
+               break;
        default:
                bus = "<UNKNOWN>";
        }

Already queued:

    https://git.kernel.org/cgit/linux/kernel/git/jikos/hid.git/commit/?h=for-4.4/upstream&id=0678072755b6672b19ee0fd42748a003912fca09