hid driver transport cleanup
Subsystems (6)
v2 cover hid driver transport cleanup
Hi guys,
this is the v2 of the hid transport cleanup.
Changes since v1:
- gathered reviewed/acked/etc..
- changed commit messages of patches 4-6
- add newcomer into account (thingm)
- incorporated the i2c-hid driver change into the series
I still did not implemented the final usb cleanup for hid-multitouch as it may required few comments.
Cheers,
Benjamin
Benjamin Tissoires (8):
HID: Extend the interface with report requests
HID: Extend the interface with wait io request
HID: Kconfig: Remove explicit transport layer dependencies
HID: use hid_hw_request() instead of direct call to usbhid
HID: use hid_hw_wait() instead of direct call to usbhid
HID: multitouch: remove explicit usbhid dependency
HID: multitouch: Copyright and note on regression tests
HID: i2c-hid: implement request() callback
drivers/hid/Kconfig | 100 ++++++++++++++++++------------------ drivers/hid/hid-apple.c | 1 - drivers/hid/hid-axff.c | 6 +-- drivers/hid/hid-dr.c | 8 ++- drivers/hid/hid-emsff.c | 6 +-- drivers/hid/hid-gaff.c | 10 ++-- drivers/hid/hid-holtekff.c | 4 +- drivers/hid/hid-kye.c | 4 +- drivers/hid/hid-lenovo-tpkbd.c | 4 +- drivers/hid/hid-lg2ff.c | 6 +-- drivers/hid/hid-lg3ff.c | 6 +-- drivers/hid/hid-lg4ff.c | 18 +++---- drivers/hid/hid-lgff.c | 8 ++- drivers/hid/hid-logitech-dj.c | 3 +- drivers/hid/hid-magicmouse.c | 1 - drivers/hid/hid-multitouch.c | 21 ++++++-- drivers/hid/hid-ntrig.c | 10 ++-- drivers/hid/hid-picolcd.h | 4 +- drivers/hid/hid-picolcd_backlight.c | 4 +- drivers/hid/hid-picolcd_cir.c | 2 - drivers/hid/hid-picolcd_core.c | 8 ++- drivers/hid/hid-picolcd_debugfs.c | 2 - drivers/hid/hid-picolcd_fb.c | 12 ++--- drivers/hid/hid-picolcd_lcd.c | 4 +- drivers/hid/hid-picolcd_leds.c | 4 +- drivers/hid/hid-pl.c | 6 +-- drivers/hid/hid-prodikeys.c | 3 +- drivers/hid/hid-sensor-hub.c | 12 ++--- drivers/hid/hid-sjoy.c | 6 +-- drivers/hid/hid-speedlink.c | 2 - drivers/hid/hid-steelseries.c | 3 +- drivers/hid/hid-thingm.c | 1 - drivers/hid/hid-tmff.c | 6 +-- drivers/hid/hid-zpff.c | 6 +-- drivers/hid/i2c-hid/i2c-hid.c | 32 ++++++++++++ drivers/hid/usbhid/hid-core.c | 20 ++++++-- drivers/hid/usbhid/hid-pidff.c | 80 ++++++++++++++--------------- drivers/hid/usbhid/hiddev.c | 8 +-- drivers/hid/usbhid/usbhid.h | 3 -- include/linux/hid.h | 34 ++++++++++++ 40 files changed, 257 insertions(+), 221 deletions(-)
Signature · 1 line
1.8.1.2
PATCH v2 1/8 HID: Extend the interface with report requests
From: Henrik Rydberg <[email protected]>
Some drivers send reports directly to underlying device, creating an unwanted dependency on the underlying transport layer. This patch adds hid_hw_request() to the interface, thereby removing usbhid from the lion share of the drivers.
--- drivers/hid/usbhid/hid-core.c | 13 +++++++++++++ include/linux/hid.h | 20 ++++++++++++++++++++ 2 files changed, 33 insertions(+)
drivers/hid/usbhid/hid-core.c +13 -0
@@ -1243,6 +1243,18 @@ static int usbhid_power(struct hid_device *hid, int lvl)return r; } +static void usbhid_request (struct hid_device *hid,struct hid_report *rep,int reqtype) +{ +switch (reqtype) { +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,
@@ -1251,6 +1263,7 @@ static struct hid_ll_driver usb_hid_driver = { .close = usbhid_close, .power = usbhid_power, .hidinput_input_event = usb_hidinput_input_event, + .request = usbhid_request, };static int usbhid_probe (struct usb_interface *intf,const struct usb_device_id *id)
include/linux/hid.h +20 -0
@@ -662,6 +662,7 @@ struct hid_driver {* @hidinput_input_event: event input event (e.g. ff or leds) * @parse: this method is called only once to parse the device data, * shouldn't allocate anything to not leak memory +* @request: send report request to device (e.g. feature report) */ struct hid_ll_driver {int (*start)(struct hid_device *hdev);
@@ -676,6 +677,10 @@ struct hid_ll_driver { unsigned int code, int value);int (*parse)(struct hid_device *hdev); + +void (*request)(struct hid_device *hdev, +struct hid_report *report,int reqtype); + };#define PM_HINT_FULLON 1<<5
@@ -883,6 +888,21 @@ static inline int hid_hw_power(struct hid_device *hdev, int level)return hdev->ll_driver->power ? hdev->ll_driver->power (hdev, level) :0 ; } + +/** +* hid_hw_request - send report request to device +* +* @hdev: hid device +* @report: report to send +* @reqtype: hid request type +*/ +static inline void hid_hw_request (struct hid_device *hdev, +struct hid_report *report,int reqtype) +{ +if (hdev->ll_driver->request) + hdev->ll_driver->request (hdev, report, reqtype); +} +int hid_report_raw_event (struct hid_device *hid,int type,u8 *data,int size,int interrupt);
Signature · 1 line
1.8.1.2
PATCH v2 2/8 HID: Extend the interface with wait io request
In reply to Benjamin TissoiresFrom: Henrik Rydberg <[email protected]>
Some drivers need to wait for an io from the underlying device, creating an unwanted dependency on the underlying transport layer. This patch adds wait() to the interface, thereby removing usbhid from the lion share of the drivers.
--- drivers/hid/usbhid/hid-core.c | 1 + include/linux/hid.h | 14 ++++++++++++++ 2 files changed, 15 insertions(+)
drivers/hid/usbhid/hid-core.c +1 -0
@@ -1264,6 +1264,7 @@ static struct hid_ll_driver usb_hid_driver = { .power = usbhid_power, .hidinput_input_event = usb_hidinput_input_event, .request = usbhid_request, + .wait = usbhid_wait_io, };static int usbhid_probe (struct usb_interface *intf,const struct usb_device_id *id)
include/linux/hid.h +14 -0
@@ -663,6 +663,7 @@ struct hid_driver {* @parse: this method is called only once to parse the device data, * shouldn't allocate anything to not leak memory * @request: send report request to device (e.g. feature report) +* @wait: wait for buffered io to complete (send/recv reports) */ struct hid_ll_driver {int (*start)(struct hid_device *hdev);
@@ -681,6 +682,8 @@ struct hid_ll_driver {void (*request)(struct hid_device *hdev,struct hid_report *report,int reqtype); +int (*wait)(struct hid_device *hdev); + };#define PM_HINT_FULLON 1<<5
@@ -903,6 +906,17 @@ static inline void hid_hw_request(struct hid_device *hdev, hdev->ll_driver->request (hdev, report, reqtype); } +/** +* hid_hw_wait - wait for buffered io to complete +* +* @hdev: hid device +*/ +static inline void hid_hw_wait (struct hid_device *hdev) +{ +if (hdev->ll_driver->wait) + hdev->ll_driver->wait (hdev); +} +int hid_report_raw_event (struct hid_device *hid,int type,u8 *data,int size,int interrupt);
Signature · 1 line
1.8.1.2
PATCH v2 3/8 HID: Kconfig: Remove explicit transport layer dependencies
In reply to Benjamin TissoiresMost HID drivers (rightfully) only depend on the HID bus, not the specific transport layer. Remove such dependencies where applicable.
--- drivers/hid/Kconfig | 68 ++++++++++++++++++++++---------------------- drivers/hid/hid-apple.c | 1 - drivers/hid/hid-magicmouse.c | 1 - drivers/hid/hid-speedlink.c | 2 -- drivers/hid/hid-thingm.c | 1 - 5 files changed, 34 insertions(+), 39 deletions(-)
drivers/hid/Kconfig +34 -34
@@ -92,7 +92,7 @@ menu "Special HID drivers" config HID_A4TECH tristate "A4 tech mice" if EXPERT - depends on USB_HID + depends on HID default !EXPERT ---help--- Support for A4 tech X5 and WOP-35 / Trust 450L mice.
@@ -113,7 +113,7 @@ config HID_ACRUX_FF config HID_APPLE tristate "Apple {i,Power,Mac}Books" if EXPERT - depends on (USB_HID || BT_HIDP) + depends on HID default !EXPERT ---help--- Support for some Apple devices which less or more break
@@ -124,27 +124,27 @@ config HID_APPLE config HID_AUREAL tristate "Aureal" - depends on USB_HID + depends on HID ---help--- Support for Aureal Cy se W-01RN Remote Controller and other Aureal derived remotes. config HID_BELKIN tristate "Belkin Flip KVM and Wireless keyboard" if EXPERT - depends on USB_HID + depends on HID default !EXPERT ---help--- Support for Belkin Flip KVM and Wireless keyboard. config HID_CHERRY tristate "Cherry Cymotion keyboard" if EXPERT - depends on USB_HID + depends on HID default !EXPERT ---help--- Support for Cherry Cymotion keyboard. config HID_CHICONY tristate "Chicony Tactical pad" if EXPERT - depends on USB_HID + depends on HID default !EXPERT ---help--- Support for Chicony Tactical pad.
@@ -166,7 +166,7 @@ config HID_PRODIKEYS config HID_CYPRESS tristate "Cypress mouse and barcode readers" if EXPERT - depends on USB_HID + depends on HID default !EXPERT ---help--- Support for cypress mouse and barcode readers.
@@ -202,13 +202,13 @@ config HID_EMS_FF config HID_ELECOM tristate "ELECOM BM084 bluetooth mouse" - depends on BT_HIDP + depends on HID ---help--- Support for the ELECOM BM084 (bluetooth mouse). config HID_EZKEY tristate "Ezkey BTC 8193 keyboard" if EXPERT - depends on USB_HID + depends on HID default !EXPERT ---help--- Support for Ezkey BTC 8193 keyboard.
@@ -231,7 +231,7 @@ config HOLTEK_FF config HID_KEYTOUCH tristate "Keytouch HID devices" - depends on USB_HID + depends on HID ---help--- Support for Keytouch HID devices not fully compliant with the specification. Currently supported:
@@ -249,25 +249,25 @@ config HID_KYE config HID_UCLOGIC tristate "UC-Logic" - depends on USB_HID + depends on HID ---help--- Support for UC-Logic tablets. config HID_WALTOP tristate "Waltop" - depends on USB_HID + depends on HID ---help--- Support for Waltop tablets. config HID_GYRATION tristate "Gyration remote control" - depends on USB_HID + depends on HID ---help--- Support for Gyration remote control. config HID_ICADE tristate "ION iCade arcade controller" - depends on BT_HIDP + depends on HID ---help--- Support for the ION iCade arcade controller to work as a joystick.
@@ -276,20 +276,20 @@ config HID_ICADE config HID_TWINHAN tristate "Twinhan IR remote control" - depends on USB_HID + depends on HID ---help--- Support for Twinhan IR remote control. config HID_KENSINGTON tristate "Kensington Slimblade Trackball" if EXPERT - depends on USB_HID + depends on HID default !EXPERT ---help--- Support for Kensington Slimblade Trackball. config HID_LCPOWER tristate "LC-Power" - depends on USB_HID + depends on HID ---help--- Support for LC-Power RC1000MCE RF remote control.
@@ -308,7 +308,7 @@ config HID_LENOVO_TPKBD config HID_LOGITECH tristate "Logitech devices" if EXPERT - depends on USB_HID + depends on HID default !EXPERT ---help--- Support for Logitech devices that are not fully compliant with HID standard.
@@ -374,7 +374,7 @@ config LOGIWHEELS_FF config HID_MAGICMOUSE tristate "Apple MagicMouse multi-touch support" - depends on BT_HIDP + depends on HID ---help--- Support for the Apple Magic Mouse multi-touch.
@@ -383,14 +383,14 @@ config HID_MAGICMOUSE config HID_MICROSOFT tristate "Microsoft non-fully HID-compliant devices" if EXPERT - depends on USB_HID + depends on HID default !EXPERT ---help--- Support for Microsoft devices that are not fully compliant with HID standard. config HID_MONTEREY tristate "Monterey Genius KB29E keyboard" if EXPERT - depends on USB_HID + depends on HID default !EXPERT ---help--- Support for Monterey Genius KB29E.
@@ -445,7 +445,7 @@ config HID_NTRIG config HID_ORTEK tristate "Ortek PKB-1700/WKB-2000/Skycable wireless keyboard and mouse trackpad" - depends on USB_HID + depends on HID ---help--- There are certain devices which have LogicalMaximum wrong in the keyboard usage page of their report descriptor. The most prevailing ones so far
@@ -473,7 +473,7 @@ config PANTHERLORD_FF config HID_PETALYNX tristate "Petalynx Maxter remote control" - depends on USB_HID + depends on HID ---help--- Support for Petalynx Maxter remote control.
@@ -545,14 +545,14 @@ config HID_PICOLCD_CIR config HID_PRIMAX tristate "Primax non-fully HID-compliant devices" - depends on USB_HID + depends on HID ---help--- Support for Primax devices that are not fully compliant with the HID standard. config HID_PS3REMOTE tristate "Sony PS3 BD Remote Control" - depends on BT_HIDP + depends on HID ---help--- Support for the Sony PS3 Blue-ray Disk Remote Control and Logitech Harmony Adapter for PS3, which connect over Bluetooth.
@@ -569,7 +569,7 @@ config HID_ROCCAT config HID_SAITEK tristate "Saitek non-fully HID-compliant devices" - depends on USB_HID + depends on HID ---help--- Support for Saitek devices that are not fully compliant with the HID standard.
@@ -578,7 +578,7 @@ config HID_SAITEK config HID_SAMSUNG tristate "Samsung InfraRed remote control or keyboards" - depends on USB_HID + depends on HID ---help--- Support for Samsung InfraRed remote control or keyboards.
@@ -604,7 +604,7 @@ config HID_STEELSERIES config HID_SUNPLUS tristate "Sunplus wireless desktop" - depends on USB_HID + depends on HID ---help--- Support for Sunplus wireless desktop.
@@ -650,20 +650,20 @@ config SMARTJOYPLUS_FF config HID_TIVO tristate "TiVo Slide Bluetooth remote control support" - depends on (USB_HID || BT_HIDP) + depends on HID ---help--- Say Y if you have a TiVo Slide Bluetooth remote control. config HID_TOPSEED tristate "TopSeed Cyberlink, BTC Emprex, Conceptronic remote control support" - depends on USB_HID + depends on HID ---help--- Say Y if you have a TopSeed Cyberlink or BTC Emprex or Conceptronic CLLRCMCE remote control. config HID_THINGM tristate "ThingM blink(1) USB RGB LED" - depends on USB_HID + depends on HID depends on LEDS_CLASS ---help--- Support for the ThingM blink(1) USB RGB LED. This driver registers a
@@ -689,7 +689,7 @@ config THRUSTMASTER_FF config HID_WACOM tristate "Wacom Bluetooth devices support" - depends on BT_HIDP + depends on HID depends on LEDS_CLASS select POWER_SUPPLY ---help---
@@ -697,7 +697,7 @@ config HID_WACOM config HID_WIIMOTE tristate "Nintendo Wii Remote support" - depends on BT_HIDP + depends on HID depends on LEDS_CLASS select POWER_SUPPLY select INPUT_FF_MEMLESS
@@ -729,7 +729,7 @@ config ZEROPLUS_FF config HID_ZYDACRON tristate "Zydacron remote control support" - depends on USB_HID + depends on HID ---help--- Support for Zydacron remote control.
drivers/hid/hid-apple.c +0 -1
@@ -21,7 +21,6 @@#include <linux/hid.h> #include <linux/module.h> #include <linux/slab.h> -#include <linux/usb.h> #include "hid-ids.h"
drivers/hid/hid-magicmouse.c +0 -1
@@ -19,7 +19,6 @@#include <linux/input/mt.h> #include <linux/module.h> #include <linux/slab.h> -#include <linux/usb.h> #include "hid-ids.h"
drivers/hid/hid-speedlink.c +0 -2
@@ -16,10 +16,8 @@#include <linux/device.h> #include <linux/hid.h> #include <linux/module.h> -#include <linux/usb.h> #include "hid-ids.h" -#include "usbhid/usbhid.h" static const struct hid_device_id speedlink_devices[] = { {HID_USB_DEVICE (USB_VENDOR_ID_X_TENSIONS ,USB_DEVICE_ID_SPEEDLINK_VAD_CEZANNE )},
drivers/hid/hid-thingm.c +0 -1
@@ -12,7 +12,6 @@#include <linux/hid.h> #include <linux/leds.h> #include <linux/module.h> -#include <linux/usb.h> #include "hid-ids.h"
Signature · 1 line
1.8.1.2
PATCH v2 4/8 HID: use hid_hw_request() instead of direct call to usbhid
In reply to Benjamin TissoiresThis allows the hid drivers to be independent from the transport layer.
The patch was constructed by replacing all occurences of usbhid_submit_report() by its hid_hw_request() counterpart. Then, drivers not requiring USB_HID anymore have their USB_HID dependency cleaned in the Kconfig file.
Finally, few drivers still depends on USB_HID. Many of them are requiring the io wait callback. They are found in the next patch.
For the sensor-hub part:
--- drivers/hid/Kconfig | 30 ++++++++--------- drivers/hid/hid-axff.c | 6 ++-- drivers/hid/hid-dr.c | 8 ++--- drivers/hid/hid-emsff.c | 6 ++-- drivers/hid/hid-gaff.c | 10 +++--- drivers/hid/hid-holtekff.c | 4 +-- drivers/hid/hid-kye.c | 4 +-- drivers/hid/hid-lenovo-tpkbd.c | 4 +-- drivers/hid/hid-lg2ff.c | 6 ++-- drivers/hid/hid-lg3ff.c | 6 ++-- drivers/hid/hid-lg4ff.c | 18 +++++------ drivers/hid/hid-lgff.c | 8 ++--- drivers/hid/hid-logitech-dj.c | 3 +- drivers/hid/hid-multitouch.c | 4 +-- drivers/hid/hid-ntrig.c | 6 ++-- drivers/hid/hid-picolcd.h | 4 +-- drivers/hid/hid-picolcd_backlight.c | 4 +-- drivers/hid/hid-picolcd_cir.c | 2 -- drivers/hid/hid-picolcd_core.c | 8 ++--- drivers/hid/hid-picolcd_debugfs.c | 2 -- drivers/hid/hid-picolcd_fb.c | 7 ++-- drivers/hid/hid-picolcd_lcd.c | 4 +-- drivers/hid/hid-picolcd_leds.c | 4 +-- drivers/hid/hid-pl.c | 6 ++-- drivers/hid/hid-prodikeys.c | 3 +- drivers/hid/hid-sensor-hub.c | 7 ++-- drivers/hid/hid-sjoy.c | 6 ++-- drivers/hid/hid-steelseries.c | 3 +- drivers/hid/hid-tmff.c | 6 ++-- drivers/hid/hid-zpff.c | 6 ++-- drivers/hid/usbhid/hid-core.c | 3 +- drivers/hid/usbhid/hid-pidff.c | 64 ++++++++++++++++++------------------- drivers/hid/usbhid/hiddev.c | 4 +-- drivers/hid/usbhid/usbhid.h | 2 -- 34 files changed, 111 insertions(+), 157 deletions(-)
drivers/hid/Kconfig +15 -15
@@ -99,7 +99,7 @@ config HID_A4TECH config HID_ACRUX tristate "ACRUX game controller support" - depends on USB_HID + depends on HID ---help--- Say Y here if you want to enable support for ACRUX game controllers.
@@ -151,7 +151,7 @@ config HID_CHICONY config HID_PRODIKEYS tristate "Prodikeys PC-MIDI Keyboard support" - depends on USB_HID && SND + depends on HID && SND select SND_RAWMIDI ---help--- Support for Prodikeys PC-MIDI Keyboard device support.
@@ -173,7 +173,7 @@ config HID_CYPRESS config HID_DRAGONRISE tristate "DragonRise Inc. game controller" - depends on USB_HID + depends on HID ---help--- Say Y here if you have DragonRise Inc. game controllers. These might be branded as:
@@ -192,7 +192,7 @@ config DRAGONRISE_FF config HID_EMS_FF tristate "EMS Production Inc. force feedback support" - depends on USB_HID + depends on HID select INPUT_FF_MEMLESS ---help--- Say Y here if you want to enable force feedback support for devices by
@@ -215,7 +215,7 @@ config HID_EZKEY config HID_HOLTEK tristate "Holtek HID devices" - depends on USB_HID + depends on HID ---help--- Support for Holtek based devices: - Holtek On Line Grip based game controller
@@ -239,7 +239,7 @@ config HID_KEYTOUCH config HID_KYE tristate "KYE/Genius devices" - depends on USB_HID + depends on HID ---help--- Support for KYE/Genius devices not fully compliant with HID standard: - Ergo Mouse
@@ -397,7 +397,7 @@ config HID_MONTEREY config HID_MULTITOUCH tristate "HID Multitouch panels" - depends on USB_HID + depends on HID ---help--- Generic support for HID multitouch panels.
@@ -458,7 +458,7 @@ config HID_ORTEK config HID_PANTHERLORD tristate "Pantherlord/GreenAsia game controller" - depends on USB_HID + depends on HID ---help--- Say Y here if you have a PantherLord/GreenAsia based game controller or adapter.
@@ -592,13 +592,13 @@ config HID_SONY config HID_SPEEDLINK tristate "Speedlink VAD Cezanne mouse support" - depends on USB_HID + depends on HID ---help--- Support for Speedlink Vicious and Divine Cezanne mouse. config HID_STEELSERIES tristate "Steelseries SRW-S1 steering wheel support" - depends on USB_HID + depends on HID ---help--- Support for Steelseries SRW-S1 steering wheel
@@ -610,7 +610,7 @@ config HID_SUNPLUS config HID_GREENASIA tristate "GreenAsia (Product ID 0x12) game controller support" - depends on USB_HID + depends on HID ---help--- Say Y here if you have a GreenAsia (Product ID 0x12) based game controller or adapter.
@@ -632,7 +632,7 @@ config HID_HYPERV_MOUSE config HID_SMARTJOYPLUS tristate "SmartJoy PLUS PS2/USB adapter support" - depends on USB_HID + depends on HID ---help--- Support for SmartJoy PLUS PS2/USB adapter, Super Dual Box, Super Joy Box 3 Pro, Super Dual Box Pro, and Super Joy Box 5 Pro.
@@ -673,7 +673,7 @@ config HID_THINGM config HID_THRUSTMASTER tristate "ThrustMaster devices support" - depends on USB_HID + depends on HID ---help--- Say Y here if you have a THRUSTMASTER FireStore Dual Power 2 or a THRUSTMASTER Ferrari GT Rumble Wheel.
@@ -715,7 +715,7 @@ config HID_WIIMOTE_EXT config HID_ZEROPLUS tristate "Zeroplus based game controller support" - depends on USB_HID + depends on HID ---help--- Say Y here if you have a Zeroplus based game controller.
@@ -735,7 +735,7 @@ config HID_ZYDACRON config HID_SENSOR_HUB tristate "HID Sensors framework support" - depends on USB_HID && GENERIC_HARDIRQS + depends on HID && GENERIC_HARDIRQS select MFD_CORE default n -- help---
drivers/hid/hid-axff.c +2 -4
@@ -29,14 +29,12 @@#include <linux/input.h> #include <linux/slab.h> -#include <linux/usb.h> #include <linux/hid.h> #include <linux/module.h> #include "hid-ids.h" #ifdef CONFIG_HID_ACRUX_FF -#include "usbhid/usbhid.h" struct axff_device { struct hid_report *report;
@@ -68,7 +66,7 @@ static int axff_play(struct input_dev *dev, void *data, struct ff_effect *effect }dbg_hid ("running with 0x%02x 0x%02x" , left, right); -usbhid_submit_report (hid, axff->report,USB_DIR_OUT ); +hid_hw_request (hid, axff->report,HID_REQ_SET_REPORT );return 0 ; }
@@ -114,7 +112,7 @@ static int axff_init(struct hid_device *hid) goto err_free_mem; axff->report = report; -usbhid_submit_report (hid, axff->report,USB_DIR_OUT ); +hid_hw_request (hid, axff->report,HID_REQ_SET_REPORT );hid_info (hid,"Force Feedback for ACRUX game controllers by Sergei Kolzun <[email protected]>\n" );
drivers/hid/hid-dr.c +3 -5
@@ -29,14 +29,12 @@#include <linux/input.h> #include <linux/slab.h> -#include <linux/usb.h> #include <linux/hid.h> #include <linux/module.h> #include "hid-ids.h" #ifdef CONFIG_DRAGONRISE_FF -#include "usbhid/usbhid.h" struct drff_device { struct hid_report *report;
@@ -68,7 +66,7 @@ static int drff_play(struct input_dev *dev, void *data, drff->report->field[0 ]->value[1 ] =0x00 ; drff->report->field[0 ]->value[2 ] = weak; drff->report->field[0 ]->value[4 ] = strong; -usbhid_submit_report (hid, drff->report,USB_DIR_OUT ); +hid_hw_request (hid, drff->report,HID_REQ_SET_REPORT ); drff->report->field[0 ]->value[0 ] =0xfa ; drff->report->field[0 ]->value[1 ] =0xfe ;
@@ -80,7 +78,7 @@ static int drff_play(struct input_dev *dev, void *data, drff->report->field[0 ]->value[2 ] =0x00 ; drff->report->field[0 ]->value[4 ] =0x00 ;dbg_hid ("running with 0x%02x 0x%02x" , strong, weak); -usbhid_submit_report (hid, drff->report,USB_DIR_OUT ); +hid_hw_request (hid, drff->report,HID_REQ_SET_REPORT );return 0 ; }
@@ -132,7 +130,7 @@ static int drff_init(struct hid_device *hid) drff->report->field[0 ]->value[4 ] =0x00 ; drff->report->field[0 ]->value[5 ] =0x00 ; drff->report->field[0 ]->value[6 ] =0x00 ; -usbhid_submit_report (hid, drff->report,USB_DIR_OUT ); +hid_hw_request (hid, drff->report,HID_REQ_SET_REPORT );hid_info (hid,"Force Feedback for DragonRise Inc. " "game controllers by Richard Walmsley <[email protected]>\n" );
drivers/hid/hid-emsff.c +2 -4
@@ -23,11 +23,9 @@#include <linux/hid.h> #include <linux/input.h> -#include <linux/usb.h> #include <linux/module.h> #include "hid-ids.h" -#include "usbhid/usbhid.h" struct emsff_device {struct hid_report *report;
@@ -52,7 +50,7 @@ static int emsff_play(struct input_dev *dev, void *data, emsff->report->field[0 ]->value[2 ] = strong;dbg_hid ("running with 0x%02x 0x%02x\n" , strong, weak); -usbhid_submit_report (hid, emsff->report,USB_DIR_OUT ); +hid_hw_request (hid, emsff->report,HID_REQ_SET_REPORT );return 0 ; }
@@ -104,7 +102,7 @@ static int emsff_init(struct hid_device *hid) emsff->report->field[0 ]->value[4 ] =0x00 ; emsff->report->field[0 ]->value[5 ] =0x00 ; emsff->report->field[0 ]->value[6 ] =0x00 ; -usbhid_submit_report (hid, emsff->report,USB_DIR_OUT ); +hid_hw_request (hid, emsff->report,HID_REQ_SET_REPORT );hid_info (hid,"force feedback for EMS based devices by Ignaz Forster <[email protected]>\n" );
drivers/hid/hid-gaff.c +4 -6
@@ -29,13 +29,11 @@#include <linux/input.h> #include <linux/slab.h> -#include <linux/usb.h> #include <linux/hid.h> #include <linux/module.h> #include "hid-ids.h" #ifdef CONFIG_GREENASIA_FF -#include "usbhid/usbhid.h" struct gaff_device { struct hid_report *report;
@@ -63,14 +61,14 @@ static int hid_gaff_play(struct input_dev *dev, void *data, gaff->report->field[0 ]->value[4 ] = left; gaff->report->field[0 ]->value[5 ] =0 ;dbg_hid ("running with 0x%02x 0x%02x" , left, right); -usbhid_submit_report (hid, gaff->report,USB_DIR_OUT ); +hid_hw_request (hid, gaff->report,HID_REQ_SET_REPORT ); gaff->report->field[0 ]->value[0 ] =0xfa ; gaff->report->field[0 ]->value[1 ] =0xfe ; gaff->report->field[0 ]->value[2 ] =0x0 ; gaff->report->field[0 ]->value[4 ] =0x0 ; -usbhid_submit_report (hid, gaff->report,USB_DIR_OUT ); +hid_hw_request (hid, gaff->report,HID_REQ_SET_REPORT );return 0 ; }
@@ -122,12 +120,12 @@ static int gaff_init(struct hid_device *hid) gaff->report->field[0 ]->value[1 ] =0x00 ; gaff->report->field[0 ]->value[2 ] =0x00 ; gaff->report->field[0 ]->value[3 ] =0x00 ; -usbhid_submit_report (hid, gaff->report,USB_DIR_OUT ); +hid_hw_request (hid, gaff->report,HID_REQ_SET_REPORT ); gaff->report->field[0 ]->value[0 ] =0xfa ; gaff->report->field[0 ]->value[1 ] =0xfe ; -usbhid_submit_report (hid, gaff->report,USB_DIR_OUT ); +hid_hw_request (hid, gaff->report,HID_REQ_SET_REPORT );hid_info (hid,"Force Feedback for GreenAsia 0x12 devices by Lukasz Lubojanski <[email protected]>\n" );
drivers/hid/hid-holtekff.c +1 -3
@@ -27,12 +27,10 @@#include <linux/input.h> #include <linux/module.h> #include <linux/slab.h> -#include <linux/usb.h> #include "hid-ids.h" #ifdef CONFIG_HOLTEK_FF -#include "usbhid/usbhid.h" MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Anssi Hannula <[email protected]>" );
@@ -102,7 +100,7 @@ static void holtekff_send(struct holtekff_device *holtekff,dbg_hid ("sending %*ph\n" ,7 , data); -usbhid_submit_report (hid, holtekff->field->report,USB_DIR_OUT ); +hid_hw_request (hid, holtekff->field->report,HID_REQ_SET_REPORT ); } static int holtekff_play(struct input_dev *dev, void *data,
drivers/hid/hid-kye.c +1 -3
@@ -16,8 +16,6 @@#include <linux/device.h> #include <linux/hid.h> #include <linux/module.h> -#include <linux/usb.h> -#include "usbhid/usbhid.h" #include "hid-ids.h"
@@ -361,7 +359,7 @@ static int kye_tablet_enable(struct hid_device *hdev) value[4 ] =0x00 ; value[5 ] =0x00 ; value[6 ] =0x00 ; -usbhid_submit_report (hdev, report,USB_DIR_OUT ); +hid_hw_request (hdev, report,HID_REQ_SET_REPORT );return 0 ; }
drivers/hid/hid-lenovo-tpkbd.c +2 -2
@@ -68,7 +68,7 @@ static int tpkbd_features_set(struct hid_device *hdev) report->field[2 ]->value[0 ] = data_pointer->sensitivity; report->field[3 ]->value[0 ] = data_pointer->press_speed; -usbhid_submit_report (hdev, report,USB_DIR_OUT ); +hid_hw_request (hdev, report,HID_REQ_SET_REPORT );return 0 ; }
@@ -332,7 +332,7 @@ static void tpkbd_led_brightness_set(struct led_classdev *led_cdev, report = hdev->report_enum[HID_OUTPUT_REPORT ].report_id_hash[3 ]; report->field[0 ]->value[0 ] = (data_pointer->led_state >>0 ) &1 ; report->field[0 ]->value[1 ] = (data_pointer->led_state >>1 ) &1 ; -usbhid_submit_report (hdev, report,USB_DIR_OUT ); +hid_hw_request (hdev, report,HID_REQ_SET_REPORT ); }static int tpkbd_probe_tp (struct hid_device *hdev)
drivers/hid/hid-lg2ff.c +2 -4
@@ -23,10 +23,8 @@#include <linux/input.h> #include <linux/slab.h> -#include <linux/usb.h> #include <linux/hid.h> -#include "usbhid/usbhid.h" #include "hid-lg.h" struct lg2ff_device {
@@ -56,7 +54,7 @@ static int play_effect(struct input_dev *dev, void *data, lg2ff->report->field[0 ]->value[4 ] =0x00 ; } -usbhid_submit_report (hid, lg2ff->report,USB_DIR_OUT ); +hid_hw_request (hid, lg2ff->report,HID_REQ_SET_REPORT );return 0 ; }
@@ -108,7 +106,7 @@ int lg2ff_init(struct hid_device *hid) report->field[0 ]->value[5 ] =0x00 ; report->field[0 ]->value[6 ] =0x00 ; -usbhid_submit_report (hid, report,USB_DIR_OUT ); +hid_hw_request (hid, report,HID_REQ_SET_REPORT );hid_info (hid,"Force feedback for Logitech RumblePad/Rumblepad 2 by Anssi Hannula <[email protected]>\n" );
drivers/hid/hid-lg3ff.c +2 -4
@@ -22,10 +22,8 @@#include <linux/input.h> -#include <linux/usb.h> #include <linux/hid.h> -#include "usbhid/usbhid.h" #include "hid-lg.h" /*
@@ -92,7 +90,7 @@ static int hid_lg3ff_play(struct input_dev *dev, void *data, report->field[0 ]->value[1 ] = (unsigned char )(-x); report->field[0 ]->value[31 ] = (unsigned char )(-y); -usbhid_submit_report (hid, report,USB_DIR_OUT ); +hid_hw_request (hid, report,HID_REQ_SET_REPORT );break ; }return 0 ;
@@ -118,7 +116,7 @@ static void hid_lg3ff_set_autocenter(struct input_dev *dev, u16 magnitude) report->field[0 ]->value[33 ] =0x7F ; report->field[0 ]->value[34 ] =0x7F ; -usbhid_submit_report (hid, report,USB_DIR_OUT ); +hid_hw_request (hid, report,HID_REQ_SET_REPORT ); }
drivers/hid/hid-lg4ff.c +9 -9
@@ -202,7 +202,7 @@ static int hid_lg4ff_play(struct input_dev *dev, void *data, struct ff_effect *e value[5 ] =0x00 ; value[6 ] =0x00 ; -usbhid_submit_report (hid, report,USB_DIR_OUT ); +hid_hw_request (hid, report,HID_REQ_SET_REPORT );break ; }return 0 ;
@@ -225,7 +225,7 @@ static void hid_lg4ff_set_autocenter_default(struct input_dev *dev, u16 magnitud value[5 ] =0x00 ; value[6 ] =0x00 ; -usbhid_submit_report (hid, report,USB_DIR_OUT ); +hid_hw_request (hid, report,HID_REQ_SET_REPORT ); }/* Sends autocentering command compatible with Formula Force EX */
@@ -245,7 +245,7 @@ static void hid_lg4ff_set_autocenter_ffex(struct input_dev *dev, u16 magnitude) value[5 ] =0x00 ; value[6 ] =0x00 ; -usbhid_submit_report (hid, report,USB_DIR_OUT ); +hid_hw_request (hid, report,HID_REQ_SET_REPORT ); }/* Sends command to set range compatible with G25/G27/Driving Force GT */
@@ -265,7 +265,7 @@ static void hid_lg4ff_set_range_g25(struct hid_device *hid, u16 range) value[5 ] =0x00 ; value[6 ] =0x00 ; -usbhid_submit_report (hid, report,USB_DIR_OUT ); +hid_hw_request (hid, report,HID_REQ_SET_REPORT ); }/* Sends commands to set range compatible with Driving Force Pro wheel */
@@ -294,7 +294,7 @@ static void hid_lg4ff_set_range_dfp(struct hid_device *hid, __u16 range) report->field[0 ]->value[1 ] =0x02 ; full_range =200 ; } -usbhid_submit_report (hid, report,USB_DIR_OUT ); +hid_hw_request (hid, report,HID_REQ_SET_REPORT );/* Prepare "fine" limit command */ value[0 ] =0x81 ;
@@ -306,7 +306,7 @@ static void hid_lg4ff_set_range_dfp(struct hid_device *hid, __u16 range) value[6 ] =0x00 ;if (range ==200 || range ==900 ) {/* Do not apply any fine limit */ -usbhid_submit_report (hid, report,USB_DIR_OUT ); +hid_hw_request (hid, report,HID_REQ_SET_REPORT );return ; }
@@ -320,7 +320,7 @@ static void hid_lg4ff_set_range_dfp(struct hid_device *hid, __u16 range) value[5 ] = (start_right &0xe ) <<4 | (start_left &0xe ); value[6 ] =0xff ; -usbhid_submit_report (hid, report,USB_DIR_OUT ); +hid_hw_request (hid, report,HID_REQ_SET_REPORT ); }static void hid_lg4ff_switch_native (struct hid_device *hid,const struct lg4ff_native_cmd *cmd)
@@ -334,7 +334,7 @@ static void hid_lg4ff_switch_native(struct hid_device *hid, const struct lg4ff_nfor (i =0 ; i <7 ; i++) report->field[0 ]->value[i] = cmd->cmd[j++]; -usbhid_submit_report (hid, report,USB_DIR_OUT ); +hid_hw_request (hid, report,HID_REQ_SET_REPORT ); } }
@@ -410,7 +410,7 @@ static void lg4ff_set_leds(struct hid_device *hid, __u8 leds) value[4 ] =0x00 ; value[5 ] =0x00 ; value[6 ] =0x00 ; -usbhid_submit_report (hid, report,USB_DIR_OUT ); +hid_hw_request (hid, report,HID_REQ_SET_REPORT ); } static void lg4ff_led_set_brightness(struct led_classdev *led_cdev,
drivers/hid/hid-lgff.c +3 -5
@@ -30,10 +30,8 @@#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt#include <linux/input.h> -#include <linux/usb.h> #include <linux/hid.h> -#include "usbhid/usbhid.h" #include "hid-lg.h" struct dev_type {
@@ -89,7 +87,7 @@ static int hid_lgff_play(struct input_dev *dev, void *data, struct ff_effect *ef report->field[0 ]->value[2 ] = x; report->field[0 ]->value[3 ] = y;dbg_hid ("(x, y)=(%04x, %04x)\n" , x, y); -usbhid_submit_report (hid, report,USB_DIR_OUT ); +hid_hw_request (hid, report,HID_REQ_SET_REPORT );break ;case FF_RUMBLE :
@@ -104,7 +102,7 @@ static int hid_lgff_play(struct input_dev *dev, void *data, struct ff_effect *ef report->field[0 ]->value[2 ] = left; report->field[0 ]->value[3 ] = right;dbg_hid ("(left, right)=(%04x, %04x)\n" , left, right); -usbhid_submit_report (hid, report,USB_DIR_OUT ); +hid_hw_request (hid, report,HID_REQ_SET_REPORT );break ; }return 0 ;
@@ -124,7 +122,7 @@ static void hid_lgff_set_autocenter(struct input_dev *dev, u16 magnitude) *value++ =0x80 ; *value++ =0x00 ; *value =0x00 ; -usbhid_submit_report (hid, report,USB_DIR_OUT ); +hid_hw_request (hid, report,HID_REQ_SET_REPORT ); }int lgff_init (struct hid_device * hid)
drivers/hid/hid-logitech-dj.c +1 -2
@@ -27,7 +27,6 @@#include <linux/module.h> #include <linux/usb.h> #include <asm/unaligned.h> -#include "usbhid/usbhid.h" #include "hid-ids.h" #include "hid-logitech-dj.h"
@@ -638,7 +637,7 @@ static int logi_dj_ll_input_event(struct input_dev *dev, unsigned int type,hid_set_field (report->field[0 ],1 ,REPORT_TYPE_LEDS );hid_set_field (report->field[0 ],2 , data[1 ]); -usbhid_submit_report (dj_rcv_hiddev, report,USB_DIR_OUT ); +hid_hw_request (dj_rcv_hiddev, report,HID_REQ_SET_REPORT );return 0 ;
drivers/hid/hid-multitouch.c +2 -2
@@ -736,7 +736,7 @@ static void mt_set_input_mode(struct hid_device *hdev) r = re->report_id_hash[td->inputmode];if (r) { r->field[0 ]->value[td->inputmode_index] =0x02 ; -usbhid_submit_report (hdev, r,USB_DIR_OUT ); +hid_hw_request (hdev, r,HID_REQ_SET_REPORT ); } }
@@ -761,7 +761,7 @@ static void mt_set_maxcontacts(struct hid_device *hdev) max =min (fieldmax, max);if (r->field[0 ]->value[0 ] != max) { r->field[0 ]->value[0 ] = max; -usbhid_submit_report (hdev, r,USB_DIR_OUT ); +hid_hw_request (hdev, r,HID_REQ_SET_REPORT ); } } }
drivers/hid/hid-ntrig.c +3 -3
@@ -118,7 +118,7 @@ static inline int ntrig_get_mode(struct hid_device *hdev)if (!report)return -EINVAL ; -usbhid_submit_report (hdev, report,USB_DIR_IN ); +hid_hw_request (hdev, report,HID_REQ_GET_REPORT );usbhid_wait_io (hdev);return (int )report->field[0 ]->value[0 ]; }
@@ -137,7 +137,7 @@ static inline void ntrig_set_mode(struct hid_device *hdev, const int mode)if (!report)return ; -usbhid_submit_report (hdev, report,USB_DIR_IN ); +hid_hw_request (hdev, report,HID_REQ_GET_REPORT ); }static void ntrig_report_version (struct hid_device *hdev)
@@ -938,7 +938,7 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)/* Let the device settle to ensure the wakeup message gets * through */ usbhid_wait_io (hdev); -usbhid_submit_report (hdev, report,USB_DIR_IN ); +hid_hw_request (hdev, report,HID_REQ_GET_REPORT );/* * Sanity check: if the current mode is invalid reset it to
drivers/hid/hid-picolcd.h +2 -2
@@ -142,10 +142,10 @@ struct hid_report *picolcd_report(int id, struct hid_device *hdev, int dir);#ifdef CONFIG_DEBUG_FS void picolcd_debug_out_report (struct picolcd_data *data,struct hid_device *hdev,struct hid_report *report); -#define usbhid_submit_report (a, b, c) \ +#define hid_hw_request (a, b, c) \ do { \ picolcd_debug_out_report(hid_get_drvdata(a), a, b); \ - usbhid_submit_report(a, b, c); \ + hid_hw_request(a, b, c); \ } while (0) void picolcd_debug_raw_event(struct picolcd_data *data,
drivers/hid/hid-picolcd_backlight.c +1 -3
@@ -18,8 +18,6 @@***************************************************************************/ #include <linux/hid.h> -#include "usbhid/usbhid.h" -#include <linux/usb.h> #include <linux/fb.h> #include <linux/backlight.h>
@@ -46,7 +44,7 @@ static int picolcd_set_brightness(struct backlight_device *bdev)spin_lock_irqsave (&data->lock, flags);hid_set_field (report->field[0 ],0 , data->lcd_power ==FB_BLANK_UNBLANK ? data->lcd_brightness :0 );if (!(data->status &PICOLCD_FAILED )) -usbhid_submit_report (data->hdev, report,USB_DIR_OUT ); +hid_hw_request (data->hdev, report,HID_REQ_SET_REPORT );spin_unlock_irqrestore (&data->lock, flags);return 0 ; }
drivers/hid/hid-picolcd_cir.c +0 -2
@@ -21,8 +21,6 @@#include <linux/hid-debug.h> #include <linux/input.h> #include "hid-ids.h" -#include "usbhid/usbhid.h" -#include <linux/usb.h> #include <linux/fb.h> #include <linux/vmalloc.h>
drivers/hid/hid-picolcd_core.c +3 -5
@@ -21,8 +21,6 @@#include <linux/hid-debug.h> #include <linux/input.h> #include "hid-ids.h" -#include "usbhid/usbhid.h" -#include <linux/usb.h> #include <linux/fb.h> #include <linux/vmalloc.h>
@@ -110,7 +108,7 @@ struct picolcd_pending *picolcd_send_and_wait(struct hid_device *hdev, work =NULL ; }else { data->pending = work; -usbhid_submit_report (data->hdev, report,USB_DIR_OUT ); +hid_hw_request (data->hdev, report,HID_REQ_SET_REPORT );spin_unlock_irqrestore (&data->lock, flags);wait_for_completion_interruptible_timeout (&work->ready,HZ *2 );spin_lock_irqsave (&data->lock, flags);
@@ -244,7 +242,7 @@ int picolcd_reset(struct hid_device *hdev)spin_unlock_irqrestore (&data->lock, flags);return -ENODEV ; } -usbhid_submit_report (hdev, report,USB_DIR_OUT ); +hid_hw_request (hdev, report,HID_REQ_SET_REPORT );spin_unlock_irqrestore (&data->lock, flags); error =picolcd_check_version (hdev);
@@ -303,7 +301,7 @@ static ssize_t picolcd_operation_mode_store(struct device *dev,spin_lock_irqsave (&data->lock, flags);hid_set_field (report->field[0 ],0 , timeout &0xff );hid_set_field (report->field[0 ],1 , (timeout >>8 ) &0xff ); -usbhid_submit_report (data->hdev, report,USB_DIR_OUT ); +hid_hw_request (data->hdev, report,HID_REQ_SET_REPORT );spin_unlock_irqrestore (&data->lock, flags);return count; }
drivers/hid/hid-picolcd_debugfs.c +0 -2
@@ -19,8 +19,6 @@#include <linux/hid.h> #include <linux/hid-debug.h> -#include "usbhid/usbhid.h" -#include <linux/usb.h> #include <linux/fb.h> #include <linux/seq_file.h>
drivers/hid/hid-picolcd_fb.c +3 -4
@@ -20,7 +20,6 @@#include <linux/hid.h> #include <linux/vmalloc.h> #include "usbhid/usbhid.h" -#include <linux/usb.h> #include <linux/fb.h> #include <linux/module.h>
@@ -143,8 +142,8 @@ static int picolcd_fb_send_tile(struct picolcd_data *data, u8 *vbitmap,else hid_set_field (report2->field[0 ],4 + i -32 , tdata[i]); -usbhid_submit_report (data->hdev, report1,USB_DIR_OUT ); -usbhid_submit_report (data->hdev, report2,USB_DIR_OUT ); +hid_hw_request (data->hdev, report1,HID_REQ_SET_REPORT ); +hid_hw_request (data->hdev, report2,HID_REQ_SET_REPORT );spin_unlock_irqrestore (&data->lock, flags);return 0 ; }
@@ -214,7 +213,7 @@ int picolcd_fb_reset(struct picolcd_data *data, int clear)hid_set_field (report->field[0 ], j, mapcmd[j]); else hid_set_field(report->field[0], j, 0); -usbhid_submit_report (data->hdev, report,USB_DIR_OUT ); +hid_hw_request (data->hdev, report,HID_REQ_SET_REPORT ); }spin_unlock_irqrestore (&data->lock, flags);
drivers/hid/hid-picolcd_lcd.c +1 -3
@@ -18,8 +18,6 @@***************************************************************************/ #include <linux/hid.h> -#include "usbhid/usbhid.h" -#include <linux/usb.h> #include <linux/fb.h> #include <linux/lcd.h>
@@ -48,7 +46,7 @@ static int picolcd_set_contrast(struct lcd_device *ldev, int contrast)spin_lock_irqsave (&data->lock, flags);hid_set_field (report->field[0 ],0 , data->lcd_contrast);if (!(data->status &PICOLCD_FAILED )) -usbhid_submit_report (data->hdev, report,USB_DIR_OUT ); +hid_hw_request (data->hdev, report,HID_REQ_SET_REPORT );spin_unlock_irqrestore (&data->lock, flags);return 0 ; }
drivers/hid/hid-picolcd_leds.c +1 -3
@@ -21,8 +21,6 @@#include <linux/hid-debug.h> #include <linux/input.h> #include "hid-ids.h" -#include "usbhid/usbhid.h" -#include <linux/usb.h> #include <linux/fb.h> #include <linux/vmalloc.h>
@@ -55,7 +53,7 @@ void picolcd_leds_set(struct picolcd_data *data)spin_lock_irqsave (&data->lock, flags);hid_set_field (report->field[0 ],0 , data->led_state);if (!(data->status &PICOLCD_FAILED )) -usbhid_submit_report (data->hdev, report,USB_DIR_OUT ); +hid_hw_request (data->hdev, report,HID_REQ_SET_REPORT );spin_unlock_irqrestore (&data->lock, flags); }
drivers/hid/hid-pl.c +2 -4
@@ -43,13 +43,11 @@#include <linux/input.h> #include <linux/slab.h> #include <linux/module.h> -#include <linux/usb.h> #include <linux/hid.h> #include "hid-ids.h" #ifdef CONFIG_PANTHERLORD_FF -#include "usbhid/usbhid.h" struct plff_device { struct hid_report *report;
@@ -75,7 +73,7 @@ static int hid_plff_play(struct input_dev *dev, void *data, *plff->strong = left; *plff->weak = right;debug ("running with 0x%02x 0x%02x" , left, right); -usbhid_submit_report (hid, plff->report,USB_DIR_OUT ); +hid_hw_request (hid, plff->report,HID_REQ_SET_REPORT );return 0 ; }
@@ -169,7 +167,7 @@ static int plff_init(struct hid_device *hid) *strong =0x00 ; *weak =0x00 ; -usbhid_submit_report (hid, plff->report,USB_DIR_OUT ); +hid_hw_request (hid, plff->report,HID_REQ_SET_REPORT ); }hid_info (hid,"Force feedback for PantherLord/GreenAsia devices by Anssi Hannula <[email protected]>\n" );
drivers/hid/hid-prodikeys.c +1 -2
@@ -26,7 +26,6 @@#include <sound/core.h> #include <sound/initval.h> #include <sound/rawmidi.h> -#include "usbhid/usbhid.h" #include "hid-ids.h"
@@ -306,7 +305,7 @@ static void pcmidi_submit_output_report(struct pcmidi_snd *pm, int state) report->field[0 ]->value[0 ] =0x01 ; report->field[0 ]->value[1 ] = state; -usbhid_submit_report (hdev, report,USB_DIR_OUT ); +hid_hw_request (hdev, report,HID_REQ_SET_REPORT ); }static int pcmidi_handle_report1 (struct pcmidi_snd *pm,u8 *data)
drivers/hid/hid-sensor-hub.c +3 -4
@@ -18,7 +18,6 @@*/ #include <linux/device.h> #include <linux/hid.h> -#include <linux/usb.h> #include "usbhid/usbhid.h" #include <linux/module.h> #include <linux/slab.h>
@@ -204,7 +203,7 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, goto done_proc; }hid_set_field (report->field[field_index],0 , value); -usbhid_submit_report (hsdev->hdev, report,USB_DIR_OUT ); +hid_hw_request (hsdev->hdev, report,HID_REQ_SET_REPORT );usbhid_wait_io (hsdev->hdev); done_proc:
@@ -227,7 +226,7 @@ int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, ret = -EINVAL ; goto done_proc; } -usbhid_submit_report (hsdev->hdev, report,USB_DIR_IN ); +hid_hw_request (hsdev->hdev, report,HID_REQ_GET_REPORT );usbhid_wait_io (hsdev->hdev); *value = report->field[field_index]->value[0 ];
@@ -262,7 +261,7 @@ int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev,spin_unlock_irqrestore (&data->lock, flags); goto err_free; } -usbhid_submit_report (hsdev->hdev, report,USB_DIR_IN ); +hid_hw_request (hsdev->hdev, report,HID_REQ_GET_REPORT );spin_unlock_irqrestore (&data->lock, flags);wait_for_completion_interruptible_timeout (&data->pending.ready,HZ *5 );switch (data->pending.raw_size) {
drivers/hid/hid-sjoy.c +2 -4
@@ -28,13 +28,11 @@#include <linux/input.h> #include <linux/slab.h> -#include <linux/usb.h> #include <linux/hid.h> #include <linux/module.h> #include "hid-ids.h" #ifdef CONFIG_SMARTJOYPLUS_FF -#include "usbhid/usbhid.h" struct sjoyff_device { struct hid_report *report;
@@ -57,7 +55,7 @@ static int hid_sjoyff_play(struct input_dev *dev, void *data, sjoyff->report->field[0 ]->value[1 ] = right; sjoyff->report->field[0 ]->value[2 ] = left;dev_dbg (&dev->dev,"running with 0x%02x 0x%02x\n" , left, right); -usbhid_submit_report (hid, sjoyff->report,USB_DIR_OUT ); +hid_hw_request (hid, sjoyff->report,HID_REQ_SET_REPORT );return 0 ; }
@@ -115,7 +113,7 @@ static int sjoyff_init(struct hid_device *hid) sjoyff->report->field[0 ]->value[0 ] =0x01 ; sjoyff->report->field[0 ]->value[1 ] =0x00 ; sjoyff->report->field[0 ]->value[2 ] =0x00 ; -usbhid_submit_report (hid, sjoyff->report,USB_DIR_OUT ); +hid_hw_request (hid, sjoyff->report,HID_REQ_SET_REPORT ); }hid_info (hid,"Force feedback for SmartJoy PLUS PS2/USB adapter\n" );
drivers/hid/hid-steelseries.c +1 -2
@@ -16,7 +16,6 @@#include <linux/hid.h> #include <linux/module.h> -#include "usbhid/usbhid.h" #include "hid-ids.h" #if defined(CONFIG_LEDS_CLASS ) || defined(CONFIG_LEDS_CLASS_MODULE )
@@ -132,7 +131,7 @@ static void steelseries_srws1_set_leds(struct hid_device *hdev, __u16 leds) value[14 ] =0x00 ; value[15 ] =0x00 ; -usbhid_submit_report (hdev, report,USB_DIR_OUT ); +hid_hw_request (hdev, report,HID_REQ_SET_REPORT );/* Note: LED change does not show on device until the device is read/polled */ }
drivers/hid/hid-tmff.c +2 -4
@@ -30,7 +30,6 @@#include <linux/hid.h> #include <linux/input.h> #include <linux/slab.h> -#include <linux/usb.h> #include <linux/module.h> #include "hid-ids.h"
@@ -46,7 +45,6 @@ static const signed short ff_joystick[] = { };#ifdef CONFIG_THRUSTMASTER_FF -#include "usbhid/usbhid.h" /* Usages for thrustmaster devices I know about */ #define THRUSTMASTER_USAGE_FF (HID_UP_GENDESK | 0xbb)
@@ -103,7 +101,7 @@ static int tmff_play(struct input_dev *dev, void *data,dbg_hid ("(x, y)=(%04x, %04x)\n" , x, y); ff_field->value[0 ] = x; ff_field->value[1 ] = y; -usbhid_submit_report (hid, tmff->report,USB_DIR_OUT ); +hid_hw_request (hid, tmff->report,HID_REQ_SET_REPORT );break ;case FF_RUMBLE :
@@ -117,7 +115,7 @@ static int tmff_play(struct input_dev *dev, void *data,dbg_hid ("(left,right)=(%08x, %08x)\n" , left, right); ff_field->value[0 ] = left; ff_field->value[1 ] = right; -usbhid_submit_report (hid, tmff->report,USB_DIR_OUT ); +hid_hw_request (hid, tmff->report,HID_REQ_SET_REPORT );break ; }return 0 ;
drivers/hid/hid-zpff.c +2 -4
@@ -24,13 +24,11 @@#include <linux/hid.h> #include <linux/input.h> #include <linux/slab.h> -#include <linux/usb.h> #include <linux/module.h> #include "hid-ids.h" #ifdef CONFIG_ZEROPLUS_FF -#include "usbhid/usbhid.h" struct zpff_device { struct hid_report *report;
@@ -59,7 +57,7 @@ static int zpff_play(struct input_dev *dev, void *data, zpff->report->field[2 ]->value[0 ] = left; zpff->report->field[3 ]->value[0 ] = right;dbg_hid ("running with 0x%02x 0x%02x\n" , left, right); -usbhid_submit_report (hid, zpff->report,USB_DIR_OUT ); +hid_hw_request (hid, zpff->report,HID_REQ_SET_REPORT );return 0 ; }
@@ -104,7 +102,7 @@ static int zpff_init(struct hid_device *hid) zpff->report->field[1 ]->value[0 ] =0x02 ; zpff->report->field[2 ]->value[0 ] =0x00 ; zpff->report->field[3 ]->value[0 ] =0x00 ; -usbhid_submit_report (hid, zpff->report,USB_DIR_OUT ); +hid_hw_request (hid, zpff->report,HID_REQ_SET_REPORT );hid_info (hid,"force feedback for Zeroplus based devices by Anssi Hannula <[email protected]>\n" );
drivers/hid/usbhid/hid-core.c +1 -2
@@ -639,7 +639,7 @@ static void __usbhid_submit_report(struct hid_device *hid, struct hid_report *re } } -void usbhid_submit_report (struct hid_device *hid,struct hid_report *report,unsigned char dir) +static void usbhid_submit_report (struct hid_device *hid,struct hid_report *report,unsigned char dir) {struct usbhid_device *usbhid = hid->driver_data;unsigned long flags;
@@ -648,7 +648,6 @@ void usbhid_submit_report(struct hid_device *hid, struct hid_report *report, uns__usbhid_submit_report (hid, report, dir);spin_unlock_irqrestore (&usbhid->lock, flags); } -EXPORT_SYMBOL_GPL (usbhid_submit_report);/* Workqueue routine to send requests to change LEDs */ static void hid_led (struct work_struct *work)
drivers/hid/usbhid/hid-pidff.c +32 -32
162 lines not on this page · raw message
drivers/hid/usbhid/hiddev.c +2 -2
@@ -705,7 +705,7 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)if (report ==NULL )break ; -usbhid_submit_report (hid, report,USB_DIR_IN ); +hid_hw_request (hid, report,HID_REQ_GET_REPORT );usbhid_wait_io (hid); r =0 ;
@@ -724,7 +724,7 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)if (report ==NULL )break ; -usbhid_submit_report (hid, report,USB_DIR_OUT ); +hid_hw_request (hid, report,HID_REQ_SET_REPORT );usbhid_wait_io (hid); r =0 ;
drivers/hid/usbhid/usbhid.h +0 -2
@@ -38,8 +38,6 @@ int usbhid_wait_io(struct hid_device* hid);void usbhid_close (struct hid_device *hid);int usbhid_open (struct hid_device *hid);void usbhid_init_reports (struct hid_device *hid); -void usbhid_submit_report -(struct hid_device *hid,struct hid_report *report,unsigned char dir);int usbhid_get_power (struct hid_device *hid);void usbhid_put_power (struct hid_device *hid);struct usb_interface *usbhid_find_interface (int minor);
Signature · 1 line
1.8.1.2
PATCH v2 5/8 HID: use hid_hw_wait() instead of direct call to usbhid
In reply to Benjamin TissoiresThis removes most of the dependencies between hid drivers and usbhid.
The patch was constructed by replacing all occurences of usbhid_wait_io() by its hid_hw_wait() counterpart. Then, drivers not requiring USB_HID anymore have their USB_HID dependency cleaned in the Kconfig file.
As of today, few drivers are still requiring an explicit USB layer dependency:
* ntrig (a patch is on its way)
* multitouch (one patch following and another on its way)
* lenovo tpkbd
* roccat
* sony
The last three are two deeply using direct calls to the usb subsystem to be able to be cleaned right now.
--- drivers/hid/Kconfig | 2 +- drivers/hid/hid-ntrig.c | 4 ++-- drivers/hid/hid-picolcd_fb.c | 5 ++--- drivers/hid/hid-sensor-hub.c | 5 ++--- drivers/hid/usbhid/hid-core.c | 3 +-- drivers/hid/usbhid/hid-pidff.c | 16 ++++++++-------- drivers/hid/usbhid/hiddev.c | 4 ++-- drivers/hid/usbhid/usbhid.h | 1 - 8 files changed, 18 insertions(+), 22 deletions(-)
drivers/hid/Kconfig +1 -1
@@ -479,7 +479,7 @@ config HID_PETALYNX config HID_PICOLCD tristate "PicoLCD (graphic version)" - depends on USB_HID + depends on HID ---help--- This provides support for Minibox PicoLCD devices, currently only the graphical ones are supported.
drivers/hid/hid-ntrig.c +2 -2
@@ -119,7 +119,7 @@ static inline int ntrig_get_mode(struct hid_device *hdev)return -EINVAL ;hid_hw_request (hdev, report,HID_REQ_GET_REPORT ); -usbhid_wait_io (hdev); +hid_hw_wait (hdev);return (int )report->field[0 ]->value[0 ]; }
@@ -937,7 +937,7 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)if (report) {/* Let the device settle to ensure the wakeup message gets * through */ -usbhid_wait_io (hdev); +hid_hw_wait (hdev);hid_hw_request (hdev, report,HID_REQ_GET_REPORT );/*
drivers/hid/hid-picolcd_fb.c +2 -3
@@ -19,7 +19,6 @@#include <linux/hid.h> #include <linux/vmalloc.h> -#include "usbhid/usbhid.h" #include <linux/fb.h> #include <linux/module.h>
@@ -269,7 +268,7 @@ static void picolcd_fb_update(struct fb_info *info)mutex_unlock (&info->lock);if (!data)return ; -usbhid_wait_io (data->hdev); +hid_hw_wait (data->hdev);mutex_lock (&info->lock); n =0 ; }
@@ -287,7 +286,7 @@ static void picolcd_fb_update(struct fb_info *info)spin_unlock_irqrestore (&fbdata->lock, flags);mutex_unlock (&info->lock);if (data) -usbhid_wait_io (data->hdev); +hid_hw_wait (data->hdev);return ; } out:
drivers/hid/hid-sensor-hub.c +2 -3
@@ -18,7 +18,6 @@*/ #include <linux/device.h> #include <linux/hid.h> -#include "usbhid/usbhid.h" #include <linux/module.h> #include <linux/slab.h> #include <linux/mfd/core.h>
@@ -204,7 +203,7 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, }hid_set_field (report->field[field_index],0 , value);hid_hw_request (hsdev->hdev, report,HID_REQ_SET_REPORT ); -usbhid_wait_io (hsdev->hdev); +hid_hw_wait (hsdev->hdev); done_proc:mutex_unlock (&data->mutex);
@@ -227,7 +226,7 @@ int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, goto done_proc; }hid_hw_request (hsdev->hdev, report,HID_REQ_GET_REPORT ); -usbhid_wait_io (hsdev->hdev); +hid_hw_wait (hsdev->hdev); *value = report->field[field_index]->value[0 ]; done_proc:
drivers/hid/usbhid/hid-core.c +1 -2
@@ -705,7 +705,7 @@ static int usb_hidinput_input_event(struct input_dev *dev, unsigned int type, unreturn 0 ; } -int usbhid_wait_io (struct hid_device *hid) +static int usbhid_wait_io (struct hid_device *hid) {struct usbhid_device *usbhid = hid->driver_data;
@@ -719,7 +719,6 @@ int usbhid_wait_io(struct hid_device *hid)return 0 ; } -EXPORT_SYMBOL_GPL (usbhid_wait_io);static int hid_set_idle (struct usb_device *dev,int ifnum,int report,int idle) {
drivers/hid/usbhid/hid-pidff.c +8 -8
@@ -471,13 +471,13 @@ static int pidff_request_effect_upload(struct pidff_device *pidff, int efnum) pidff->block_load[PID_EFFECT_BLOCK_INDEX ].value[0 ] =0 ; pidff->block_load_status->value[0 ] =0 ; -usbhid_wait_io (pidff->hid); +hid_hw_wait (pidff->hid);for (j =0 ; j <60 ; j++) {hid_dbg (pidff->hid,"pid_block_load requested\n" );hid_hw_request (pidff->hid, pidff->reports[PID_BLOCK_LOAD ],HID_REQ_GET_REPORT ); -usbhid_wait_io (pidff->hid); +hid_hw_wait (pidff->hid);if (pidff->block_load_status->value[0 ] == pidff->status_id[PID_BLOCK_LOAD_SUCCESS ]) { hid_dbg(pidff->hid, "device reported free memory: %d bytes\n",
@@ -551,7 +551,7 @@ static int pidff_erase_effect(struct input_dev *dev, int effect_id) effect_id, pidff->pid_id[effect_id]);/* Wait for the queue to clear. We do not want a full fifo to prevent the effect removal. */ -usbhid_wait_io (pidff->hid); +hid_hw_wait (pidff->hid);pidff_playback_pid (pidff, pid_id,0 );pidff_erase_pid (pidff, pid_id);
@@ -1159,18 +1159,18 @@ static void pidff_reset(struct pidff_device *pidff) pidff->device_control->value[0 ] = pidff->control_id[PID_RESET ];/* We reset twice as sometimes hid_wait_io isn't waiting long enough */ hid_hw_request (hid, pidff->reports[PID_DEVICE_CONTROL ],HID_REQ_SET_REPORT ); -usbhid_wait_io (hid); +hid_hw_wait (hid);hid_hw_request (hid, pidff->reports[PID_DEVICE_CONTROL ],HID_REQ_SET_REPORT ); -usbhid_wait_io (hid); +hid_hw_wait (hid); pidff->device_control->value[0 ] = pidff->control_id[PID_ENABLE_ACTUATORS ];hid_hw_request (hid, pidff->reports[PID_DEVICE_CONTROL ],HID_REQ_SET_REPORT ); -usbhid_wait_io (hid); +hid_hw_wait (hid);/* pool report is sometimes messed up, refetch it */ hid_hw_request (hid, pidff->reports[PID_POOL ],HID_REQ_GET_REPORT ); -usbhid_wait_io (hid); +hid_hw_wait (hid);if (pidff->pool[PID_SIMULTANEOUS_MAX ].value) {while (pidff->pool[PID_SIMULTANEOUS_MAX ].value[0 ] <2 ) {
@@ -1183,7 +1183,7 @@ static void pidff_reset(struct pidff_device *pidff)hid_dbg (pidff->hid,"pid_pool requested again\n" );hid_hw_request (hid, pidff->reports[PID_POOL ],HID_REQ_GET_REPORT ); -usbhid_wait_io (hid); +hid_hw_wait (hid); } } }
drivers/hid/usbhid/hiddev.c +2 -2
@@ -706,7 +706,7 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)break ;hid_hw_request (hid, report,HID_REQ_GET_REPORT ); -usbhid_wait_io (hid); +hid_hw_wait (hid); r =0 ;break ;
@@ -725,7 +725,7 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)break ;hid_hw_request (hid, report,HID_REQ_SET_REPORT ); -usbhid_wait_io (hid); +hid_hw_wait (hid); r =0 ;break ;
drivers/hid/usbhid/usbhid.h +0 -1
@@ -34,7 +34,6 @@#include <linux/input.h> /* API provided by hid-core.c for USB HID drivers */ -int usbhid_wait_io (struct hid_device * hid);void usbhid_close (struct hid_device *hid);int usbhid_open (struct hid_device *hid);void usbhid_init_reports (struct hid_device *hid);
Signature · 1 line
1.8.1.2
PATCH v2 6/8 HID: multitouch: remove explicit usbhid dependency
In reply to Benjamin TissoiresThis patch is part of the cleanup of the HID drivers against their low-level transport layer.
With new touchscreens relying on I2C, it's better to handle now these dependencies before users get kernel oopses.
--- drivers/hid/hid-multitouch.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/hid/hid-multitouch.c +1 -2
@@ -32,7 +32,6 @@#include <linux/slab.h> #include <linux/usb.h> #include <linux/input/mt.h> -#include "usbhid/usbhid.h" MODULE_AUTHOR ("Stephane Chatty <[email protected]>" );
@@ -907,7 +906,7 @@ static int mt_resume(struct hid_device *hdev) intf =to_usb_interface (hdev->dev.parent); interface = intf->cur_altsetting; - dev =hid_to_usb_dev (hdev); + dev =interface_to_usbdev (intf);/* Some Elan legacy devices require SET_IDLE to be set on resume. * It should be safe to send it to other devices too.
Signature · 1 line
1.8.1.2
PATCH v2 7/8 HID: multitouch: Copyright and note on regression tests
In reply to Benjamin TissoiresThis reflects my new company and officialize the regression tests I'm conducting between each change.
--- drivers/hid/hid-multitouch.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/hid/hid-multitouch.c +13 -1
@@ -2,8 +2,9 @@* HID driver for multitouch panels * * Copyright (c) 2010-2012 Stephane Chatty <[email protected]> -* Copyright (c) 2010-2012 Benjamin Tissoires <[email protected]> +* Copyright (c) 2010-2013 Benjamin Tissoires <[email protected]> * Copyright (c) 2010-2012 Ecole Nationale de l'Aviation Civile, France +* Copyright (c) 2012-2013 Red Hat, Inc * * This code is partly based on hid-egalax.c: *
@@ -26,6 +27,17 @@* any later version. */ +/* +* This driver is regularly tested thanks to the tool hid-test[1]. +* This tool relies on hid-replay[2] and a database of hid devices[3]. +* Please run these regression tests before patching this module so that +* your patch won't break existing known devices. +* +* [1] https://github.com/bentiss/hid-test +* [2] https://github.com/bentiss/hid-replay +* [3] https://github.com/bentiss/hid-devices +*/ +#include <linux/device.h> #include <linux/hid.h> #include <linux/module.h>
Signature · 1 line
1.8.1.2
PATCH v2 8/8 HID: i2c-hid: implement request() callback
In reply to Benjamin TissoiresThis allows HID drivers to also get/set reports through hid_hw_request().
--- drivers/hid/i2c-hid/i2c-hid.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
drivers/hid/i2c-hid/i2c-hid.c +32 -0
@@ -563,6 +563,37 @@ static int i2c_hid_output_raw_report(struct hid_device *hid, __u8 *buf,return ret; } +static void i2c_hid_request (struct hid_device *hid,struct hid_report *rep, +int reqtype) +{ +struct i2c_client *client = hid->driver_data; +struct i2c_hid *ihid =i2c_get_clientdata (client); +char *buf; +int ret; + + buf =kzalloc (ihid->bufsize,GFP_KERNEL ); +if (!buf) +return ; + +switch (reqtype) { +case HID_REQ_GET_REPORT : + ret =i2c_hid_get_raw_report (hid, rep->id, buf, ihid->bufsize, + rep->type); +if (ret <0 ) +dev_err (&client->dev,"%s: unable to get report: %d\n" , + __func__, ret); +else +hid_input_report (hid, rep->type, buf, ret,0 ); +break ; +case HID_REQ_SET_REPORT : +hid_output_report (rep, buf); +i2c_hid_output_raw_report (hid, buf, ihid->bufsize, rep->type); +break ; + } + +kfree (buf); +} +static int i2c_hid_parse (struct hid_device *hid) {struct i2c_client *client = hid->driver_data;
@@ -742,6 +773,7 @@ static struct hid_ll_driver i2c_hid_ll_driver = { .open = i2c_hid_open, .close = i2c_hid_close, .power = i2c_hid_power, + .request = i2c_hid_request, .hidinput_input_event = i2c_hid_hidinput_input_event, };
Signature · 1 line
1.8.1.2
Quoted 4 lines · Benjamin Tissoires
Hi guys,
this is the v2 of the hid transport cleanup.
Quoted 8 lines
Changes since v1:
- gathered reviewed/acked/etc..
- changed commit messages of patches 4-6
- add newcomer into account (thingm)
- incorporated the i2c-hid driver change into the seriesI still did not implemented the final usb cleanup for hid-multitouch as it may required few comments.
I have now taken the series. Thanks Benjamin, thanks Henrik.
Signature · 2 lines
Jiri Kosina SUSE Labs
Hi guys
Quoted 12 lines · Jiri Kosina
Quoted 10 lines · Benjamin Tissoires
Hi guys,
this is the v2 of the hid transport cleanup.
Changes since v1:
- gathered reviewed/acked/etc..
- changed commit messages of patches 4-6
- add newcomer into account (thingm)
- incorporated the i2c-hid driver change into the series
Quoted 4 lines
Quoted 2 lines
I still did not implemented the final usb cleanup for hid-multitouch as it may required few comments.
I have now taken the series. Thanks Benjamin, thanks Henrik.
I rewrote the Bluetooth HID session-management last week (patches pending on linux-bluetooth@vger) as it was horribly broken. This week I will try to fix the get_report/set_report mess with Bluetooth-HID, so I was wondering whether you could clear some things up.
(I did read the Bluetooth HID Profile specification but I have no idea how USB does it, so please bear with me if I mix things up. Maybe some day I will have the time to read the USB specs, too)
* There are several drivers using "dev->hid_get_raw_report()" and "dev->hid_output_raw_report()". Any objections to moving these to "hid_ll_driver" and adding wrapper functions hid_hw_get/output_raw_report()?
* What should the ll->report() callback exactly do? Should it simply send a GET_REPORT or SET_REPORT request depending on the direction (nonblocking)?
* Why don't we do the hid_output_report() call in the hid_hw_report() helper and pass the raw buffers down? It would allow GFP_KERNEL and avoid duplicating code in all four backends.
* What should ll->wait() exactly do? Block until the last SET/GET_REPORT call has been ack'ed by the device?
* Bluetooth-HID might return errors on GET/SET_REPORT. Why don't we return these in hid_hw_wait() for the last report? It would allow synchronous calls like:hid_hw_report();
ret = hid_hw_wait();
* Should hid_hw_report() allow multiple pending requests? Or should it return an error if there is another pending report that hasn't been ack'ed, yet?
I will try to implement it for Bluetooth-HID and UHID if no-one else wants to do it. Doing it for UHID would make debugging/emulating devices a lot easier.
Thanks
David
Hi David,
Quoted 18 lines · David Herrmann
Hi guys
Quoted 15 lines · Jiri Kosina
Quoted 12 lines · Benjamin Tissoires
Hi guys,
this is the v2 of the hid transport cleanup.
Changes since v1:
- gathered reviewed/acked/etc..
- changed commit messages of patches 4-6
- add newcomer into account (thingm)
- incorporated the i2c-hid driver change into the seriesI still did not implemented the final usb cleanup for hid-multitouch as it may required few comments.
Quoted 6 lines
Quoted 1 line
I have now taken the series. Thanks Benjamin, thanks Henrik.
I rewrote the Bluetooth HID session-management last week (patches pending on linux-bluetooth@vger) as it was horribly broken. This week I will try to fix the get_report/set_report mess with Bluetooth-HID, so I was wondering whether you could clear some things up.
Sure, I'll do my best. I'm not sure that you will have a better idea after my answers because the use cases are very different and there is not a good rational for each use.
Quoted 9 lines
(I did read the Bluetooth HID Profile specification but I have no idea how USB does it, so please bear with me if I mix things up. Maybe some day I will have the time to read the USB specs, too)
* There are several drivers using "
dev->hid_get_raw_report()" and "dev->hid_output_raw_report()". Any objections to moving these to "hid_ll_driver" and adding wrapper functions hid_hw_get/output_raw_report()?
I can't see any. Those two callbacks are transport dependent, so I also think it makes sense to put them into hid_ll_driver.
I also wish we have the set/get hid idle callback (it would remove the last usb dependency in hid-multitouch).
Quoted 4 lines
* What should the
ll->report()callback exactly do? Should it simply send aGET_REPORTorSET_REPORTrequest depending on the direction (nonblocking)?
Well, given the way it's used in hid drivers and usbhid/i2c-hid:
- SET_REPORT takes an already parsed report and send it to the device -> the usbhid part is nonblocking, i2c-hid is blocking.
- GET_REPORT asks for the HID command GET_REPORT and once it's done, the incoming report is parsed as if it was spontaneously generated (meaning that there are no guarantees that the report the caller reads after report() is the requested one).
The patch for implementing those functions in i2c-hid is IMHO simpler to understand than the usb one as i2c-hid makes no use of dma or async calls.
For the nonblocking part, the usb pendant is asynchronous, thus the need of the .wait().
The i2c-hid driver is synchronous, meaning that the call is blocking (sorry). But .wait() is not required to be called, and then, we don't need to set it.
Quoted 4 lines
* Why don't we do the
hid_output_report()call in thehid_hw_report()helper and pass the raw buffers down? It would allowGFP_KERNELand avoid duplicating code in all four backends.
Well. I continued Henrik's work on that, and the idea was to not break any existing device. So, the code path should be the nearest possible to the existing one. Now that this part is done, we can look at something more efficient in terms of duplication.
Actually, the implementation of i2c-hid .request() already uses the raw buffers commands, meaning that it's nearly what we need (except that we need to get the size of the buffer in some other way).
However, in usbhid and i2c-hid, .hid_get_raw_report() and .hid_output_raw_report() are blocking, meaning that it will change the current behavior for drivers.
Quoted 4 lines
* What should
ll->wait()exactly do? Block until the last SET/GET_REPORT call has been ack'ed by the device?
It waits for at most 10*HZ until both the CTRL (command queue for set_report/get_report and 90% of the hid communication) and the OUTPUT queues are empty.
Honestly, I don't like the way the wait is done: nobody cares about the return value, meaning that nobody know why we have finished to wait. In 90% of the cases, it's used in conjunction with a .request() call.
So to sum up, given its current use, I would say that .wait() "blocks until all queues are flushed or for an amount of time that gives the caller good chances that his/her previous call has been transferred to the device".
Quoted 5 lines
* Bluetooth-HID might return errors on GET/SET_REPORT. Why don't we return these in
hid_hw_wait()for the last report? It would allow synchronous calls like:hid_hw_report();
ret =hid_hw_wait();
As there are several uses of .wait(), it seems difficult. Some are using it to make 'sure' that their previous command has been sent -> in this case, I would say, yes, go for it.
Some others are using it for it's real purpose: flush the queues before/after sending new commands -> it's difficult to put the last command result as a return value in this case (the latest result does not mean anything to the caller).
Maybe turning the hid_hw_report() for these cases into a blocking one would solve the problem.
Quoted 4 lines
* Should
hid_hw_report()allow multiple pending requests? Or should it return an error if there is another pending report that hasn't been ack'ed, yet?
I would say that it should.
If you ask for a report, it's then parsed through hid_input_report, meaning that you can ask for several reports at the same time. Each of them will be parsed in it's own buffer.
Quoted 4 lines
I will try to implement it for Bluetooth-HID and UHID if no-one else wants to do it. Doing it for UHID would make debugging/emulating devices a lot easier.
That would be great. I can't do the bluetooth part (I'm lacking of hardware), and for the UHID part... I don't really care about it in my tests for now :)
Cheers,
Benjamin
Hi
Quoted 11 lines · Benjamin Tissoires
Quoted 8 lines
(I did read the Bluetooth HID Profile specification but I have no idea how USB does it, so please bear with me if I mix things up. Maybe some day I will have the time to read the USB specs, too)
* There are several drivers using "
dev->hid_get_raw_report()" and "dev->hid_output_raw_report()". Any objections to moving these to "hid_ll_driver" and adding wrapper functions hid_hw_get/output_raw_report()?I can't see any. Those two callbacks are transport dependent, so I also think it makes sense to put them into
hid_ll_driver.
I will prepare a patch.
Quoted 20 lines
I also wish we have the set/get hid idle callback (it would remove the last usb dependency in hid-multitouch).
Quoted 4 lines
* What should the
ll->report()callback exactly do? Should it simply send aGET_REPORTorSET_REPORTrequest depending on the direction (nonblocking)?Well, given the way it's used in hid drivers and usbhid/i2c-hid:
-SET_REPORTtakes an already parsed report and send it to the device -> the usbhid part is nonblocking, i2c-hid is blocking.
-GET_REPORTasks for the HID commandGET_REPORTand once it's done, the incoming report is parsed as if it was spontaneously generated (meaning that there are no guarantees that the report the caller reads afterreport()is the requested one).The patch for implementing those functions in i2c-hid is IMHO simpler to understand than the usb one as i2c-hid makes no use of dma or async calls.
Quoted 5 lines
For the nonblocking part, the usb pendant is asynchronous, thus the need of the .wait().
The i2c-hid driver is synchronous, meaning that the call is blocking (sorry). But .wait() is not required to be called, and then, we don't need to set it.
Then maybe I'll wait for the first driver that needs these and then decide whether to make the Bluetooth calls blocking/nonblocking. But see below.
Quoted 9 lines
Quoted 4 lines
* Why don't we do the
hid_output_report()call in thehid_hw_report()helper and pass the raw buffers down? It would allowGFP_KERNELand avoid duplicating code in all four backends.Well. I continued Henrik's work on that, and the idea was to not break any existing device. So, the code path should be the nearest possible to the existing one. Now that this part is done, we can look at something more efficient in terms of duplication.
Ok, that's fine.
Quoted 44 lines
Actually, the implementation of i2c-hid .request() already uses the raw buffers commands, meaning that it's nearly what we need (except that we need to get the size of the buffer in some other way).
However, in usbhid and i2c-hid, .hid_get_raw_report() and .hid_output_raw_report() are blocking, meaning that it will change the current behavior for drivers.
Quoted 4 lines
* What should
ll->wait()exactly do? Block until the last SET/GET_REPORT call has been ack'ed by the device?It waits for at most 10*HZ until both the CTRL (command queue for set_report/get_report and 90% of the hid communication) and the OUTPUT queues are empty.
Honestly, I don't like the way the wait is done: nobody cares about the return value, meaning that nobody know why we have finished to wait. In 90% of the cases, it's used in conjunction with a .request() call.So to sum up, given its current use, I would say that .wait() "blocks until all queues are flushed or for an amount of time that gives the caller good chances that his/her previous call has been transferred to the device".
Quoted 5 lines
* Bluetooth-HID might return errors on GET/SET_REPORT. Why don't we return these in
hid_hw_wait()for the last report? It would allow synchronous calls like:hid_hw_report();
ret =hid_hw_wait();As there are several uses of .wait(), it seems difficult. Some are using it to make 'sure' that their previous command has been sent -> in this case, I would say, yes, go for it.
Some others are using it for it's real purpose: flush the queues before/after sending new commands -> it's difficult to put the last command result as a return value in this case (the latest result does not mean anything to the caller).Maybe turning the
hid_hw_report()for these cases into a blocking one would solve the problem.Quoted 1 line
Quoted 8 lines
Quoted 3 lines
* Should
hid_hw_report()allow multiple pending requests? Or should it return an error if there is another pending report that hasn't been ack'ed, yet?I would say that it should.
If you ask for a report, it's then parsed throughhid_input_report, meaning that you can ask for several reports at the same time. Each of them will be parsed in it's own buffer.
I just checked the Bluetooth specs and they forbid multiple pending requests on the CTRL channel. Hence, I think there is no reason to make hid_hw_report() non-blocking for BT.
So I think the internal BT design will be a mutex that locks the CTRL channel and a wait_event_timeout() that waits 5s max for an answer. As l2cap is reliable and supports re-transmission, the high timeout seems reasonable.
That would make hid_hw_wait() useless for BT and the design similar to i2c-hid, I guess.
Quoted 8 lines
Quoted 4 lines
I will try to implement it for Bluetooth-HID and UHID if no-one else wants to do it. Doing it for UHID would make debugging/emulating devices a lot easier.
That would be great. I can't do the bluetooth part (I'm lacking of hardware), and for the UHID part... I don't really care about it in my tests for now :)
Thanks for clarifying. I don't think I will implement the callbacks, yet (there's no driver using them). However, it really helps to improve the internal design.
Thanks
David
Quoted 12 lines · Jiri Kosina
Quoted 10 lines · Benjamin Tissoires
Hi guys,
this is the v2 of the hid transport cleanup.
Changes since v1:
- gathered reviewed/acked/etc..
- changed commit messages of patches 4-6
- add newcomer into account (thingm)
- incorporated the i2c-hid driver change into the series
Quoted 4 lines
Quoted 2 lines
I still did not implemented the final usb cleanup for hid-multitouch as it may required few comments.
I have now taken the series. Thanks Benjamin, thanks Henrik.
Thanks Jiri, thanks Benjamin. :-)
Henrik