HID: add feature_mapping callback
Currently hid doesn't export the features it knows to the specific modules. Some information can be really important in such features: MosArt and Cypress devices are by default not in a multitouch mode. We have to send the value 2 on the right feature. This patch exports to the module the features report so they can find the right feature to set up the correct mode. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@enac.fr> Acked-by: Henrik Rydberg <rydberg@euromail.se> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
parent
31b6ca0af7
commit
0d2689c0f0
|
@ -290,6 +290,14 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
|
||||||
goto ignore;
|
goto ignore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (field->report_type == HID_FEATURE_REPORT) {
|
||||||
|
if (device->driver->feature_mapping) {
|
||||||
|
device->driver->feature_mapping(device, hidinput, field,
|
||||||
|
usage);
|
||||||
|
}
|
||||||
|
goto ignore;
|
||||||
|
}
|
||||||
|
|
||||||
if (device->driver->input_mapping) {
|
if (device->driver->input_mapping) {
|
||||||
int ret = device->driver->input_mapping(device, hidinput, field,
|
int ret = device->driver->input_mapping(device, hidinput, field,
|
||||||
usage, &bit, &max);
|
usage, &bit, &max);
|
||||||
|
@ -839,7 +847,6 @@ int hidinput_connect(struct hid_device *hid, unsigned int force)
|
||||||
struct hid_input *hidinput = NULL;
|
struct hid_input *hidinput = NULL;
|
||||||
struct input_dev *input_dev;
|
struct input_dev *input_dev;
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
int max_report_type = HID_OUTPUT_REPORT;
|
|
||||||
|
|
||||||
INIT_LIST_HEAD(&hid->inputs);
|
INIT_LIST_HEAD(&hid->inputs);
|
||||||
|
|
||||||
|
@ -856,10 +863,11 @@ int hidinput_connect(struct hid_device *hid, unsigned int force)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hid->quirks & HID_QUIRK_SKIP_OUTPUT_REPORTS)
|
for (k = HID_INPUT_REPORT; k <= HID_FEATURE_REPORT; k++) {
|
||||||
max_report_type = HID_INPUT_REPORT;
|
if (k == HID_OUTPUT_REPORT &&
|
||||||
|
hid->quirks & HID_QUIRK_SKIP_OUTPUT_REPORTS)
|
||||||
|
continue;
|
||||||
|
|
||||||
for (k = HID_INPUT_REPORT; k <= max_report_type; k++)
|
|
||||||
list_for_each_entry(report, &hid->report_enum[k].report_list, list) {
|
list_for_each_entry(report, &hid->report_enum[k].report_list, list) {
|
||||||
|
|
||||||
if (!report->maxfield)
|
if (!report->maxfield)
|
||||||
|
@ -912,6 +920,7 @@ int hidinput_connect(struct hid_device *hid, unsigned int force)
|
||||||
hidinput = NULL;
|
hidinput = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (hidinput && input_register_device(hidinput->input))
|
if (hidinput && input_register_device(hidinput->input))
|
||||||
goto out_cleanup;
|
goto out_cleanup;
|
||||||
|
|
|
@ -593,6 +593,7 @@ struct hid_usage_id {
|
||||||
* @report_fixup: called before report descriptor parsing (NULL means nop)
|
* @report_fixup: called before report descriptor parsing (NULL means nop)
|
||||||
* @input_mapping: invoked on input registering before mapping an usage
|
* @input_mapping: invoked on input registering before mapping an usage
|
||||||
* @input_mapped: invoked on input registering after mapping an usage
|
* @input_mapped: invoked on input registering after mapping an usage
|
||||||
|
* @feature_mapping: invoked on feature registering
|
||||||
* @suspend: invoked on suspend (NULL means nop)
|
* @suspend: invoked on suspend (NULL means nop)
|
||||||
* @resume: invoked on resume if device was not reset (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)
|
* @reset_resume: invoked on resume if device was reset (NULL means nop)
|
||||||
|
@ -636,6 +637,9 @@ struct hid_driver {
|
||||||
int (*input_mapped)(struct hid_device *hdev,
|
int (*input_mapped)(struct hid_device *hdev,
|
||||||
struct hid_input *hidinput, struct hid_field *field,
|
struct hid_input *hidinput, struct hid_field *field,
|
||||||
struct hid_usage *usage, unsigned long **bit, int *max);
|
struct hid_usage *usage, unsigned long **bit, int *max);
|
||||||
|
void (*feature_mapping)(struct hid_device *hdev,
|
||||||
|
struct hid_input *hidinput, struct hid_field *field,
|
||||||
|
struct hid_usage *usage);
|
||||||
#ifdef CONFIG_PM
|
#ifdef CONFIG_PM
|
||||||
int (*suspend)(struct hid_device *hdev, pm_message_t message);
|
int (*suspend)(struct hid_device *hdev, pm_message_t message);
|
||||||
int (*resume)(struct hid_device *hdev);
|
int (*resume)(struct hid_device *hdev);
|
||||||
|
|
Reference in New Issue