Re: [PATCH v2 11/11] HID: hid-multitouch: get rid of usbhid depedency for general path
From: Henrik Rydberg <hidden>
Date: 2012-10-31 19:14:02
Also in:
lkml
quoted
In my drawer, I have a patchset that aims to remove all usbhid dependence, from all the drivers. Perhaps the attached patch is something to consider here?yep, removing usbhid dependencies is a good thing. See my review below :)quoted
From 5d9a791e0a9e41bcea0fcb286e2849b403675f37 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg <redacted> Date: Mon, 2 Jul 2012 20:38:21 +0200 Subject: [PATCH 3/7] hid: extend interface with report requests --- drivers/hid/usbhid/hid-core.c | 14 ++++++++++++++ include/linux/hid.h | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+)diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index de1f9ac..3c618da 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c@@ -1251,6 +1251,18 @@ static int usbhid_power(struct hid_device *hid, int lvl) return r; } +static void usbhid_send(struct hid_device *hid, struct hid_report *rep, int req) +{ + switch (req) { + case HID_REQ_GET_REPORT: + usbhid_submit_report(hid, rep, USB_DIR_IN); + break; + case HID_REQ_SET_REPORT: + usbhid_submit_report(hid, rep, USB_DIR_OUT); + break; + } +} + static struct hid_ll_driver usb_hid_driver = { .parse = usbhid_parse, .start = usbhid_start,@@ -1259,6 +1271,8 @@ static struct hid_ll_driver usb_hid_driver = { .close = usbhid_close, .power = usbhid_power, .hidinput_input_event = usb_hidinput_input_event, + .send = usbhid_send,the name here is a little bit misleading. You are using "send" to also "get" reports... Maybe "hid_request" is a better name. This will allows us to add the missing function: Get_Descriptor, Set_Descriptor, Get_Report Request, Set_Report Request, Get_Idle, Set_Idle, Get_Protocol, Set_Protocol and maybe others - even WAIT for instance :)
Sounds good, I'll ponder this a bit.
quoted
+ .wait = usbhid_wait_io,is it really necessary to wait for IO? (I think it will not be one line for hid over i2c...).
We can certainly skip it for the scope of your patchset, but last time I checked, it was needed in quite a few places. Thanks, Henrik