Skip to contentSkip to conversation

HID: extend autodetect to handle I2C sensors as well

PATCH In review Mika Westerberg 5 participants 24 messages Feb 11, 2013 – Feb 25, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 HID: extend autodetect to handle I2C sensors as well

Since the advent of HID over I2C protocol, it is possible to have sensor hubs behind I2C bus as well. We can autodetect this in a same way than USB sensor hubs.

---
 drivers/hid/hid-core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-core.c +1 -1
index eb2ee11..fe3a59e 100644
@@ -729,7 +729,7 @@ static int hid_scan_report(struct hid_device *hid)
 			item.type == HID_ITEM_TYPE_MAIN &&
 			item.tag == HID_MAIN_ITEM_TAG_BEGIN_COLLECTION &&
 			(item_udata(&item) & 0xff) == HID_COLLECTION_PHYSICAL &&
-			hid->bus == BUS_USB)
+			(hid->bus == BUS_USB || hid->bus == BUS_I2C))
 			hid->group = HID_GROUP_SENSOR_HUB;
 	}
 
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 2/3 HID: sensor-hub: get rid of unused sensor_hub_grabbed_usages[] table

This table is not used anywhere in the driver so kill it.

---
 drivers/hid/hid-sensor-hub.c |    5 -----
 1 file changed, 5 deletions(-)
drivers/hid/hid-sensor-hub.c +0 -5
index c06e933..2643bce9 100644
@@ -608,11 +608,6 @@ static const struct hid_device_id sensor_hub_devices[] = {
 };
 MODULE_DEVICE_TABLE(hid, sensor_hub_devices);
 
-static const struct hid_usage_id sensor_hub_grabbed_usages[] = {
-	{ HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
-	{ HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1 }
-};
-
 static struct hid_driver sensor_hub_driver = {
 	.name = "hid-sensor-hub",
 	.id_table = sensor_hub_devices,
Signature · 1 line
1.7.10.4
#2 lore raw

Re: [PATCH 2/3] HID: sensor-hub: get rid of unused sensor_hub_grabbed_usages[] table

Quoted 4 lines · Mika Westerberg

This table is not used anywhere in the driver so kill it.

---

Yep, it's rather strange that the compiler didn't complained... Anyway, Reviewed-by: Benjamin Tissoires <[email protected]>

Cheers,
Benjamin

#3 lore raw

RE: [PATCH 2/3] HID: sensor-hub: get rid of unused sensor_hub_grabbed_usages[] table

In reply to Mika Westerberg

This was added to load sensor hub driver on USB plug in without explicit modprobe. But with last few changes to remove vendor and product id, we need to do modprobe this driver. So removal is OK.

Thanks,
Srinivas

-----Original Message-----
From: Mika Westerberg [mailto:[email protected]]
Sent: Monday, February 11, 2013 2:31 AM
To: [email protected]
Cc: Jiri Kosina; Benjamin Tissoires; [email protected]; Pandruvada, Srinivas; Mika Westerberg
Subject: [PATCH 2/3] HID: sensor-hub: get rid of unused sensor_hub_grabbed_usages[] table

This table is not used anywhere in the driver so kill it.

---
 drivers/hid/hid-sensor-hub.c |    5 -----
 1 file changed, 5 deletions(-)
drivers/hid/hid-sensor-hub.c +0 -6
@@ -608,11 +608,6 @@ static const struct hid_device_id sensor_hub_devices[] = {  };  MODULE_DEVICE_TABLE(hid, sensor_hub_devices);
 
-static const struct hid_usage_id sensor_hub_grabbed_usages[] = {
-	{ HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
-	{ HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1 }
-};
-
 static struct hid_driver sensor_hub_driver = {
 	.name = "hid-sensor-hub",
 	.id_table = sensor_hub_devices,
--

1.7.10.4

#4 lore raw

Re: [PATCH 2/3] HID: sensor-hub: get rid of unused sensor_hub_grabbed_usages[] table

Quoted 3 lines · Srinivas

This was added to load sensor hub driver on USB plug in without explicit modprobe. But with last few changes to remove vendor and product id, we need to do modprobe this driver. So removal is OK.

I just figure your comment out: the change does not seem to have anything to do with hotplugging. .usage_table is used to decide which HID reports to forwards to the .event() callback, and NULL means all events. So even if it was in use, there are no functional changes.

Thanks to the changes to remove the vendor id and product id, you shouldn't have to manually modprobe the driver as the hid-core subsystem will tag the hid device as a sensor one, meaning that udev will modprobe the driver if it's not already loaded.
So if you still have to manually modprobe your driver (or maybe you are talking about the mfd driver), there is a bug in the detection of sensors devices. And this has to be fixed :)

Cheers,
Benjamin

#5 lore raw

RE: [PATCH 2/3] HID: sensor-hub: get rid of unused sensor_hub_grabbed_usages[] table

In reply to Pandruvada, Srinivas
Quoted 3 lines · Srinivas

This was added to load sensor hub driver on USB plug in without explicit modprobe. But with last few changes to remove vendor and product id, we need to do modprobe this driver. So removal is OK.

Srinivas,

sorry, I have a hard time parsing your message.

The modprobing should work just fine with HID_GROUP_SENSOR_HUB, this has nothing to do with ->usage_table callback.

Signature · 2 lines
Jiri Kosina
SUSE Labs
#6 lore raw

PATCH 3/3 HID: sensor-hub: don't limit the driver only to USB bus

In reply to Mika Westerberg

We now have two transport mediums: USB and I2C, where sensor hubs can exists. So instead of constraining the driver to only these two we let it to match any HID bus as long as the group is HID_GROUP_SENSOR_HUB.

---
 drivers/hid/hid-sensor-hub.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/hid-sensor-hub.c +2 -1
index 2643bce9..c01f10d 100644
@@ -603,7 +603,8 @@ static void sensor_hub_remove(struct hid_device *hdev)
 }
 
 static const struct hid_device_id sensor_hub_devices[] = {
-	{ HID_DEVICE(BUS_USB, HID_GROUP_SENSOR_HUB, HID_ANY_ID, HID_ANY_ID) },
+	{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, HID_ANY_ID,
+		     HID_ANY_ID) },
 	{ }
 };
 MODULE_DEVICE_TABLE(hid, sensor_hub_devices);
Signature · 1 line
1.7.10.4
Reviewed-by on v1 3/3
#7 lore raw

Re: [PATCH 3/3] HID: sensor-hub: don't limit the driver only to USB bus

Quoted 5 lines · Mika Westerberg

We now have two transport mediums: USB and I2C, where sensor hubs can exists. So instead of constraining the driver to only these two we let it to match any HID bus as long as the group is HID_GROUP_SENSOR_HUB.

Thanks Mika for this series!

Cheers,
Benjamin

#8 lore raw

Re: [PATCH 3/3] HID: sensor-hub: don't limit the driver only to USB bus

Quoted 7 lines · Benjamin Tissoires
Quoted 5 lines

We now have two transport mediums: USB and I2C, where sensor hubs can exists. So instead of constraining the driver to only these two we let it to match any HID bus as long as the group is HID_GROUP_SENSOR_HUB.

Thanks a lot Mika, I have now applied the series for 3.9

Signature · 2 lines
Jiri Kosina
SUSE Labs
#9 lore raw

RE: [PATCH 3/3] HID: sensor-hub: don't limit the driver only to USB bus

In reply to Mika Westerberg

So finally we can use HID sensor hub over I2C.
Did you try with any I2C sensor hub?

Thanks,
Srinivas

-----Original Message-----
From: Mika Westerberg [mailto:[email protected]]
Sent: Monday, February 11, 2013 2:31 AM
To: [email protected]
Cc: Jiri Kosina; Benjamin Tissoires; [email protected]; Pandruvada, Srinivas; Mika Westerberg
Subject: [PATCH 3/3] HID: sensor-hub: don't limit the driver only to USB bus

We now have two transport mediums: USB and I2C, where sensor hubs can exists. So instead of constraining the driver to only these two we let it to match any HID bus as long as the group is HID_GROUP_SENSOR_HUB.

---
 drivers/hid/hid-sensor-hub.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/hid-sensor-hub.c +2 -2
@@ -603,7 +603,8 @@ static void sensor_hub_remove(struct hid_device *hdev)  }
 
 static const struct hid_device_id sensor_hub_devices[] = {
-	{ HID_DEVICE(BUS_USB, HID_GROUP_SENSOR_HUB, HID_ANY_ID, HID_ANY_ID) },
+	{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, HID_ANY_ID,
+		     HID_ANY_ID) },
 	{ }
 };
 MODULE_DEVICE_TABLE(hid, sensor_hub_devices);
--

1.7.10.4

#10 lore raw

Re: [PATCH 3/3] HID: sensor-hub: don't limit the driver only to USB bus

Quoted 2 lines · Srinivas

So finally we can use HID sensor hub over I2C.
Did you try with any I2C sensor hub?

Yes, we have I2C HID sensor hub here and I tested with it. However, I'm not that familiar how it should be used except that I can see the sensors under /sys/bus/platform/devices/HID-SENSOR* and there are iio devices under each platform device.

#11 lore raw

Re: [PATCH 3/3] HID: sensor-hub: don't limit the driver only to USB bus

In reply to Mika Westerberg

Am 11.02.2013 11:31, schrieb Mika Westerberg:

Quoted 15 lines

We now have two transport mediums: USB and I2C, where sensor hubs can exists. So instead of constraining the driver to only these two we let it to match any HID bus as long as the group is HID_GROUP_SENSOR_HUB.

---
  drivers/hid/hid-sensor-hub.c |    3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/hid-sensor-hub.c +0 -0
index 2643bce9..c01f10d 100644

drivers/hid/hid-sensor-hub.c static void sensor_hub_remove(struct hid_device *hdev) · line 610

Quoted 9 lines
drivers/hid/hid-sensor-hub.c +2 -1
@@ -603,7 +603,8 @@ static void sensor_hub_remove(struct hid_device *hdev)
  }
 
  static const struct hid_device_id sensor_hub_devices[] = {
-	{ HID_DEVICE(BUS_USB, HID_GROUP_SENSOR_HUB, HID_ANY_ID, HID_ANY_ID) },
+	{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, HID_ANY_ID,
+		     HID_ANY_ID) },
  	{ }
  };
  MODULE_DEVICE_TABLE(hid, sensor_hub_devices);

Hmm, what happens with Bluetooth sensor-hubs? Is the driver now able to handle them too?

Regards,

Alexander

#12 lore raw

Re: [PATCH 3/3] HID: sensor-hub: don't limit the driver only to USB bus

Quoted 17 lines · Alexander Holler

Am 11.02.2013 11:31, schrieb Mika Westerberg:

Quoted 16 lines

We now have two transport mediums: USB and I2C, where sensor hubs can exists. So instead of constraining the driver to only these two we let it to match any HID bus as long as the group is HID_GROUP_SENSOR_HUB.

---
 drivers/hid/hid-sensor-hub.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/hid-sensor-hub.c +0 -0
index 2643bce9..c01f10d 100644
@@ -603,7 +603,8 @@ static void sensor_hub_remove(struct hid_device *hdev)
 }
 
Quoted 11 lines

drivers/hid/hid-sensor-hub.c static void sensor_hub_remove(struct hid_device *hdev) · line 610

Quoted 8 lines
drivers/hid/hid-sensor-hub.c +2 -1
 static const struct hid_device_id sensor_hub_devices[] = {
-	{ HID_DEVICE(BUS_USB, HID_GROUP_SENSOR_HUB, HID_ANY_ID, HID_ANY_ID) },
+	{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, HID_ANY_ID,
+		     HID_ANY_ID) },
 	{ }
 };
 MODULE_DEVICE_TABLE(hid, sensor_hub_devices);

Hmm, what happens with Bluetooth sensor-hubs? Is the driver now able to handle them too?

It should, yes.

#13 lore raw

Re: [PATCH 3/3] HID: sensor-hub: don't limit the driver only to USB bus

Am 18.02.2013 12:12, schrieb Mika Westerberg:

Quoted 30 lines · Alexander Holler
Quoted 17 lines

Am 11.02.2013 11:31, schrieb Mika Westerberg:

Quoted 16 lines

We now have two transport mediums: USB and I2C, where sensor hubs can exists. So instead of constraining the driver to only these two we let it to match any HID bus as long as the group is HID_GROUP_SENSOR_HUB.

---
  drivers/hid/hid-sensor-hub.c |    3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/hid-sensor-hub.c +0 -0
index 2643bce9..c01f10d 100644
@@ -603,7 +603,8 @@ static void sensor_hub_remove(struct hid_device *hdev)
  }
 
Quoted 11 lines

drivers/hid/hid-sensor-hub.c static void sensor_hub_remove(struct hid_device *hdev) · line 610

Quoted 8 lines
drivers/hid/hid-sensor-hub.c +2 -1
  static const struct hid_device_id sensor_hub_devices[] = {
-	{ HID_DEVICE(BUS_USB, HID_GROUP_SENSOR_HUB, HID_ANY_ID, HID_ANY_ID) },
+	{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, HID_ANY_ID,
+		     HID_ANY_ID) },
  	{ }
  };
  MODULE_DEVICE_TABLE(hid, sensor_hub_devices);

Hmm, what happens with Bluetooth sensor-hubs? Is the driver now able to handle them too?

Quoted 1 line

It should, yes.

If so, I think patch 1/3 should be modified accordingly.

Regards,

Alexander

#14 lore raw

Re: [PATCH 3/3] HID: sensor-hub: don't limit the driver only to USB bus

Quoted 31 lines · Alexander Holler

Am 18.02.2013 12:12, schrieb Mika Westerberg:

Quoted 30 lines · Alexander Holler
Quoted 28 lines

Am 11.02.2013 11:31, schrieb Mika Westerberg:

Quoted 15 lines

We now have two transport mediums: USB and I2C, where sensor hubs can exists. So instead of constraining the driver to only these two we let it to match any HID bus as long as the group is HID_GROUP_SENSOR_HUB.

---
 drivers/hid/hid-sensor-hub.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/hid-sensor-hub.c +0 -0
index 2643bce9..c01f10d 100644

drivers/hid/hid-sensor-hub.c static void sensor_hub_remove(struct hid_device *hdev) · line 610

Quoted 9 lines
drivers/hid/hid-sensor-hub.c +2 -1
@@ -603,7 +603,8 @@ static void sensor_hub_remove(struct hid_device *hdev)
 }
 
 static const struct hid_device_id sensor_hub_devices[] = {
-	{ HID_DEVICE(BUS_USB, HID_GROUP_SENSOR_HUB, HID_ANY_ID, HID_ANY_ID) },
+	{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, HID_ANY_ID,
+		     HID_ANY_ID) },
 	{ }
 };
 MODULE_DEVICE_TABLE(hid, sensor_hub_devices);

Hmm, what happens with Bluetooth sensor-hubs? Is the driver now able to handle them too?

Quoted 3 lines
Quoted 1 line

It should, yes.

If so, I think patch 1/3 should be modified accordingly.

Do you know if such devices exists currently? If not, I'm not sure if it makes sense to do that now.

#15 lore raw

Re: [PATCH 3/3] HID: sensor-hub: don't limit the driver only to USB bus

Am 18.02.2013 12:33, schrieb Mika Westerberg:

Quoted 32 lines · Alexander Holler
Quoted 31 lines

Am 18.02.2013 12:12, schrieb Mika Westerberg:

Quoted 30 lines · Alexander Holler
Quoted 28 lines

Am 11.02.2013 11:31, schrieb Mika Westerberg:

Quoted 15 lines

We now have two transport mediums: USB and I2C, where sensor hubs can exists. So instead of constraining the driver to only these two we let it to match any HID bus as long as the group is HID_GROUP_SENSOR_HUB.

---
  drivers/hid/hid-sensor-hub.c |    3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/hid-sensor-hub.c +0 -0
index 2643bce9..c01f10d 100644

drivers/hid/hid-sensor-hub.c static void sensor_hub_remove(struct hid_device *hdev) · line 610

Quoted 9 lines
drivers/hid/hid-sensor-hub.c +2 -1
@@ -603,7 +603,8 @@ static void sensor_hub_remove(struct hid_device *hdev)
  }
 
  static const struct hid_device_id sensor_hub_devices[] = {
-	{ HID_DEVICE(BUS_USB, HID_GROUP_SENSOR_HUB, HID_ANY_ID, HID_ANY_ID) },
+	{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, HID_ANY_ID,
+		     HID_ANY_ID) },
  	{ }
  };
  MODULE_DEVICE_TABLE(hid, sensor_hub_devices);

Hmm, what happens with Bluetooth sensor-hubs? Is the driver now able to handle them too?

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

It should, yes.

If so, I think patch 1/3 should be modified accordingly.

Do you know if such devices exists currently? If not, I'm not sure if it makes sense to do that now.

The CC2541DK-SENSOR from TI looks like one. But I'm not sure as I don't have one. Besides that, I think Bluetooth (especially with BT4LE) will be by far the most used bus for sensors hubs.

Regards,

Alexander

#16 lore raw

Re: [PATCH 3/3] HID: sensor-hub: don't limit the driver only to USB bus

Quoted 35 lines · Alexander Holler

Am 18.02.2013 12:33, schrieb Mika Westerberg:

Quoted 34 lines · Alexander Holler
Quoted 33 lines

Am 18.02.2013 12:12, schrieb Mika Westerberg:

Quoted 31 lines · Alexander Holler
Quoted 17 lines

Am 11.02.2013 11:31, schrieb Mika Westerberg:

Quoted 16 lines

We now have two transport mediums: USB and I2C, where sensor hubs can exists. So instead of constraining the driver to only these two we let it to match any HID bus as long as the group is HID_GROUP_SENSOR_HUB.

---
 drivers/hid/hid-sensor-hub.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/hid-sensor-hub.c +0 -0
index 2643bce9..c01f10d 100644
@@ -603,7 +603,8 @@ static void sensor_hub_remove(struct hid_device *hdev)
 }
 
Quoted 11 lines

drivers/hid/hid-sensor-hub.c static void sensor_hub_remove(struct hid_device *hdev) · line 610

Quoted 8 lines
drivers/hid/hid-sensor-hub.c +2 -1
 static const struct hid_device_id sensor_hub_devices[] = {
-	{ HID_DEVICE(BUS_USB, HID_GROUP_SENSOR_HUB, HID_ANY_ID, HID_ANY_ID) },
+	{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, HID_ANY_ID,
+		     HID_ANY_ID) },
 	{ }
 };
 MODULE_DEVICE_TABLE(hid, sensor_hub_devices);

Hmm, what happens with Bluetooth sensor-hubs? Is the driver now able to handle them too?

It should, yes.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

If so, I think patch 1/3 should be modified accordingly.

Do you know if such devices exists currently? If not, I'm not sure if it makes sense to do that now.

The CC2541DK-SENSOR from TI looks like one. But I'm not sure as I don't have one. Besides that, I think Bluetooth (especially with BT4LE) will be by far the most used bus for sensors hubs.

OK, thanks.

In that case I think it's best to remove the explicit bus check from the condition completely and rely on the fact that page == HID_UP_SENSOR.

Since Jiri already applied this patch, I can make an incremental patch which removes the explicit bus check, if there are no objections.

#17 lore raw

Re: [PATCH 3/3] HID: sensor-hub: don't limit the driver only to USB bus

Am 18.02.2013 12:54, schrieb Mika Westerberg:

Quoted 45 lines · Alexander Holler
Quoted 35 lines

Am 18.02.2013 12:33, schrieb Mika Westerberg:

Quoted 34 lines · Alexander Holler
Quoted 33 lines

Am 18.02.2013 12:12, schrieb Mika Westerberg:

Quoted 31 lines · Alexander Holler
Quoted 17 lines

Am 11.02.2013 11:31, schrieb Mika Westerberg:

Quoted 16 lines

We now have two transport mediums: USB and I2C, where sensor hubs can exists. So instead of constraining the driver to only these two we let it to match any HID bus as long as the group is HID_GROUP_SENSOR_HUB.

---
  drivers/hid/hid-sensor-hub.c |    3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/hid-sensor-hub.c +0 -0
index 2643bce9..c01f10d 100644
@@ -603,7 +603,8 @@ static void sensor_hub_remove(struct hid_device *hdev)
  }
 
Quoted 11 lines

drivers/hid/hid-sensor-hub.c static void sensor_hub_remove(struct hid_device *hdev) · line 610

Quoted 8 lines
drivers/hid/hid-sensor-hub.c +2 -1
  static const struct hid_device_id sensor_hub_devices[] = {
-	{ HID_DEVICE(BUS_USB, HID_GROUP_SENSOR_HUB, HID_ANY_ID, HID_ANY_ID) },
+	{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, HID_ANY_ID,
+		     HID_ANY_ID) },
  	{ }
  };
  MODULE_DEVICE_TABLE(hid, sensor_hub_devices);

Hmm, what happens with Bluetooth sensor-hubs? Is the driver now able to handle them too?

It should, yes.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

If so, I think patch 1/3 should be modified accordingly.

Do you know if such devices exists currently? If not, I'm not sure if it makes sense to do that now.

The CC2541DK-SENSOR from TI looks like one. But I'm not sure as I don't have one. Besides that, I think Bluetooth (especially with BT4LE) will be by far the most used bus for sensors hubs.

Quoted 8 lines

OK, thanks.

In that case I think it's best to remove the explicit bus check from the condition completely and rely on the fact that page == HID_UP_SENSOR.

Since Jiri already applied this patch, I can make an incremental patch which removes the explicit bus check, if there are no objections.

I just had a deeper look at the spec for that TI device. Looks like the default firmware uses GATT and not HID. But nevertheless, if the driver does support Bluetooth too, I think enabling it makes sense.

Regards,

Alexander

#18 lore raw

PATCH 1/1 HID: make sensor autodetection independent of underlying bus

Instead of limiting HID sensors to USB and I2C busses we can just make everything that has usage page of HID_UP_SENSOR to be included in HID_GROUP_SENSOR_HUB group. This allows the sensor-hub to work over bluetooth (and other transports) as well.

---
 drivers/hid/hid-core.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/hid/hid-core.c +1 -2
index fe3a59e..f89e902 100644
@@ -728,8 +728,7 @@ static int hid_scan_report(struct hid_device *hid)
 		} else if (page == HID_UP_SENSOR &&
 			item.type == HID_ITEM_TYPE_MAIN &&
 			item.tag == HID_MAIN_ITEM_TAG_BEGIN_COLLECTION &&
-			(item_udata(&item) & 0xff) == HID_COLLECTION_PHYSICAL &&
-			(hid->bus == BUS_USB || hid->bus == BUS_I2C))
+			(item_udata(&item) & 0xff) == HID_COLLECTION_PHYSICAL)
 			hid->group = HID_GROUP_SENSOR_HUB;
 	}
 
Signature · 1 line
1.7.10.4
Reviewed-by on v1 1/1
#19 lore raw

Re: [PATCH] HID: make sensor autodetection independent of underlying bus

Quoted 7 lines · Mika Westerberg

Instead of limiting HID sensors to USB and I2C busses we can just make everything that has usage page of HID_UP_SENSOR to be included in HID_GROUP_SENSOR_HUB group. This allows the sensor-hub to work over bluetooth (and other transports) as well.

Cheers,
Benjamin

Quoted 21 lines
---
 drivers/hid/hid-core.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/hid/hid-core.c +1 -3
index fe3a59e..f89e902 100644
@@ -728,8 +728,7 @@ static int hid_scan_report(struct hid_device *hid)
                } else if (page == HID_UP_SENSOR &&
                        item.type == HID_ITEM_TYPE_MAIN &&
                        item.tag == HID_MAIN_ITEM_TAG_BEGIN_COLLECTION &&
-                       (item_udata(&item) & 0xff) == HID_COLLECTION_PHYSICAL &&
-                       (hid->bus == BUS_USB || hid->bus == BUS_I2C))
+                       (item_udata(&item) & 0xff) == HID_COLLECTION_PHYSICAL)
                        hid->group = HID_GROUP_SENSOR_HUB;
        }
 
--

1.7.10.4

Applied
#20 lore raw

Re: [PATCH] HID: make sensor autodetection independent of underlying bus

Quoted 9 lines · Benjamin Tissoires
Quoted 7 lines

Instead of limiting HID sensors to USB and I2C busses we can just make everything that has usage page of HID_UP_SENSOR to be included in HID_GROUP_SENSOR_HUB group. This allows the sensor-hub to work over bluetooth (and other transports) as well.

Applied.

Signature · 2 lines
Jiri Kosina
SUSE Labs
#21 lore raw

Re: [PATCH 3/3] HID: sensor-hub: don't limit the driver only to USB bus

In reply to Alexander Holler

Hi,

Sorry for coming this late in the discussion (I was sick at the beginning of the week, preventing me to answer mails).

Quoted 6 lines · Alexander Holler
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

Hmm, what happens with Bluetooth sensor-hubs? Is the driver now able to handle them too?

It should, yes.

It should, but the full features are not enabled. We also need to patch hidp so that it can handle .request() too. Otherwise, when the sensor hub will request a "get feature" or a "set feature", then nothing will be triggered.

However, I don't think it will prevent us from removing the test against USB/I2C. It's just something we need to work on too.

Cheers,
Benjamin

#22 lore raw

Re: [PATCH 3/3] HID: sensor-hub: don't limit the driver only to USB bus

Am 21.02.2013 11:34, schrieb Benjamin Tissoires:

Quoted 13 lines

Hi,

Sorry for coming this late in the discussion (I was sick at the beginning of the week, preventing me to answer mails).

Quoted 6 lines · Alexander Holler
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

Hmm, what happens with Bluetooth sensor-hubs? Is the driver now able to handle them too?

It should, yes.

Quoted 7 lines

It should, but the full features are not enabled. We also need to patch hidp so that it can handle .request() too. Otherwise, when the sensor hub will request a "get feature" or a "set feature", then nothing will be triggered.

However, I don't think it will prevent us from removing the test against USB/I2C. It's just something we need to work on too.

Thanks. I've just ordered me one of those bt-sensors from TI, maybe I will be able to make it HID over GATT aware to play a bit with it. The BT spec for HID over GATT doesn't talk about sensors, but if I will find a way to program the device without buying more hw, I will have a look if it is possible. ;)

Regards,

Alexander