This new API allows a transport driver to notify the HID device driver
about a transport layer error.
Signed-off-by: Dmitry Antipov <redacted>
---
include/linux/hid.h | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 1f134c8f8972..97041c322a0f 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -703,6 +703,20 @@ struct hid_usage_id {
__u32 usage_code;
};
+enum hid_transport_error_type {
+ HID_TRANSPORT_ERROR_TYPE_BUS_INPUT_TRANSFER_START = 0,
+ HID_TRANSPORT_ERROR_TYPE_BUS_INPUT_TRANSFER_BODY,
+ HID_TRANSPORT_ERROR_TYPE_BUS_INPUT_TRANSFER_HEADER,
+ HID_TRANSPORT_ERROR_TYPE_BUS_OUTPUT_TRANSFER,
+ HID_TRANSPORT_ERROR_TYPE_DEVICE_INITIATED_RESET,
+ HID_TRANSPORT_ERROR_TYPE_HEADER_DATA,
+ HID_TRANSPORT_ERROR_TYPE_INPUT_REPORT_DATA,
+ HID_TRANSPORT_ERROR_TYPE_REPORT_TYPE,
+ HID_TRANSPORT_ERROR_TYPE_GET_FEATURE_RESPONSE,
+ HID_TRANSPORT_ERROR_TYPE_REGULATOR_ENABLE,
+ HID_TRANSPORT_ERROR_TYPE_REGULATOR_DISABLE
+};
+
/**
* struct hid_driver
* @name: driver name (e.g. "Footech_bar-wheel")@@ -726,6 +740,7 @@ struct hid_usage_id {
* @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)
+ * @on_transport_error: invoked on error hit by transport driver
*
* 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@@ -777,6 +792,10 @@ struct hid_driver {
void (*feature_mapping)(struct hid_device *hdev,
struct hid_field *field,
struct hid_usage *usage);
+ void (*on_transport_error)(struct hid_device *hdev,
+ int err_type,
+ int err_code,
+ bool handled);
#ifdef CONFIG_PM
int (*suspend)(struct hid_device *hdev, pm_message_t message);
int (*resume)(struct hid_device *hdev);--
2.25.1