aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-input.c
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2008-05-16 05:49:16 -0400
committerJiri Kosina <jkosina@suse.cz>2008-10-14 17:50:48 -0400
commitc500c9714011edab021591340042787722db9cf0 (patch)
treed6bb0fe483c9f1c71c3d757e9c13d261ca01cd5f /drivers/hid/hid-input.c
parent85cdaf524b7ddab627e7d15405693f2511ef7505 (diff)
HID: hid, make parsing event driven
Next step for complete hid bus, this patch includes: - call parser either from probe or from hid-core if there is no probe. - add ll_driver structure and centralize some stuff there (open, close...) - split and merge usb_hid_configure and hid_probe into several functions to allow hooks/fixes between them Signed-off-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-input.c')
-rw-r--r--drivers/hid/hid-input.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 4ae5603804e7..9fa7239ab310 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -390,6 +390,15 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
390 if (ret) 390 if (ret)
391 goto mapped; 391 goto mapped;
392 392
393 if (device->driver->input_mapping) {
394 int ret = device->driver->input_mapping(device, hidinput, field,
395 usage, &bit, &max);
396 if (ret > 0)
397 goto mapped;
398 if (ret < 0)
399 goto ignore;
400 }
401
393 switch (usage->hid & HID_USAGE_PAGE) { 402 switch (usage->hid & HID_USAGE_PAGE) {
394 403
395 case HID_UP_UNDEFINED: 404 case HID_UP_UNDEFINED:
@@ -755,6 +764,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
755 } 764 }
756 765
757mapped: 766mapped:
767 if (device->driver->input_mapped && device->driver->input_mapped(device,
768 hidinput, field, usage, &bit, &max) < 0)
769 goto ignore;
770
758 if (device->quirks & HID_QUIRK_MIGHTYMOUSE) { 771 if (device->quirks & HID_QUIRK_MIGHTYMOUSE) {
759 if (usage->hid == HID_GD_Z) 772 if (usage->hid == HID_GD_Z)
760 map_rel(REL_HWHEEL); 773 map_rel(REL_HWHEEL);
@@ -961,14 +974,14 @@ static int hidinput_open(struct input_dev *dev)
961{ 974{
962 struct hid_device *hid = input_get_drvdata(dev); 975 struct hid_device *hid = input_get_drvdata(dev);
963 976
964 return hid->hid_open(hid); 977 return hid->ll_driver->open(hid);
965} 978}
966 979
967static void hidinput_close(struct input_dev *dev) 980static void hidinput_close(struct input_dev *dev)
968{ 981{
969 struct hid_device *hid = input_get_drvdata(dev); 982 struct hid_device *hid = input_get_drvdata(dev);
970 983
971 hid->hid_close(hid); 984 hid->ll_driver->close(hid);
972} 985}
973 986
974/* 987/*
@@ -1019,7 +1032,8 @@ int hidinput_connect(struct hid_device *hid)
1019 } 1032 }
1020 1033
1021 input_set_drvdata(input_dev, hid); 1034 input_set_drvdata(input_dev, hid);
1022 input_dev->event = hid->hidinput_input_event; 1035 input_dev->event =
1036 hid->ll_driver->hidinput_input_event;
1023 input_dev->open = hidinput_open; 1037 input_dev->open = hidinput_open;
1024 input_dev->close = hidinput_close; 1038 input_dev->close = hidinput_close;
1025 input_dev->setkeycode = hidinput_setkeycode; 1039 input_dev->setkeycode = hidinput_setkeycode;