# \[RFC v2 4/4\] HID: i2c-hid: LED input events handling

- From: Andre Guedes \<hidden\>
- Date: 2012-12-01 19:07:47 
- List: linux-input
- Page: https://ratatoskr.run/linux-input/2012/12/8920698
- Thread: https://ratatoskr.run/linux-input/2012/12/8920696/t.md

```text
This patch removes code for handling LED input events from i2c_hid_
hidinput_input_event and call hidinput_led_output_report helper
instead.

In consequence, i2c-hid driver is now sending LED output
reports to device.

Signed-off-by: Andre Guedes <redacted>
---
 drivers/hid/i2c-hid/i2c-hid.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index 67ab5b7..e4722d3 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -701,8 +701,6 @@ static int i2c_hid_hidinput_input_event(struct input_dev *dev,
 		unsigned int type, unsigned int code, int value)
 {
 	struct hid_device *hid = input_get_drvdata(dev);
-	struct hid_field *field;
-	int offset;
 
 	if (type == EV_FF)
 		return input_ff_event(dev, type, code, value);
@@ -710,14 +708,7 @@ static int i2c_hid_hidinput_input_event(struct input_dev *dev,
 	if (type != EV_LED)
 		return -1;
 
-	offset = hidinput_find_field(hid, type, code, &field);
-
-	if (offset == -1) {
-		hid_warn(dev, "event field not found\n");
-		return -1;
-	}
-
-	hid_set_field(field, offset, value);
+	hidinput_led_output_report(hid, code, value);
 
 	return 0;
 }
-- 
1.8.0.1

```
