aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2008-06-26 18:04:24 -0400
committerJiri Kosina <jkosina@suse.cz>2008-10-14 17:50:56 -0400
commit93c10132a7ac160df3175b53f7ee857625412165 (patch)
tree64ea194ddd7791d44394bb2a918921a2906fe1ee /include
parentfea6f1833b5bbff7066bcde1fa1141c9717bbad2 (diff)
HID: move connect quirks
Move connecting from usbhid to the hid layer and fix also hidp in that manner. This removes all the ignore/force hidinput/hiddev connecting quirks. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'include')
-rw-r--r--include/linux/hid.h37
-rw-r--r--include/linux/hiddev.h6
2 files changed, 34 insertions, 9 deletions
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 43aa51a7fa95..043209f7bfcf 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -247,6 +247,19 @@ struct hid_item {
247#define HID_FEATURE_REPORT 2 247#define HID_FEATURE_REPORT 2
248 248
249/* 249/*
250 * HID connect requests
251 */
252
253#define HID_CONNECT_HIDINPUT 0x01
254#define HID_CONNECT_HIDINPUT_FORCE 0x02
255#define HID_CONNECT_HIDRAW 0x04
256#define HID_CONNECT_HIDDEV 0x08
257#define HID_CONNECT_HIDDEV_FORCE 0x10
258#define HID_CONNECT_FF 0x20
259#define HID_CONNECT_DEFAULT (HID_CONNECT_HIDINPUT|HID_CONNECT_HIDRAW| \
260 HID_CONNECT_HIDDEV|HID_CONNECT_FF)
261
262/*
250 * HID device quirks. 263 * HID device quirks.
251 */ 264 */
252 265
@@ -258,13 +271,10 @@ struct hid_item {
258#define HID_QUIRK_INVERT 0x00000001 271#define HID_QUIRK_INVERT 0x00000001
259#define HID_QUIRK_NOTOUCH 0x00000002 272#define HID_QUIRK_NOTOUCH 0x00000002
260#define HID_QUIRK_NOGET 0x00000008 273#define HID_QUIRK_NOGET 0x00000008
261#define HID_QUIRK_HIDDEV 0x00000010
262#define HID_QUIRK_BADPAD 0x00000020 274#define HID_QUIRK_BADPAD 0x00000020
263#define HID_QUIRK_MULTI_INPUT 0x00000040 275#define HID_QUIRK_MULTI_INPUT 0x00000040
264#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 276#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000
265#define HID_QUIRK_RESET_LEDS 0x00100000 277#define HID_QUIRK_RESET_LEDS 0x00100000
266#define HID_QUIRK_HIDINPUT 0x00200000
267#define HID_QUIRK_IGNORE_HIDINPUT 0x01000000
268#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 278#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000
269 279
270/* 280/*
@@ -439,7 +449,11 @@ struct hid_device { /* device report descriptor */
439 449
440 void *driver_data; 450 void *driver_data;
441 451
452 /* temporary hid_ff handling (until moved to the drivers) */
453 int (*ff_init)(struct hid_device *);
454
442 /* hiddev event handler */ 455 /* hiddev event handler */
456 int (*hiddev_connect)(struct hid_device *, unsigned int);
443 void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field, 457 void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field,
444 struct hid_usage *, __s32); 458 struct hid_usage *, __s32);
445 void (*hiddev_report_event) (struct hid_device *, struct hid_report *); 459 void (*hiddev_report_event) (struct hid_device *, struct hid_report *);
@@ -610,7 +624,7 @@ extern void hid_unregister_driver(struct hid_driver *);
610 624
611extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32); 625extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32);
612extern void hidinput_report_event(struct hid_device *hid, struct hid_report *report); 626extern void hidinput_report_event(struct hid_device *hid, struct hid_report *report);
613extern int hidinput_connect(struct hid_device *); 627extern int hidinput_connect(struct hid_device *hid, unsigned int force);
614extern void hidinput_disconnect(struct hid_device *); 628extern void hidinput_disconnect(struct hid_device *);
615 629
616int hid_set_field(struct hid_field *, unsigned, __s32); 630int hid_set_field(struct hid_field *, unsigned, __s32);
@@ -619,6 +633,7 @@ int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int
619void hid_output_report(struct hid_report *report, __u8 *data); 633void hid_output_report(struct hid_report *report, __u8 *data);
620struct hid_device *hid_allocate_device(void); 634struct hid_device *hid_allocate_device(void);
621int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); 635int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size);
636int hid_connect(struct hid_device *hid, unsigned int connect_mask);
622 637
623/** 638/**
624 * hid_map_usage - map usage input bits 639 * hid_map_usage - map usage input bits
@@ -700,14 +715,22 @@ static inline int __must_check hid_parse(struct hid_device *hdev)
700 * hid_hw_start - start underlaying HW 715 * hid_hw_start - start underlaying HW
701 * 716 *
702 * @hdev: hid device 717 * @hdev: hid device
718 * @connect_mask: which outputs to connect, see HID_CONNECT_*
703 * 719 *
704 * Call this in probe function *after* hid_parse. This will setup HW buffers 720 * Call this in probe function *after* hid_parse. This will setup HW buffers
705 * and start the device (if not deffered to device open). hid_hw_stop must be 721 * and start the device (if not deffered to device open). hid_hw_stop must be
706 * called if this was successfull. 722 * called if this was successfull.
707 */ 723 */
708static inline int __must_check hid_hw_start(struct hid_device *hdev) 724static inline int __must_check hid_hw_start(struct hid_device *hdev,
725 unsigned int connect_mask)
709{ 726{
710 return hdev->ll_driver->start(hdev); 727 int ret = hdev->ll_driver->start(hdev);
728 if (ret || !connect_mask)
729 return ret;
730 ret = hid_connect(hdev, connect_mask);
731 if (ret)
732 hdev->ll_driver->stop(hdev);
733 return ret;
711} 734}
712 735
713/** 736/**
@@ -749,7 +772,7 @@ static inline int hid_pidff_init(struct hid_device *hid) { return -ENODEV; }
749#endif 772#endif
750 773
751#else 774#else
752static inline int hid_ff_init(struct hid_device *hid) { return -1; } 775#define hid_ff_init NULL
753#endif 776#endif
754 777
755#ifdef CONFIG_HID_DEBUG 778#ifdef CONFIG_HID_DEBUG
diff --git a/include/linux/hiddev.h b/include/linux/hiddev.h
index a416b904ba90..6ae77b3468f9 100644
--- a/include/linux/hiddev.h
+++ b/include/linux/hiddev.h
@@ -217,7 +217,7 @@ struct hid_field;
217struct hid_report; 217struct hid_report;
218 218
219#ifdef CONFIG_USB_HIDDEV 219#ifdef CONFIG_USB_HIDDEV
220int hiddev_connect(struct hid_device *); 220int hiddev_connect(struct hid_device *hid, unsigned int force);
221void hiddev_disconnect(struct hid_device *); 221void hiddev_disconnect(struct hid_device *);
222void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, 222void hiddev_hid_event(struct hid_device *hid, struct hid_field *field,
223 struct hid_usage *usage, __s32 value); 223 struct hid_usage *usage, __s32 value);
@@ -225,7 +225,9 @@ void hiddev_report_event(struct hid_device *hid, struct hid_report *report);
225int __init hiddev_init(void); 225int __init hiddev_init(void);
226void hiddev_exit(void); 226void hiddev_exit(void);
227#else 227#else
228static inline int hiddev_connect(struct hid_device *hid) { return -1; } 228static inline int hiddev_connect(struct hid_device *hid,
229 unsigned int force)
230{ return -1; }
229static inline void hiddev_disconnect(struct hid_device *hid) { } 231static inline void hiddev_disconnect(struct hid_device *hid) { }
230static inline void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, 232static inline void hiddev_hid_event(struct hid_device *hid, struct hid_field *field,
231 struct hid_usage *usage, __s32 value) { } 233 struct hid_usage *usage, __s32 value) { }