aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-core.c
diff options
context:
space:
mode:
authorOliver Neukum <oliver@neukum.org>2008-12-17 09:38:03 -0500
committerJiri Kosina <jkosina@suse.cz>2009-03-25 12:57:57 -0400
commit0361a28d3f9a4315a100c7b37ba0b55cfe15fe07 (patch)
tree2aa33c5325118e68ce8691a009c5fb30ffdea68c /drivers/hid/hid-core.c
parent8e0ee43bc2c3e19db56a4adaa9a9b04ce885cd84 (diff)
HID: autosuspend support for USB HID
This uses the USB busy mechanism for aggessive autosuspend of USB HID devices. It autosuspends all opened devices supporting remote wakeup after a timeout unless - output is being done to the device - a key is being held down (remote wakeup isn't triggered upon key release) - LED(s) are lit - hiddev is opened As in the current driver closed devices will be autosuspended even if they don't support remote wakeup. The patch is quite large because output to devices is done in hard interrupt context meaning a lot a queuing and locking had to be touched. The LED stuff has been solved by means of a simple counter. Additions to the generic HID code could be avoided. In addition it now covers hidraw. It contains an embryonic version of an API to let the generic HID code tell the lower levels which capabilities with respect to power management are needed. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-core.c')
-rw-r--r--drivers/hid/hid-core.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 1cc967448f4d..feaeb6167ea4 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1822,6 +1822,22 @@ static DECLARE_WORK(hid_compat_work, hid_compat_load);
1822static struct workqueue_struct *hid_compat_wq; 1822static struct workqueue_struct *hid_compat_wq;
1823#endif 1823#endif
1824 1824
1825int hid_check_keys_pressed(struct hid_device *hid)
1826{
1827 struct hid_input *hidinput;
1828 int i;
1829
1830 list_for_each_entry(hidinput, &hid->inputs, list) {
1831 for (i = 0; i < BITS_TO_LONGS(KEY_MAX); i++)
1832 if (hidinput->input->key[i])
1833 return 1;
1834 }
1835
1836 return 0;
1837}
1838
1839EXPORT_SYMBOL_GPL(hid_check_keys_pressed);
1840
1825static int __init hid_init(void) 1841static int __init hid_init(void)
1826{ 1842{
1827 int ret; 1843 int ret;