diff options
author | Jiri Kosina <jkosina@suse.cz> | 2006-12-08 20:40:53 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-12-08 21:43:12 +0300 |
commit | 229695e51efc4ed5e04ab471c82591d0f432909d (patch) | |
tree | 9e333780589010c61224f185a4a83323305e7d8d /drivers/hid | |
parent | dde5845a529ff753364a6d1aea61180946270bfa (diff) | |
download | linux-229695e51efc4ed5e04ab471c82591d0f432909d.tar.xz |
[PATCH] Generic HID layer - API
- fixed generic API (added neccessary EXPORT_SYMBOL, fixed hid.h to provide correct
prototypes)
- extended hid_device with open/close/event function pointers to driver-specific
functions
- added driver specific driver_data to hid_device
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-core.c | 22 | ||||
-rw-r--r-- | drivers/hid/hid-input.c | 19 |
2 files changed, 25 insertions, 16 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 689ae16adf33..8474a7923322 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1,5 +1,5 @@ /* - * USB HID support for Linux + * HID support for Linux * * Copyright (c) 1999 Andreas Gal * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> @@ -31,8 +31,6 @@ #undef DEBUG #undef DEBUG_DATA -#include <linux/usb.h> - #include <linux/hid.h> #include <linux/hiddev.h> @@ -538,7 +536,7 @@ static void hid_free_report(struct hid_report *report) * Free a device structure, all reports, and all fields. */ -static void hid_free_device(struct hid_device *device) +void hid_free_device(struct hid_device *device) { unsigned i,j; @@ -555,6 +553,7 @@ static void hid_free_device(struct hid_device *device) kfree(device->rdesc); kfree(device); } +EXPORT_SYMBOL_GPL(hid_free_device); /* * Fetch a report description item from the data stream. We support long @@ -629,7 +628,7 @@ static u8 *fetch_item(__u8 *start, __u8 *end, struct hid_item *item) * enumerated, fields are attached to these reports. */ -static struct hid_device *hid_parse_report(__u8 *start, unsigned size) +struct hid_device *hid_parse_report(__u8 *start, unsigned size) { struct hid_device *device; struct hid_parser *parser; @@ -719,6 +718,7 @@ static struct hid_device *hid_parse_report(__u8 *start, unsigned size) kfree(parser); return NULL; } +EXPORT_SYMBOL_GPL(hid_parse_report); /* * Convert a signed n-bit integer to signed 32-bit integer. Common @@ -767,10 +767,10 @@ static __inline__ __u32 extract(__u8 *report, unsigned offset, unsigned n) WARN_ON(n > 32); report += offset >> 3; /* adjust byte index */ - offset &= 7; /* now only need bit offset into one byte */ + offset &= 7; /* now only need bit offset into one byte */ x = get_unaligned((u64 *) report); x = le64_to_cpu(x); - x = (x >> offset) & ((1ULL << n) - 1); /* extract bit field */ + x = (x >> offset) & ((1ULL << n) - 1); /* extract bit field */ return (u32) x; } @@ -829,7 +829,7 @@ static void hid_process_event(struct hid_device *hid, struct hid_field *field, s * reporting to the layer). */ -static void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data, int interrupt) +void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data, int interrupt) { unsigned n; unsigned count = field->report_count; @@ -875,7 +875,7 @@ static void hid_input_field(struct hid_device *hid, struct hid_field *field, __u exit: kfree(value); } - +EXPORT_SYMBOL_GPL(hid_input_field); /* * Output the field into the report. @@ -900,7 +900,7 @@ static void hid_output_field(struct hid_field *field, __u8 *data) * Create a report. */ -static void hid_output_report(struct hid_report *report, __u8 *data) +void hid_output_report(struct hid_report *report, __u8 *data) { unsigned n; @@ -910,6 +910,7 @@ static void hid_output_report(struct hid_report *report, __u8 *data) for (n = 0; n < report->maxfield; n++) hid_output_field(report->field[n], data); } +EXPORT_SYMBOL_GPL(hid_output_report); /* * Set a field value. The report this field belongs to has to be @@ -937,4 +938,5 @@ int hid_set_field(struct hid_field *field, unsigned offset, __s32 value) field->value[offset] = value; return 0; } +EXPORT_SYMBOL_GPL(hid_set_field); diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index d459005062e0..6d3d80ba9582 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -727,8 +727,9 @@ void hidinput_report_event(struct hid_device *hid, struct hid_report *report) list_for_each_entry(hidinput, &hid->inputs, list) input_sync(hidinput->input); } +EXPORT_SYMBOL_GPL(hidinput_report_event); -static int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field) +int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field) { struct hid_report *report; int i, j; @@ -743,6 +744,7 @@ static int hidinput_find_field(struct hid_device *hid, unsigned int type, unsign } return -1; } +EXPORT_SYMBOL_GPL(hidinput_find_field); /* * Register the input device; print a message. @@ -752,7 +754,6 @@ static int hidinput_find_field(struct hid_device *hid, unsigned int type, unsign int hidinput_connect(struct hid_device *hid) { - struct usb_device *dev = hid->dev; struct hid_report *report; struct hid_input *hidinput = NULL; struct input_dev *input_dev; @@ -786,14 +787,17 @@ int hidinput_connect(struct hid_device *hid) } input_dev->private = hid; - input_dev->event = hidinput_input_event; - input_dev->open = hidinput_open; - input_dev->close = hidinput_close; + input_dev->event = hid->hidinput_input_event; + input_dev->open = hid->hidinput_open; + input_dev->close = hid->hidinput_close; input_dev->name = hid->name; input_dev->phys = hid->phys; input_dev->uniq = hid->uniq; - usb_to_input_id(dev, &input_dev->id); + input_dev->id.bustype = hid->bus; + input_dev->id.vendor = hid->vendor; + input_dev->id.product = hid->product; + input_dev->id.version = hid->version; input_dev->cdev.dev = &hid->intf->dev; hidinput->input = input_dev; @@ -827,6 +831,7 @@ int hidinput_connect(struct hid_device *hid) return 0; } +EXPORT_SYMBOL_GPL(hidinput_connect); void hidinput_disconnect(struct hid_device *hid) { @@ -838,3 +843,5 @@ void hidinput_disconnect(struct hid_device *hid) kfree(hidinput); } } +EXPORT_SYMBOL_GPL(hidinput_disconnect); + |