Hi, Jiri.

        These are the splited patches of hid bus prototype 070409.  I remember 
I posted them in attachment form ago ;) 
        Now they are splited in some separable patches.
        I am afraid I can not receive in Labor Day.

        Good luck.

- Li Yu
Signed-off-by: Li Yu <[EMAIL PROTECTED]>

diff -Naurp linux-2.6.21-rc6-mm1.orig/include/linux/hiddev.h 
linux-2.6.21-rc6-mm1.new/include/linux/hiddev.h
--- linux-2.6.21-rc6-mm1.orig/include/linux/hiddev.h    2007-02-05 
02:44:54.000000000 +0800
+++ linux-2.6.21-rc6-mm1.new/include/linux/hiddev.h     2007-04-11 
09:05:29.000000000 +0800
@@ -218,23 +218,5 @@ struct hid_usage;
 struct hid_field;
 struct hid_report;
 
-#ifdef CONFIG_USB_HIDDEV
-int hiddev_connect(struct hid_device *);
-void hiddev_disconnect(struct hid_device *);
-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 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_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
-
 #endif
 #endif
diff -Naurp linux-2.6.21-rc6-mm1.orig/include/linux/hid.h 
linux-2.6.21-rc6-mm1.new/include/linux/hid.h
--- linux-2.6.21-rc6-mm1.orig/include/linux/hid.h       2007-04-10 
09:16:50.000000000 +0800
+++ linux-2.6.21-rc6-mm1.new/include/linux/hid.h        2007-04-16 
13:09:51.000000000 +0800
@@ -35,6 +35,7 @@
 #include <linux/timer.h>
 #include <linux/workqueue.h>
 #include <linux/input.h>
+#include <asm/bitops.h>
 
 /*
  * USB HID (Human Interface Device) interface class code
@@ -270,6 +271,7 @@ struct hid_item {
 #define HID_QUIRK_LOGITECH_DESCRIPTOR          0x00100000
 #define HID_QUIRK_DUPLICATE_USAGES             0x00200000
 #define HID_QUIRK_RESET_LEDS                   0x00400000
+#define HID_QUIRK_SKIP                         0x80000000
 
 /*
  * This is the global environment of the parser. This information is
@@ -403,55 +405,112 @@ struct hid_input {
        struct input_dev *input;
 };
 
-struct hid_device {                                                    /* 
device report descriptor */
+struct hid_driver;
+struct hid_device {    /* device report descriptor */
+       struct device device;
+       struct module *module;
+       struct hid_driver *driver;
+       unsigned long sticky_driver;
+       unsigned long flags;
+       void *tl_data;  /* Transports layer data. */
+       void *hidraw;   /* It will be remove soon. */
+       int quirks;
+
         __u8 *rdesc;
        unsigned rsize;
-       struct hid_collection *collection;                              /* List 
of HID collections */
-       unsigned collection_size;                                       /* 
Number of allocated hid_collections */
-       unsigned maxcollection;                                         /* 
Number of parsed collections */
-       unsigned maxapplication;                                        /* 
Number of applications */
-       unsigned short bus;                                             /* BUS 
ID */
-       unsigned short vendor;                                          /* 
Vendor ID */
-       unsigned short product;                                         /* 
Product ID */
-       unsigned version;                                               /* HID 
version */
-       unsigned country;                                               /* HID 
country */
+       struct hid_collection *collection;      /* List of HID collections */
+       unsigned collection_size;       /* Number of allocated hid_collections 
*/
+       unsigned maxcollection;                 /* Number of parsed collections 
*/
+       unsigned maxapplication;                /* Number of applications */
+       unsigned short bus;                     /* BUS ID */
+       unsigned short vendor;                  /* Vendor ID */
+       unsigned short product;                 /* Product ID */
+       unsigned version;                       /* HID version */
+       unsigned country;                       /* HID country */
+       int open;                               /* Is the device open by 
anyone? */
        struct hid_report_enum report_enum[HID_REPORT_TYPES];
+       void *private;                          /* Data for specific driver */
 
-       struct device *dev;                                             /* 
device */
-
-       unsigned claimed;                                               /* 
Claimed by hidinput, hiddev? */
-       unsigned quirks;                                                /* 
Various quirks the device can pull on us */
+       void (*shutdown)(struct hid_device *dev);
 
-       struct list_head inputs;                                        /* The 
list of inputs */
-       void *hiddev;                                                   /* The 
hiddev structure */
-       void *hidraw;
-       int minor;                                                      /* 
Hiddev minor number */
-
-       wait_queue_head_t wait;                                         /* For 
sleeping */
-
-       int open;                                                       /* is 
the device open by anyone? */
-       char name[128];                                                 /* 
Device name */
-       char phys[64];                                                  /* 
Device physical location */
-       char uniq[64];                                                  /* 
Device unique identifier (serial #) */
-
-       void *driver_data;
-
-       /* device-specific function pointers */
-       int (*hidinput_input_event) (struct input_dev *, unsigned int, unsigned 
int, int);
-       int (*hid_open) (struct hid_device *);
-       void (*hid_close) (struct hid_device *);
-
-       /* hiddev event handler */
-       void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field,
-                                 struct hid_usage *, __s32);
-       void (*hiddev_report_event) (struct hid_device *, struct hid_report *);
-
-       /* handler for raw output data, used by hidraw */
-       int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t);
-#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
-       unsigned long pb_pressed_fn[NBITS(KEY_MAX)];
-       unsigned long pb_pressed_numlock[NBITS(KEY_MAX)];
-#endif
+       struct device *dev;                     /* Physical device(USB, 
Bluetooth, etc.) */
+       char name[128];                         /* Device name */
+       char phys[64];                          /* Device physical location */
+       char uniq[64];                          /* Device unique identifier 
(serial #) */
+       struct list_head inputs;                /* The list of inputs */
+};
+#define to_hid_device(dev) container_of(dev, struct hid_device, device);
+
+#define HID_IGNORE_VENDOR      1
+#define HID_IGNORE_PRODUCT     2
+#define HID_IGNORE_VERSION     4
+#define HID_IGNORE_COUNTRY     8
+
+struct skip_id {
+       struct list_head node;
+       unsigned int vendor;
+       unsigned int product;
+       unsigned int version;
+       unsigned int country;
+       unsigned int mask;
+};
+
+struct hid_hook;
+struct hid_driver {
+       char name[64];
+       char version[64];
+       struct module *module;
+       struct device_driver driver;
+       unsigned long flags;
+       
+       unsigned short bus;
+       struct hid_hook *hook;
+       struct list_head skip_table;
+
+       void *private;
+
+       int (*match)(struct hid_driver *, struct hid_device *);
+       int (*probe)(struct hid_device *);
+       void (*remove)(struct hid_device *);
+       void (*shutdown)(struct hid_device *);
+       int (*event)(struct input_dev *, unsigned int, unsigned int, int);
+       int (*open)(struct hid_device *);
+       void (*close)(struct hid_device *);
+};
+#define to_hid_driver(drv) container_of(drv, struct hid_driver, driver);
+
+struct hid_transport {
+       struct module *module;
+       unsigned short bus;
+       void (*update_busid)(struct hid_device *);
+       int (*event)(struct input_dev *, unsigned int, unsigned int, int);
+       int (*open)(struct hid_device *);
+       void (*close)(struct hid_device *);
+       int (*raw_report)(struct hid_device *, u8 *, size_t);
+       void *private;
+};
+
+struct usage_page_block;
+struct hid_hook {
+       void (*setup_usage)(struct hid_field*, struct hid_usage*);
+       void (*register_inputdev)(struct input_dev*);
+       int (*hid_event)(struct hid_field*, struct hid_usage*, __s32, int);
+       int (*pre_report_event)(struct hid_report*, int);
+       int (*report_event)(struct hid_report*, int);
+       int (*raw_event)(struct hid_device *, int, u8 *, int, int);
+       int (*raw_report)(struct hid_device *, u8 *, size_t);
+       struct usage_page_block *usage_page_table;
+};
+
+struct usage_block {
+       int usage; /* usage code */
+       int event; /* input event type, e.g. EV_KEY. */
+       int code;  /* input subsystem code, e.g. KEY_F1. */
+};
+
+struct usage_page_block {
+       int page; /* usage page code */
+       struct usage_block *usage_blockes;
 };
 
 #define HID_GLOBAL_STACK_SIZE 4
@@ -500,22 +559,38 @@ void hid_output_report(struct hid_report
 void hid_free_device(struct hid_device *device);
 struct hid_device *hid_parse_report(__u8 *start, unsigned size);
 
-#ifdef CONFIG_HID_FF
-int hid_ff_init(struct hid_device *hid);
-
-int hid_lgff_init(struct hid_device *hid);
-int hid_plff_init(struct hid_device *hid);
-int hid_tmff_init(struct hid_device *hid);
-int hid_zpff_init(struct hid_device *hid);
-#ifdef CONFIG_HID_PID
-int hid_pidff_init(struct hid_device *hid);
-#else
-static inline int hid_pidff_init(struct hid_device *hid) { return -ENODEV; }
-#endif
+#define hid_flag_accessor(DD, name, FLAG)      \
+static inline void set_##DD##_##name(struct DD* dd)\
+{\
+       set_bit(FLAG, &dd->flags);\
+}\
+static inline void clear_##DD##_##name(struct DD* dd)\
+{\
+       clear_bit(FLAG, &dd->flags);\
+}\
+static inline int is_##DD##_##name(struct DD* dd)\
+{\
+       return test_bit(FLAG, &dd->flags);\
+}
+
+/* set_hid_driver_sticky()/is_hid_driver_sticky() */
+#define HID_DRV_STICKY (0x1UL)
+hid_flag_accessor(hid_driver, sticky, HID_DRV_STICKY)
+
+static inline struct hid_device *hid_new_device(int gfp)
+{
+       return kzalloc(sizeof(struct hid_device), gfp);
+}
+
+extern int hid_register_transport(struct hid_transport *);
+extern void hid_unregister_transport(struct hid_transport *);
+extern int hid_register_device(struct hid_device *);
+extern void hid_unregister_device(struct hid_device *);
+extern int hid_register_driver(struct hid_driver *);
+extern void hid_unregister_driver(struct hid_driver *);
+extern int hid_open(struct hid_device *);
+extern void hid_close(struct hid_device *);
 
-#else
-static inline int hid_ff_init(struct hid_device *hid) { return -1; }
-#endif
 #ifdef DEBUG
 #define dbg(format, arg...) printk(KERN_DEBUG "%s: " format "\n" , \
                __FILE__ , ## arg)
diff -Naurp linux-2.6.21-rc6-mm1.orig/include/linux/hidraw.h 
linux-2.6.21-rc6-mm1.new/include/linux/hidraw.h
--- linux-2.6.21-rc6-mm1.orig/include/linux/hidraw.h    2007-04-10 
09:16:50.000000000 +0800
+++ linux-2.6.21-rc6-mm1.new/include/linux/hidraw.h     2007-04-11 
09:05:31.000000000 +0800
@@ -67,20 +67,6 @@ struct hidraw_list {
        struct mutex read_mutex;
 };
 
-#ifdef CONFIG_HIDRAW
-int hidraw_init(void);
-void hidraw_exit(void);
-void hidraw_report_event(struct hid_device *, u8 *, int);
-int hidraw_connect(struct hid_device *);
-void hidraw_disconnect(struct hid_device *);
-#else
-static inline int hidraw_init(void) { return 0; }
-static inline void hidraw_exit(void) { }
-static inline void hidraw_report_event(struct hid_device *hid, u8 *data, int 
len) { }
-static inline int hidraw_connect(struct hid_device *hid) { return -1; }
-static inline void hidraw_disconnect(struct hid_device *hid) { }
-#endif
-
 #endif
 
 #endif
diff -Naurp linux-2.6.21-rc6-mm1.orig/include/linux/input.h 
linux-2.6.21-rc6-mm1.new/include/linux/input.h
--- linux-2.6.21-rc6-mm1.orig/include/linux/input.h     2007-04-10 
09:16:50.000000000 +0800
+++ linux-2.6.21-rc6-mm1.new/include/linux/input.h      2007-04-10 
10:24:51.000000000 +0800
@@ -679,7 +679,7 @@ struct input_absinfo {
 #define BUS_I2C                        0x18
 #define BUS_HOST               0x19
 #define BUS_GSC                        0x1A
-
+#define BUS_MAX                        (BUS_GSC+1)
 /*
  * Values describing the status of a force-feedback effect
  */




-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to