diff options
author | David Herrmann <dh.herrmann@googlemail.com> | 2012-07-20 05:49:09 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2012-07-20 08:32:00 -0400 |
commit | 4bc19f62c57b8ccdd1c48e875752bd59abfb7aae (patch) | |
tree | f33e717433f165fc7d69b5a71ba726c7f6ef859b /drivers/hid | |
parent | ff9bf5a2eff6e726406bcc097e8a578822d38859 (diff) |
HID: Allow drivers to be their own listener
hid-picolcd and hid-wiimote do not allow any of hidinput, hiddev or hidraw
to claim the device but still want to remain on the bus. Hence, if a
driver uses the raw_event callback but no other listener claimed the
device, we still leave it on the bus as the driver handles everything by
itself. It thus becomes its own listener.
Under some circumstances (eg., hidinput_connect() fails and raw_event set)
a device may be left on the bus even though it requires external
listeners. But then if hidinput_connect() fails there are bigger issues
than a device that is left unhandled. So we can safely use this heuristic
to avoid adding another flag for special devices like hid-picolcd and
hid-wiimote.
This also removes the ugly hack from hid-picolcd as this is no longer
required.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Acked-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-core.c | 6 | ||||
-rw-r--r-- | drivers/hid/hid-picolcd.c | 4 |
2 files changed, 4 insertions, 6 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index ba1c3644e6ac..de8220c3fb5f 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1373,8 +1373,10 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask) | |||
1373 | if ((connect_mask & HID_CONNECT_HIDRAW) && !hidraw_connect(hdev)) | 1373 | if ((connect_mask & HID_CONNECT_HIDRAW) && !hidraw_connect(hdev)) |
1374 | hdev->claimed |= HID_CLAIMED_HIDRAW; | 1374 | hdev->claimed |= HID_CLAIMED_HIDRAW; |
1375 | 1375 | ||
1376 | if (!hdev->claimed) { | 1376 | /* Drivers with the ->raw_event callback set are not required to connect |
1377 | hid_err(hdev, "claimed by neither input, hiddev nor hidraw\n"); | 1377 | * to any other listener. */ |
1378 | if (!hdev->claimed && !hdev->driver->raw_event) { | ||
1379 | hid_err(hdev, "device has no listeners, quitting\n"); | ||
1378 | return -ENODEV; | 1380 | return -ENODEV; |
1379 | } | 1381 | } |
1380 | 1382 | ||
diff --git a/drivers/hid/hid-picolcd.c b/drivers/hid/hid-picolcd.c index 45c3433f7986..74c388dcb5b2 100644 --- a/drivers/hid/hid-picolcd.c +++ b/drivers/hid/hid-picolcd.c | |||
@@ -2613,11 +2613,7 @@ static int picolcd_probe(struct hid_device *hdev, | |||
2613 | goto err_cleanup_data; | 2613 | goto err_cleanup_data; |
2614 | } | 2614 | } |
2615 | 2615 | ||
2616 | /* We don't use hidinput but hid_hw_start() fails if nothing is | ||
2617 | * claimed. So spoof claimed input. */ | ||
2618 | hdev->claimed = HID_CLAIMED_INPUT; | ||
2619 | error = hid_hw_start(hdev, 0); | 2616 | error = hid_hw_start(hdev, 0); |
2620 | hdev->claimed = 0; | ||
2621 | if (error) { | 2617 | if (error) { |
2622 | hid_err(hdev, "hardware start failed\n"); | 2618 | hid_err(hdev, "hardware start failed\n"); |
2623 | goto err_cleanup_data; | 2619 | goto err_cleanup_data; |