aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-sensor-hub.c
diff options
context:
space:
mode:
authorAlexander Holler <holler@ahsoftware.de>2012-12-09 06:44:30 -0500
committerJiri Kosina <jkosina@suse.cz>2012-12-12 10:49:10 -0500
commit83499b52c61f50292f0aae36499de8a8fc3e37c3 (patch)
treee9e64260fc9aa83cfc6c34bc5226c5252b84c68c /drivers/hid/hid-sensor-hub.c
parent1a1e8c6fada5f6dc48aa5dad453c9d9ebfdc8218 (diff)
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>
Diffstat (limited to 'drivers/hid/hid-sensor-hub.c')
-rw-r--r--drivers/hid/hid-sensor-hub.c32
1 files changed, 1 insertions, 31 deletions
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index d9d73e9163eb..ca88ddc2d78f 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -82,23 +82,6 @@ struct hid_sensor_hub_callbacks_list {
82 void *priv; 82 void *priv;
83}; 83};
84 84
85static int sensor_hub_check_for_sensor_page(struct hid_device *hdev)
86{
87 int i;
88 int ret = -EINVAL;
89
90 for (i = 0; i < hdev->maxcollection; i++) {
91 struct hid_collection *col = &hdev->collection[i];
92 if (col->type == HID_COLLECTION_PHYSICAL &&
93 (col->usage & HID_USAGE_PAGE) == HID_UP_SENSOR) {
94 ret = 0;
95 break;
96 }
97 }
98
99 return ret;
100}
101
102static struct hid_report *sensor_hub_report(int id, struct hid_device *hdev, 85static struct hid_report *sensor_hub_report(int id, struct hid_device *hdev,
103 int dir) 86 int dir)
104{ 87{
@@ -524,10 +507,6 @@ static int sensor_hub_probe(struct hid_device *hdev,
524 hid_err(hdev, "parse failed\n"); 507 hid_err(hdev, "parse failed\n");
525 goto err_free; 508 goto err_free;
526 } 509 }
527 if (sensor_hub_check_for_sensor_page(hdev) < 0) {
528 hid_err(hdev, "sensor page not found\n");
529 goto err_free;
530 }
531 INIT_LIST_HEAD(&hdev->inputs); 510 INIT_LIST_HEAD(&hdev->inputs);
532 511
533 ret = hid_hw_start(hdev, 0); 512 ret = hid_hw_start(hdev, 0);
@@ -630,16 +609,7 @@ static void sensor_hub_remove(struct hid_device *hdev)
630} 609}
631 610
632static const struct hid_device_id sensor_hub_devices[] = { 611static const struct hid_device_id sensor_hub_devices[] = {
633 { HID_USB_DEVICE(USB_VENDOR_ID_INTEL_8086, 612 { HID_DEVICE(BUS_USB, HID_GROUP_SENSOR_HUB, HID_ANY_ID, HID_ANY_ID) },
634 USB_DEVICE_ID_SENSOR_HUB_1020) },
635 { HID_USB_DEVICE(USB_VENDOR_ID_INTEL_8087,
636 USB_DEVICE_ID_SENSOR_HUB_1020) },
637 { HID_USB_DEVICE(USB_VENDOR_ID_INTEL_8086,
638 USB_DEVICE_ID_SENSOR_HUB_09FA) },
639 { HID_USB_DEVICE(USB_VENDOR_ID_INTEL_8087,
640 USB_DEVICE_ID_SENSOR_HUB_09FA) },
641 { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM,
642 USB_DEVICE_ID_SENSOR_HUB_7014) },
643 { } 613 { }
644}; 614};
645MODULE_DEVICE_TABLE(hid, sensor_hub_devices); 615MODULE_DEVICE_TABLE(hid, sensor_hub_devices);