summaryrefslogtreecommitdiff
path: root/drivers/usb/input
diff options
context:
space:
mode:
authorVojtech Pavlik <vojtech@suse.cz>2002-07-15 03:37:47 -0700
committerVojtech Pavlik <vojtech@suse.cz>2002-07-15 03:37:47 -0700
commit2fcd00c2f6da48528ff0188676f4e91fea2a6795 (patch)
treefc54bbf286c317cfda690c0513d189ad8ae2687f /drivers/usb/input
parent6fa91667b6f5555c7ad5f065d72cb28e5ee9df4e (diff)
[PATCH] A cleanup of Paul's 2.5 hiddev update.
Get rid of #ifdefs in hid-core again. (For you, Greg.) Move the uref generation code from hid-core to hiddev to make things cleaner.
Diffstat (limited to 'drivers/usb/input')
-rw-r--r--drivers/usb/input/hid-core.c36
-rw-r--r--drivers/usb/input/hiddev.c45
2 files changed, 45 insertions, 36 deletions
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
index 6f82975e4838..068417749db6 100644
--- a/drivers/usb/input/hid-core.c
+++ b/drivers/usb/input/hid-core.c
@@ -793,22 +793,8 @@ static void hid_process_event(struct hid_device *hid, struct hid_field *field, s
hid_dump_input(usage, value);
if (hid->claimed & HID_CLAIMED_INPUT)
hidinput_hid_event(hid, field, usage, value);
-#ifdef CONFIG_USB_HIDDEV
- if (hid->claimed & HID_CLAIMED_HIDDEV) {
- struct hiddev_usage_ref uref;
- unsigned type = field->report_type;
- uref.report_type =
- (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT :
- ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT :
- ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE:0));
- uref.report_id = field->report->id;
- uref.field_index = field->index;
- uref.usage_index = (usage - field->usage);
- uref.usage_code = usage->hid;
- uref.value = value;
- hiddev_hid_event(hid, &uref);
- }
-#endif
+ if (hid->claimed & HID_CLAIMED_HIDDEV)
+ hiddev_hid_event(hid, field, usage, value);
}
/*
@@ -904,21 +890,6 @@ static int hid_input_report(int type, struct urb *urb)
return -1;
}
-#ifdef CONFIG_USB_HIDDEV
- /* Notify listeners that a report has been received */
- if (hid->claimed & HID_CLAIMED_HIDDEV) {
- struct hiddev_usage_ref uref;
- memset(&uref, 0, sizeof(uref));
- uref.report_type =
- (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT :
- ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT :
- ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE:0));
- uref.report_id = report->id;
- uref.field_index = HID_FIELD_INDEX_NONE;
- hiddev_hid_event(hid, &uref);
- }
-#endif
-
size = ((report->size - 1) >> 3) + 1;
if (len < size) {
@@ -926,6 +897,9 @@ static int hid_input_report(int type, struct urb *urb)
return -1;
}
+ if (hid->claimed & HID_CLAIMED_HIDDEV)
+ hiddev_report_event(hid, report);
+
for (n = 0; n < report->maxfield; n++)
hid_input_field(hid, report->field[n], data);
diff --git a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c
index 8ac1b9111145..563285d58541 100644
--- a/drivers/usb/input/hiddev.c
+++ b/drivers/usb/input/hiddev.c
@@ -154,11 +154,8 @@ hiddev_lookup_usage(struct hid_device *hid, struct hiddev_usage_ref *uref)
return NULL;
}
-/*
- * This is where hid.c calls into hiddev to pass an event that occurred over
- * the interrupt pipe
- */
-void hiddev_hid_event(struct hid_device *hid, struct hiddev_usage_ref *uref)
+static void hiddev_send_event(struct hid_device *hid,
+ struct hiddev_usage_ref *uref)
{
struct hiddev *hiddev = hid->hiddev;
struct hiddev_list *list = hiddev->list;
@@ -179,6 +176,44 @@ void hiddev_hid_event(struct hid_device *hid, struct hiddev_usage_ref *uref)
}
/*
+ * This is where hid.c calls into hiddev to pass an event that occurred over
+ * the interrupt pipe
+ */
+void hiddev_hid_event(struct hid_device *hid, struct hid_field *field,
+ struct hid_usage *usage, __s32 value)
+{
+ unsigned type = field->report_type;
+ struct hiddev_usage_ref uref;
+
+ uref.report_type =
+ (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT :
+ ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT :
+ ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE:0));
+ uref.report_id = field->report->id;
+ uref.field_index = field->index;
+ uref.usage_index = (usage - field->usage);
+ uref.usage_code = usage->hid;
+ uref.value = value;
+
+ hiddev_send_event(hid, &uref);
+}
+
+
+void hiddev_report_event(struct hid_device *hid, struct hid_report *report)
+{
+ unsigned type = report->type;
+ struct hiddev_usage_ref uref;
+
+ memset(&uref, 0, sizeof(uref));
+ uref.report_type =
+ (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT :
+ ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT :
+ ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE:0));
+ uref.report_id = report->id;
+
+ hiddev_send_event(hid, &uref);
+}
+/*
* fasync file op
*/
static int hiddev_fasync(int fd, struct file *file, int on)