HID: sensors: autodetect USB HID sensor hubs
It should not be necessary to add IDs for HID sensor hubs to lists in hid-core.c and hid-sensor-hub.c. So instead of a whitelist, autodetect such USB HID sensor hubs, based on a collection of type physical inside a useage page of type sensor. If some sensor hubs stil must be usable as raw devices, a blacklist might be created. Signed-off-by: Alexander Holler <holler@ahsoftware.de> Acked-by: "Pandruvada, Srinivas" <srinivas.pandruvada@intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:

committed by
Jiri Kosina

parent
1a1e8c6fad
commit
83499b52c6
@@ -82,23 +82,6 @@ struct hid_sensor_hub_callbacks_list {
|
||||
void *priv;
|
||||
};
|
||||
|
||||
static int sensor_hub_check_for_sensor_page(struct hid_device *hdev)
|
||||
{
|
||||
int i;
|
||||
int ret = -EINVAL;
|
||||
|
||||
for (i = 0; i < hdev->maxcollection; i++) {
|
||||
struct hid_collection *col = &hdev->collection[i];
|
||||
if (col->type == HID_COLLECTION_PHYSICAL &&
|
||||
(col->usage & HID_USAGE_PAGE) == HID_UP_SENSOR) {
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct hid_report *sensor_hub_report(int id, struct hid_device *hdev,
|
||||
int dir)
|
||||
{
|
||||
@@ -524,10 +507,6 @@ static int sensor_hub_probe(struct hid_device *hdev,
|
||||
hid_err(hdev, "parse failed\n");
|
||||
goto err_free;
|
||||
}
|
||||
if (sensor_hub_check_for_sensor_page(hdev) < 0) {
|
||||
hid_err(hdev, "sensor page not found\n");
|
||||
goto err_free;
|
||||
}
|
||||
INIT_LIST_HEAD(&hdev->inputs);
|
||||
|
||||
ret = hid_hw_start(hdev, 0);
|
||||
@@ -630,16 +609,7 @@ static void sensor_hub_remove(struct hid_device *hdev)
|
||||
}
|
||||
|
||||
static const struct hid_device_id sensor_hub_devices[] = {
|
||||
{ HID_USB_DEVICE(USB_VENDOR_ID_INTEL_8086,
|
||||
USB_DEVICE_ID_SENSOR_HUB_1020) },
|
||||
{ HID_USB_DEVICE(USB_VENDOR_ID_INTEL_8087,
|
||||
USB_DEVICE_ID_SENSOR_HUB_1020) },
|
||||
{ HID_USB_DEVICE(USB_VENDOR_ID_INTEL_8086,
|
||||
USB_DEVICE_ID_SENSOR_HUB_09FA) },
|
||||
{ HID_USB_DEVICE(USB_VENDOR_ID_INTEL_8087,
|
||||
USB_DEVICE_ID_SENSOR_HUB_09FA) },
|
||||
{ HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM,
|
||||
USB_DEVICE_ID_SENSOR_HUB_7014) },
|
||||
{ HID_DEVICE(BUS_USB, HID_GROUP_SENSOR_HUB, HID_ANY_ID, HID_ANY_ID) },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(hid, sensor_hub_devices);
|
||||
|
Reference in New Issue
Block a user