diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-11 15:32:11 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-11 15:32:11 -0700 |
| commit | 4832a4dada1a2baefac76b70e4f3a78e71a7c35c (patch) | |
| tree | c374b39ebbb7426693265d14412a1f271ecd775e | |
| parent | db0457338ece7482378d88e50ad298191c3e6947 (diff) | |
| parent | 86766756ac2b10ad23849becdc245ea903466616 (diff) | |
| download | linux-4832a4dada1a2baefac76b70e4f3a78e71a7c35c.tar.gz linux-4832a4dada1a2baefac76b70e4f3a78e71a7c35c.tar.bz2 linux-4832a4dada1a2baefac76b70e4f3a78e71a7c35c.zip | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
Pull HID updates from Jiri Kosina:
- Documentation conversion to ReST, from Mauro Carvalho Chehab
- Wacom MobileStudio Pro support, from Ping Cheng
- Wacom 2nd Gen Intuos Pro Small support, from Aaron Armstrong Skomra
- assorted small fixes and device ID additions
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
HID: Add another Primax PIXART OEM mouse quirk
HID: wacom: generic: add touchring adjustment for 2nd Gen Pro Small
docs: hid: convert to ReST
HID: remove NO_D3 flag when remove driver
HID: wacom: add new MobileStudio Pro support
HID: wacom: generic: read the number of expected touches on a per collection basis
HID: wacom: generic: support the 'report valid' usage for touch
HID: wacom: generic: read HID_DG_CONTACTMAX from any feature report
HID: wacom: Add 2nd gen Intuos Pro Small support
HID: uclogic: Add support for Ugee Rainbow CV720
HID: logitech-dj: fix return value of logi_dj_recv_query_hidpp_devices
HID: logitech-hidpp: HID: make const array consumer_rdesc_start static
HID: logitech-dj: make const array template static
HID: wacom: correct touch resolution x/y typo
HID: wacom: generic: Correct pad syncing
HID: wacom: generic: only switch the mode on devices with LEDs
HID: logitech-dj: Add usb-id for the 27MHz MX3000 receiver
22 files changed, 1049 insertions, 727 deletions
diff --git a/Documentation/hid/hid-alps.txt b/Documentation/hid/hid-alps.rst index 6b02a2447c77..e2f4c4c11e3f 100644 --- a/Documentation/hid/hid-alps.txt +++ b/Documentation/hid/hid-alps.rst @@ -1,19 +1,26 @@ +========================== ALPS HID Touchpad Protocol ----------------------- +========================== Introduction ------------ Currently ALPS HID driver supports U1 Touchpad device. -U1 devuce basic information. +U1 device basic information. + +========== ====== Vender ID 0x044E Product ID 0x120B Version ID 0x0121 +========== ====== HID Descriptor ------------- +-------------- + +======= ==================== ===== ======================================= Byte Field Value Notes +======= ==================== ===== ======================================= 0 wHIDDescLength 001E Length of HID Descriptor : 30 bytes 2 bcdVersion 0100 Compliant with Version 1.00 4 wReportDescLength 00B2 Report Descriptor is 178 Bytes (0x00B2) @@ -28,32 +35,42 @@ Byte Field Value Notes 22 wProductID 120B Product ID 0x120B 24 wVersionID 0121 Version 01.21 26 RESERVED 0000 RESERVED +======= ==================== ===== ======================================= Report ID ------------- -ReportID-1 (Input Reports) (HIDUsage-Mouse) for TP&SP -ReportID-2 (Input Reports) (HIDUsage-keyboard) for TP -ReportID-3 (Input Reports) (Vendor Usage: Max 10 finger data) for TP -ReportID-4 (Input Reports) (Vendor Usage: ON bit data) for GP -ReportID-5 (Feature Reports) Feature Reports -ReportID-6 (Input Reports) (Vendor Usage: StickPointer data) for SP -ReportID-7 (Feature Reports) Flash update (Bootloader) +--------- + +========== ================= ========================================= +ReportID-1 (Input Reports) (HIDUsage-Mouse) for TP&SP +ReportID-2 (Input Reports) (HIDUsage-keyboard) for TP +ReportID-3 (Input Reports) (Vendor Usage: Max 10 finger data) for TP +ReportID-4 (Input Reports) (Vendor Usage: ON bit data) for GP +ReportID-5 (Feature Reports) Feature Reports +ReportID-6 (Input Reports) (Vendor Usage: StickPointer data) for SP +ReportID-7 (Feature Reports) Flash update (Bootloader) +========== ================= ========================================= Data pattern ------------ + +===== ========== ===== ================= Case1 ReportID_1 TP/SP Relative/Relative Case2 ReportID_3 TP Absolute ReportID_6 SP Absolute +===== ========== ===== ================= Command Read/Write ------------------ To read/write to RAM, need to send a commands to the device. + The command format is as below. DataByte(SET_REPORT) + +===== ====================== Byte1 Command Byte Byte2 Address - Byte 0 (LSB) Byte3 Address - Byte 1 @@ -61,13 +78,19 @@ Byte4 Address - Byte 2 Byte5 Address - Byte 3 (MSB) Byte6 Value Byte Byte7 Checksum +===== ====================== Command Byte is read=0xD1/write=0xD2 . + Address is read/write RAM address. + Value Byte is writing data when you send the write commands. + When you read RAM, there is no meaning. DataByte(GET_REPORT) + +===== ====================== Byte1 Response Byte Byte2 Address - Byte 0 (LSB) Byte3 Address - Byte 1 @@ -75,6 +98,7 @@ Byte4 Address - Byte 2 Byte5 Address - Byte 3 (MSB) Byte6 Value Byte Byte7 Checksum +===== ====================== Read value is stored in Value Byte. @@ -82,7 +106,11 @@ Read value is stored in Value Byte. Packet Format Touchpad data byte ------------------ - b7 b6 b5 b4 b3 b2 b1 b0 + + +======= ======= ======= ======= ======= ======= ======= ======= ===== +- b7 b6 b5 b4 b3 b2 b1 b0 +======= ======= ======= ======= ======= ======= ======= ======= ===== 1 0 0 SW6 SW5 SW4 SW3 SW2 SW1 2 0 0 0 Fcv Fn3 Fn2 Fn1 Fn0 3 Xa0_7 Xa0_6 Xa0_5 Xa0_4 Xa0_3 Xa0_2 Xa0_1 Xa0_0 @@ -114,17 +142,25 @@ Touchpad data byte 25 Ya4_7 Ya4_6 Ya4_5 Ya4_4 Ya4_3 Ya4_2 Ya4_1 Ya4_0 26 Ya4_15 Ya4_14 Ya4_13 Ya4_12 Ya4_11 Ya4_10 Ya4_9 Ya4_8 27 LFB4 Zs4_6 Zs4_5 Zs4_4 Zs4_3 Zs4_2 Zs4_1 Zs4_0 +======= ======= ======= ======= ======= ======= ======= ======= ===== -SW1-SW6: SW ON/OFF status -Xan_15-0(16bit):X Absolute data of the "n"th finger -Yan_15-0(16bit):Y Absolute data of the "n"th finger -Zsn_6-0(7bit): Operation area of the "n"th finger +SW1-SW6: + SW ON/OFF status +Xan_15-0(16bit): + X Absolute data of the "n"th finger +Yan_15-0(16bit): + Y Absolute data of the "n"th finger +Zsn_6-0(7bit): + Operation area of the "n"th finger StickPointer data byte ------------------- - b7 b6 b5 b4 b3 b2 b1 b0 +---------------------- + +======= ======= ======= ======= ======= ======= ======= ======= ===== +- b7 b6 b5 b4 b3 b2 b1 b0 +======= ======= ======= ======= ======= ======= ======= ======= ===== Byte1 1 1 1 0 1 SW3 SW2 SW1 Byte2 X7 X6 X5 X4 X3 X2 X1 X0 Byte3 X15 X14 X13 X12 X11 X10 X9 X8 @@ -132,8 +168,13 @@ Byte4 Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 Byte5 Y15 Y14 Y13 Y12 Y11 Y10 Y9 Y8 Byte6 Z7 Z6 Z5 Z4 Z3 Z2 Z1 Z0 Byte7 T&P Z14 Z13 Z12 Z11 Z10 Z9 Z8 - -SW1-SW3: SW ON/OFF status -Xn_15-0(16bit):X Absolute data -Yn_15-0(16bit):Y Absolute data -Zn_14-0(15bit):Z +======= ======= ======= ======= ======= ======= ======= ======= ===== + +SW1-SW3: + SW ON/OFF status +Xn_15-0(16bit): + X Absolute data +Yn_15-0(16bit): + Y Absolute data +Zn_14-0(15bit): + Z diff --git a/Documentation/hid/hid-sensor.txt b/Documentation/hid/hid-sensor.rst index b287752a31cd..758972e34971 100644 --- a/Documentation/hid/hid-sensor.txt +++ b/Documentation/hid/hid-sensor.rst @@ -1,6 +1,6 @@ - +===================== HID Sensors Framework -====================== +===================== HID sensor framework provides necessary interfaces to implement sensor drivers, which are connected to a sensor hub. The sensor hub is a HID device and it provides a report descriptor conforming to HID 1.12 sensor usage tables. @@ -15,22 +15,22 @@ the drivers themselves." This specification describes many usage IDs, which describe the type of sensor and also the individual data fields. Each sensor can have variable number of data fields. The length and order is specified in the report descriptor. For -example a part of report descriptor can look like: - - INPUT(1)[INPUT] - .. - Field(2) - Physical(0020.0073) - Usage(1) - 0020.045f - Logical Minimum(-32767) - Logical Maximum(32767) - Report Size(8) - Report Count(1) - Report Offset(16) - Flags(Variable Absolute) -.. -.. +example a part of report descriptor can look like:: + + INPUT(1)[INPUT] + .. + Field(2) + Physical(0020.0073) + Usage(1) + 0020.045f + Logical Minimum(-32767) + Logical Maximum(32767) + Report Size(8) + Report Count(1) + Report Offset(16) + Flags(Variable Absolute) + .. + .. The report is indicating "sensor page (0x20)" contains an accelerometer-3D (0x73). This accelerometer-3D has some fields. Here for example field 2 is motion intensity @@ -40,13 +40,14 @@ data will use this format. Implementation -================= +============== This specification defines many different types of sensors with different sets of data fields. It is difficult to have a common input event to user space applications, for different sensors. For example an accelerometer can send X,Y and Z data, whereas an ambient light sensor can send illumination data. So the implementation has two parts: + - Core hid driver - Individual sensor processing part (sensor drivers) @@ -55,8 +56,11 @@ Core driver The core driver registers (hid-sensor-hub) registers as a HID driver. It parses report descriptors and identifies all the sensors present. It adds an MFD device with name HID-SENSOR-xxxx (where xxxx is usage id from the specification). -For example + +For example: + HID-SENSOR-200073 is registered for an Accelerometer 3D driver. + So if any driver with this name is inserted, then the probe routine for that function will be called. So an accelerometer processing driver can register with this name and will be probed if there is an accelerometer-3D detected. @@ -66,7 +70,8 @@ drivers to register and get events for that usage id. Also it provides parsing functions, which get and set each input/feature/output report. Individual sensor processing part (sensor drivers) ------------ +-------------------------------------------------- + The processing driver will use an interface provided by the core driver to parse the report and get the indexes of the fields and also can get events. This driver can use IIO interface to use the standard ABI defined for a type of sensor. @@ -75,31 +80,34 @@ can use IIO interface to use the standard ABI defined for a type of sensor. Core driver Interface ===================== -Callback structure: -Each processing driver can use this structure to set some callbacks. +Callback structure:: + + Each processing driver can use this structure to set some callbacks. int (*suspend)(..): Callback when HID suspend is received int (*resume)(..): Callback when HID resume is received int (*capture_sample)(..): Capture a sample for one of its data fields int (*send_event)(..): One complete event is received which can have multiple data fields. -Registration functions: -int sensor_hub_register_callback(struct hid_sensor_hub_device *hsdev, +Registration functions:: + + int sensor_hub_register_callback(struct hid_sensor_hub_device *hsdev, u32 usage_id, struct hid_sensor_hub_callbacks *usage_callback): Registers callbacks for an usage id. The callback functions are not allowed -to sleep. +to sleep:: -int sensor_hub_remove_callback(struct hid_sensor_hub_device *hsdev, + int sensor_hub_remove_callback(struct hid_sensor_hub_device *hsdev, u32 usage_id): Removes callbacks for an usage id. -Parsing function: -int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev, +Parsing function:: + + int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev, u8 type, u32 usage_id, u32 attr_usage_id, struct hid_sensor_hub_attribute_info *info); @@ -110,26 +118,27 @@ so that fields can be set or get individually. These indexes avoid searching every time and getting field index to get or set. -Set Feature report -int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, +Set Feature report:: + + int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, u32 field_index, s32 value); This interface is used to set a value for a field in feature report. For example if there is a field report_interval, which is parsed by a call to -sensor_hub_input_get_attribute_info before, then it can directly set that individual -field. +sensor_hub_input_get_attribute_info before, then it can directly set that +individual field:: -int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, + int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, u32 field_index, s32 *value); This interface is used to get a value for a field in input report. For example if there is a field report_interval, which is parsed by a call to -sensor_hub_input_get_attribute_info before, then it can directly get that individual -field value. +sensor_hub_input_get_attribute_info before, then it can directly get that +individual field value:: -int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev, + int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev, u32 usage_id, u32 attr_usage_id, u32 report_id); @@ -143,6 +152,8 @@ registered callback function to process the sample. ---------- HID Custom and generic Sensors +------------------------------ + HID Sensor specification defines two special sensor usage types. Since they don't represent a standard sensor, it is not possible to define using Linux IIO @@ -158,66 +169,73 @@ keyboard attached/detached or lid open/close. To allow application to utilize these sensors, here they are exported uses sysfs attribute groups, attributes and misc device interface. -An example of this representation on sysfs: -/sys/devices/pci0000:00/INT33C2:00/i2c-0/i2c-INT33D1:00/0018:8086:09FA.0001/HID-SENSOR-2000e1.6.auto$ tree -R -. -????????? enable_sensor -????????? feature-0-200316 -??????? ????????? feature-0-200316-maximum -??????? ????????? feature-0-200316-minimum -??????? ????????? feature-0-200316-name -??????? ????????? feature-0-200316-size -??????? ????????? feature-0-200316-unit-expo -??????? ????????? feature-0-200316-units -??????? ????????? feature-0-200316-value -????????? feature-1-200201 -??????? ????????? feature-1-200201-maximum -??????? ????????? feature-1-200201-minimum -??????? ????????? feature-1-200201-name -??????? ????????? feature-1-200201-size -??????? ????????? feature-1-200201-unit-expo -??????? ????????? feature-1-200201-units -??????? ????????? feature-1-200201-value -????????? input-0-200201 -??????? ????????? input-0-200201-maximum -??????? ????????? input-0-200201-minimum -??????? ????????? input-0-200201-name -??????? ????????? input-0-200201-size -??????? ????????? input-0-200201-unit-expo -??????? ????????? input-0-200201-units -??????? ????????? input-0-200201-value -????????? input-1-200202 -??????? ????????? input-1-200202-maximum -??????? ????????? input-1-200202-minimum -??????? ????????? input-1-200202-name -??????? ????????? input-1-200202-size -??????? ????????? input-1-200202-unit-expo -??????? ????????? input-1-200202-units -??????? ????????? input-1-200202-value +An example of this representation on sysfs:: + + /sys/devices/pci0000:00/INT33C2:00/i2c-0/i2c-INT33D1:00/0018:8086:09FA.0001/HID-SENSOR-2000e1.6.auto$ tree -R + . + │ ├── enable_sensor + │ │ ├── feature-0-200316 + │ │ │ ├── feature-0-200316-maximum + │ │ │ ├── feature-0-200316-minimum + │ │ │ ├── feature-0-200316-name + │ │ │ ├── feature-0-200316-size + │ │ │ ├── feature-0-200316-unit-expo + │ │ │ ├── feature-0-200316-units + │ │ │ ├── feature-0-200316-value + │ │ ├── feature-1-200201 + │ │ │ ├── feature-1-200201-maximum + │ │ │ ├── feature-1-200201-minimum + │ │ │ ├── feature-1-200201-name + │ │ │ ├── feature-1-200201-size + │ │ │ ├── feature-1-200201-unit-expo + │ │ │ ├── feature-1-200201-units + │ │ │ ├── feature-1-200201-value + │ │ ├── input-0-200201 + │ │ │ ├── input-0-200201-maximum + │ │ │ ├── input-0-200201-minimum + │ │ │ ├── input-0-200201-name + │ │ │ ├── input-0-200201-size + │ │ │ ├── input-0-200201-unit-expo + │ │ │ ├── input-0-200201-units + │ │ │ ├── input-0-200201-value + │ │ ├── input-1-200202 + │ │ │ ├── input-1-200202-maximum + │ │ │ ├── input-1-200202-minimum + │ │ │ ├── input-1-200202-name + │ │ │ ├── input-1-200202-size + │ │ │ ├── input-1-200202-unit-expo + │ │ │ ├── input-1-200202-units + │ │ │ ├── input-1-200202-value Here there is a custom sensors with four fields, two feature and two inputs. Each field is represented by a set of attributes. All fields except the "value" are read only. The value field is a RW field. -Example -/sys/bus/platform/devices/HID-SENSOR-2000e1.6.auto/feature-0-200316$ grep -r . * -feature-0-200316-maximum:6 -feature-0-200316-minimum:0 -feature-0-200316-name:property-reporting-state -feature-0-200316-size:1 -feature-0-200316-unit-expo:0 -feature-0-200316-units:25 -feature-0-200316-value:1 + +Example:: + + /sys/bus/platform/devices/HID-SENSOR-2000e1.6.auto/feature-0-200316$ grep -r . * + feature-0-200316-maximum:6 + feature-0-200316-minimum:0 + feature-0-200316-name:property-reporting-state + feature-0-200316-size:1 + feature-0-200316-unit-expo:0 + feature-0-200316-units:25 + feature-0-200316-value:1 How to enable such sensor? +^^^^^^^^^^^^^^^^^^^^^^^^^^ + By default sensor can be power gated. To enable sysfs attribute "enable" can be -used. -$ echo 1 > enable_sensor +used:: + + $ echo 1 > enable_sensor Once enabled and powered on, sensor can report value using HID reports. -These reports are pushed using misc device interface in a FIFO order. -/dev$ tree | grep HID-SENSOR-2000e1.6.auto -??????? ????????? 10:53 -> ../HID-SENSOR-2000e1.6.auto -????????? HID-SENSOR-2000e1.6.auto +These reports are pushed using misc device interface in a FIFO order:: + + /dev$ tree | grep HID-SENSOR-2000e1.6.auto + │ │ │ ├── 10:53 -> ../HID-SENSOR-2000e1.6.auto + │ ├── HID-SENSOR-2000e1.6.auto Each reports can be of variable length preceded by a header. This header consist of a 32 bit usage id, 64 bit time stamp and 32 bit length field of raw diff --git a/Documentation/hid/hid-transport.txt b/Documentation/hid/hid-transport.rst index 4f41d67f1b4b..0fe526f36db6 100644 --- a/Documentation/hid/hid-transport.txt +++ b/Documentation/hid/hid-transport.rst @@ -1,5 +1,6 @@ - HID I/O Transport Drivers - =========================== +========================= +HID I/O Transport Drivers +========================= The HID subsystem is independent of the underlying transport driver. Initially, only USB was supported, but other specifications adopted the HID design and @@ -16,6 +17,8 @@ transport and device setup/management. HID core is responsible of report-parsing, report interpretation and the user-space API. Device specifics and quirks are handled by all layers depending on the quirk. +:: + +-----------+ +-----------+ +-----------+ +-----------+ | Device #1 | | Device #i | | Device #j | | Device #k | +-----------+ +-----------+ +-----------+ +-----------+ @@ -42,8 +45,9 @@ and quirks are handled by all layers depending on the quirk. +----------------+ +-----------+ +------------------+ +------------------+ Example Drivers: - I/O: USB, I2C, Bluetooth-l2cap - Transport: USB-HID, I2C-HID, BT-HIDP + + - I/O: USB, I2C, Bluetooth-l2cap + - Transport: USB-HID, I2C-HID, BT-HIDP Everything below "HID Core" is simplified in this graph as it is only of interest to HID device drivers. Transport drivers do not need to know the @@ -183,7 +187,7 @@ Other ctrl-channel requests are supported by USB-HID but are not available ------------------- Transport drivers normally use the following procedure to register a new device -with HID core: +with HID core:: struct hid_device *hid; int ret; @@ -215,7 +219,7 @@ Once hid_add_device() is entered, HID core might use the callbacks provided in "custom_ll_driver". Note that fields like "country" can be ignored by underlying transport-drivers if not supported. -To unregister a device, use: +To unregister a device, use:: hid_destroy_device(hid); @@ -226,73 +230,110 @@ driver callbacks. ----------------------------- The available HID callbacks are: - - int (*start) (struct hid_device *hdev) + + :: + + int (*start) (struct hid_device *hdev) + Called from HID device drivers once they want to use the device. Transport drivers can choose to setup their device in this callback. However, normally devices are already set up before transport drivers register them to HID core so this is mostly only used by USB-HID. - - void (*stop) (struct hid_device *hdev) + :: + + void (*stop) (struct hid_device *hdev) + Called from HID device drivers once they are done with a device. Transport drivers can free any buffers and deinitialize the device. But note that ->start() might be called again if another HID device driver is loaded on the device. + Transport drivers are free to ignore it and deinitialize devices after they destroyed them via hid_destroy_device(). - - int (*open) (struct hid_device *hdev) + :: + + int (*open) (struct hid_device *hdev) + Called from HID device drivers once they are interested in data reports. Usually, while user-space didn't open any input API/etc., device drivers are not interested in device data and transport drivers can put devices asleep. However, once ->open() is called, transport drivers must be ready for I/O. ->open() calls are nested for each client that opens the HID device. - - void (*close) (struct hid_device *hdev) + :: + + void (*close) (struct hid_device *hdev) + Called from HID device drivers after ->open() was called but they are no longer interested in device reports. (Usually if user-space closed any input devices of the driver). + Transport drivers can put devices asleep and terminate any I/O of all ->open() calls have been followed by a ->close() call. However, ->start() may be called again if the device driver is interested in input reports again. - - int (*parse) (struct hid_device *hdev) + :: + + int (*parse) (struct hid_device *hdev) + Called once during device setup after ->start() has been called. Transport drivers must read the HID report-descriptor from the device and tell HID core about it via hid_parse_report(). - - int (*power) (struct hid_device *hdev, int level) + :: + + int (*power) (struct hid_device *hdev, int level) + Called by HID core to give PM hints to transport drivers. Usually this is analogical to the ->open() and ->close() hints and redundant. - - void (*request) (struct hid_device *hdev, struct hid_report *report, - int reqtype) + :: + + void (*request) (struct hid_device *hdev, struct hid_report *report, + int reqtype) + Send an HID request on the ctrl channel. "report" contains the report that should be sent and "reqtype" the request type. Request-type can be HID_REQ_SET_REPORT or HID_REQ_GET_REPORT. + This callback is optional. If not provided, HID core will assemble a raw report following the HID specs and send it via the ->raw_request() callback. The transport driver is free to implement this asynchronously. - - int (*wait) (struct hid_device *hdev) + :: + + int (*wait) (struct hid_device *hdev) + Used by HID core before calling ->request() again. A transport driver can use it to wait for any pending requests to complete if only one request is allowed at a time. - - int (*raw_request) (struct hid_device *hdev, unsigned char reportnum, - __u8 *buf, size_t count, unsigned char rtype, - int reqtype) + :: + + int (*raw_request) (struct hid_device *hdev, unsigned char reportnum, + __u8 *buf, size_t count, unsigned char rtype, + int reqtype) + Same as ->request() but provides the report as raw buffer. This request shall be synchronous. A transport driver must not use ->wait() to complete such requests. This request is mandatory and hid core will reject the device if it is missing. - - int (*output_report) (struct hid_device *hdev, __u8 *buf, size_t len) + :: + + int (*output_report) (struct hid_device *hdev, __u8 *buf, size_t len) + Send raw output report via intr channel. Used by some HID device drivers which require high throughput for outgoing requests on the intr channel. This must not cause SET_REPORT calls! This must be implemented as asynchronous output report on the intr channel! - - int (*idle) (struct hid_device *hdev, int report, int idle, int reqtype) + :: + + int (*idle) (struct hid_device *hdev, int report, int idle, int reqtype) + Perform SET/GET_IDLE request. Only used by USB-HID, do not implement! 2.3) Data Path @@ -314,4 +355,5 @@ transport driver and not passed to hid_input_report(). Acknowledgements to SET_REPORT requests are not of interest to HID core. ---------------------------------------------------- + Written 2013, David Herrmann <dh.herrmann@gmail.com> diff --git a/Documentation/hid/hiddev.txt b/Documentation/hid/hiddev.rst index 638448707aa2..209e6ba4e019 100644 --- a/Documentation/hid/hiddev.txt +++ b/Documentation/hid/hiddev.rst @@ -1,6 +1,9 @@ +================================================ Care and feeding of your Human Interface Devices +================================================ -INTRODUCTION +Introduction +============ In addition to the normal input type HID devices, USB also uses the human interface device protocols for things that are not really human @@ -16,38 +19,40 @@ normalised event interface - see Documentation/input/input.rst * the hiddev interface, which provides fairly raw HID events The data flow for a HID event produced by a device is something like -the following : +the following:: usb.c ---> hid-core.c ----> hid-input.c ----> [keyboard/mouse/joystick/event] | | - --> hiddev.c ----> POWER / MONITOR CONTROL + --> hiddev.c ----> POWER / MONITOR CONTROL In addition, other subsystems (apart from USB) can potentially feed events into the input subsystem, but these have no effect on the hid device interface. -USING THE HID DEVICE INTERFACE +Using the HID Device Interface +============================== The hiddev interface is a char interface using the normal USB major, with the minor numbers starting at 96 and finishing at 111. Therefore, -you need the following commands: -mknod /dev/usb/hiddev0 c 180 96 -mknod /dev/usb/hiddev1 c 180 97 -mknod /dev/usb/hiddev2 c 180 98 -mknod /dev/usb/hiddev3 c 180 99 -mknod /dev/usb/hiddev4 c 180 100 -mknod /dev/usb/hiddev5 c 180 101 -mknod /dev/usb/hiddev6 c 180 102 -mknod /dev/usb/hiddev7 c 180 103 -mknod /dev/usb/hiddev8 c 180 104 -mknod /dev/usb/hiddev9 c 180 105 -mknod /dev/usb/hiddev10 c 180 106 -mknod /dev/usb/hiddev11 c 180 107 -mknod /dev/usb/hiddev12 c 180 108 -mknod /dev/usb/hiddev13 c 180 109 -mknod /dev/usb/hiddev14 c 180 110 -mknod /dev/usb/hiddev15 c 180 111 +you need the following commands:: + + mknod /dev/usb/hiddev0 c 180 96 + mknod /dev/usb/hiddev1 c 180 97 + mknod /dev/usb/hiddev2 c 180 98 + mknod /dev/usb/hiddev3 c 180 99 + mknod /dev/usb/hiddev4 c 180 100 + mknod /dev/usb/hiddev5 c 180 101 + mknod /dev/usb/hiddev6 c 180 102 + mknod /dev/usb/hiddev7 c 180 103 + mknod /dev/usb/hiddev8 c 180 104 + mknod /dev/usb/hiddev9 c 180 105 + mknod /dev/usb/hiddev10 c 180 106 + mknod /dev/usb/hiddev11 c 180 107 + mknod /dev/usb/hiddev12 c 180 108 + mknod /dev/usb/hiddev13 c 180 109 + mknod /dev/usb/hiddev14 c 180 110 + mknod /dev/usb/hiddev15 c 180 111 So you point your hiddev compliant user-space program at the correct interface for your device, and it all just works. @@ -56,7 +61,9 @@ Assuming that you have a hiddev compliant user-space program, of course. If you need to write one, read on. -THE HIDDEV API +The HIDDEV API +============== + This description should be read in conjunction with the HID specification, freely available from http://www.usb.org, and conveniently linked of http://www.linux-usb.org. @@ -69,12 +76,14 @@ each of which can have one or more "usages". In the hid-core, each one of these usages has a single signed 32 bit value. read(): +------- + This is the event interface. When the HID device's state changes, it performs an interrupt transfer containing a report which contains the changed value. The hid-core.c module parses the report, and returns to hiddev.c the individual usages that have changed within the report. In its basic mode, the hiddev will make these individual -usage changes available to the reader using a struct hiddev_event: +usage changes available to the reader using a struct hiddev_event:: struct hiddev_event { unsigned hid; @@ -90,13 +99,19 @@ behavior of the read() function can be modified using the HIDIOCSFLAG ioctl() described below. -ioctl(): -This is the control interface. There are a number of controls: +ioctl(): +-------- + +This is the control interface. There are a number of controls: + +HIDIOCGVERSION + - int (read) + + Gets the version code out of the hiddev driver. -HIDIOCGVERSION - int (read) -Gets the version code out of the hiddev driver. +HIDIOCAPPLICATION + - (none) -HIDIOCAPPLICATION - (none) This ioctl call returns the HID application usage associated with the hid device. The third argument to ioctl() specifies which application index to get. This is useful when the device has more than one @@ -104,25 +119,33 @@ applicatio |
