最終更新:2015-10-23 (金) 16:27:32 (3098d)  

hid_driver
Top / hid_driver

種類

usb_driver

hid_driver

hid_driver型のドライバ

コールバック

  • hid_driver.probenew device inserted
    hid_driver.remove?device removed (NULL if not a hot-plug capable driver)
    hid_driver.report_table?on which reports to call raw_event (NULL means all)
    hid_driver.raw_eventif report in report_table, this hook is called (NULL means nop)
    hid_driver.usage_table?on which events to call event (NULL means all)
    hid_driver.eventif usage in usage_table, this hook is called (NULL means nop)
    hid_driver.report?this hook is called after parsing a report (NULL means nop)
    hid_driver.report_fixupcalled before report descriptor parsing (NULL means nop)
    hid_driver.input_mappinginvoked on input registering before mapping an usage
    hid_driver.input_mapped?invoked on input registering after mapping an usage
    hid_driver.input_configured?invoked just before the device is registered
    hid_driver.feature_mapping?invoked on feature registering
    hid_driver.suspend?invoked on suspend (NULL means nop)
    hid_driver.resume?invoked on resume if device was not reset (NULL means nop)
    hid_driver.reset_resume?invoked on resume if device was reset (NULL means nop)

定義

  • /**
     * struct hid_driver
     * @name: driver name (e.g. "Footech_bar-wheel")
     * @id_table: which devices is this driver for (must be non-NULL for probe
     *            to be called)
     * @dyn_list: list of dynamically added device ids
     * @dyn_lock: lock protecting @dyn_list
     * @probe: new device inserted
     * @remove: device removed (NULL if not a hot-plug capable driver)
     * @report_table: on which reports to call raw_event (NULL means all)
     * @raw_event: if report in report_table, this hook is called (NULL means nop)
     * @usage_table: on which events to call event (NULL means all)
     * @event: if usage in usage_table, this hook is called (NULL means nop)
     * @report: this hook is called after parsing a report (NULL means nop)
     * @report_fixup: called before report descriptor parsing (NULL means nop)
     * @input_mapping: invoked on input registering before mapping an usage
     * @input_mapped: invoked on input registering after mapping an usage
     * @input_configured: invoked just before the device is registered
     * @feature_mapping: invoked on feature registering
     * @suspend: invoked on suspend (NULL means nop)
     * @resume: invoked on resume if device was not reset (NULL means nop)
     * @reset_resume: invoked on resume if device was reset (NULL means nop)
     *
     * probe should return -errno on error, or 0 on success. During probe,
     * input will not be passed to raw_event unless hid_device_io_start is
     * called.
     *
     * raw_event and event should return 0 on no action performed, 1 when no
     * further processing should be done and negative on error
     *
     * input_mapping shall return a negative value to completely ignore this usage
     * (e.g. doubled or invalid usage), zero to continue with parsing of this
     * usage by generic code (no special handling needed) or positive to skip
     * generic parsing (needed special handling which was done in the hook already)
     * input_mapped shall return negative to inform the layer that this usage
     * should not be considered for further processing or zero to notify that
     * no processing was performed and should be done in a generic manner
     * Both these functions may be NULL which means the same behavior as returning
     * zero from them.
     */
    struct hid_driver {
            char *name;
            const struct hid_device_id *id_table;
    
            struct list_head dyn_list;
            spinlock_t dyn_lock;
    
            int (*probe)(struct hid_device *dev, const struct hid_device_id *id);
            void (*remove)(struct hid_device *dev);
    
            const struct hid_report_id *report_table;
            int (*raw_event)(struct hid_device *hdev, struct hid_report *report,
                            u8 *data, int size);
            const struct hid_usage_id *usage_table;
            int (*event)(struct hid_device *hdev, struct hid_field *field,
                            struct hid_usage *usage, __s32 value);
            void (*report)(struct hid_device *hdev, struct hid_report *report);
    
            __u8 *(*report_fixup)(struct hid_device *hdev, __u8 *buf,
                            unsigned int *size);
    
            int (*input_mapping)(struct hid_device *hdev,
                            struct hid_input *hidinput, struct hid_field *field,
                            struct hid_usage *usage, unsigned long **bit, int *max);
            int (*input_mapped)(struct hid_device *hdev,
                            struct hid_input *hidinput, struct hid_field *field,
                            struct hid_usage *usage, unsigned long **bit, int *max);
            void (*input_configured)(struct hid_device *hdev,
                                     struct hid_input *hidinput);
            void (*feature_mapping)(struct hid_device *hdev,
                            struct hid_field *field,
                            struct hid_usage *usage);
    #ifdef CONFIG_PM
            int (*suspend)(struct hid_device *hdev, pm_message_t message);
            int (*resume)(struct hid_device *hdev);
            int (*reset_resume)(struct hid_device *hdev);
    #endif
    /* private: */
            struct device_driver driver;
    };