# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.642 -> 1.643 # include/linux/hiddev.h 1.5 -> 1.6 # drivers/usb/input/hiddev.c 1.18 -> 1.19 # drivers/usb/input/hid-core.c 1.28 -> 1.29 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 02/07/15 [EMAIL PROTECTED] 1.643 # [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. # -------------------------------------------- # diff -Nru a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c --- a/drivers/usb/input/hid-core.c Mon Jul 15 18:05:02 2002 +++ b/drivers/usb/input/hid-core.c Mon Jul 15 18:05:02 2002 @@ -793,22 +793,8 @@ 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,27 +890,15 @@ 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) { dbg("report %d is too short, (%d < %d)", report->id, len, size); 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 -Nru a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c --- a/drivers/usb/input/hiddev.c Mon Jul 15 18:05:02 2002 +++ b/drivers/usb/input/hiddev.c Mon Jul 15 18:05:02 2002 @@ -154,11 +154,8 @@ 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; @@ -178,6 +175,44 @@ wake_up_interruptible(&hiddev->wait); } +/* + * 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 */ diff -Nru a/include/linux/hiddev.h b/include/linux/hiddev.h --- a/include/linux/hiddev.h Mon Jul 15 18:05:02 2002 +++ b/include/linux/hiddev.h Mon Jul 15 18:05:02 2002 @@ -202,13 +202,17 @@ #ifdef CONFIG_USB_HIDDEV int hiddev_connect(struct hid_device *); void hiddev_disconnect(struct hid_device *); -void hiddev_hid_event(struct hid_device *, struct hiddev_usage_ref *ref); +void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, + struct hid_usage *usage, __s32 value); +void hiddev_report_event(struct hid_device *hid, struct hid_report *report); int __init hiddev_init(void); void __exit hiddev_exit(void); #else static inline int hiddev_connect(struct hid_device *hid) { return -1; } static inline void hiddev_disconnect(struct hid_device *hid) { } -static inline void hiddev_event(struct hid_device *hid, unsigned int usage, int value) { } +static inline void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, + struct hid_usage *usage, __s32 value) { } +static inline void hiddev_report_event(struct hid_device *hid, struct hid_report +*report) { } static inline int hiddev_init(void) { return 0; } static inline void hiddev_exit(void) { } #endif
------------------------------------------------------- This sf.net email is sponsored by: Jabber - The world's fastest growing real-time communications platform! Don't just IM. Build it in! http://www.jabber.com/osdn/xim _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel