summaryrefslogtreecommitdiff
path: root/drivers/usb/input/hiddev.c
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/hiddev.c
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/hiddev.c')
-rw-r--r--drivers/usb/input/hiddev.c45
1 files changed, 40 insertions, 5 deletions
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)