Skip to content

Commit 4a7de05

Browse files
spandruvadaJiri Kosina
authored andcommitted
HID: sensor: Custom and Generic sensor support
HID Sensor Spec defines two usage ids for custom sensors HID_USAGE_SENSOR_TYPE_OTHER_CUSTOM (0x09, 0xE1) HID_USAGE_SENSOR_TYPE_OTHER_GENERIC(0x09, 0xE2) In addition the standard also defines usage ids for custom fields. The purpose of these sensors is to extend the functionality or provide a way to obfuscate the data being communicated by a sensor. Without knowing the mapping between the data and its encapsulated form, it is difficult for an driver to determine what data is being communicated by the sensor. This allows some differentiating use cases, where vendor can provide applications. Since these can't be represented by standard sensor interfaces like IIO, we present these as fields with - type (input/output) - units - min/max - get/set value In addition an dev interface to transfer report events. Details about this interface is described in /Documentation/hid/hid-sensor.txt. Manufacturers should not use these ids for any standard sensors, otherwise the the product/vendor id can be added to black list. Signed-off-by: Srinivas Pandruvada <[email protected]> Reviewed-by: Jonathan Cameron <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 62fad13 commit 4a7de05

File tree

3 files changed

+865
-0
lines changed

3 files changed

+865
-0
lines changed

drivers/hid/Kconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,21 @@ config HID_SENSOR_HUB
885885
for events and handle data streams. Each sensor driver can format
886886
data and present to user mode using input or IIO interface.
887887

888+
config HID_SENSOR_CUSTOM_SENSOR
889+
tristate "HID Sensors hub custom sensor support"
890+
depends on HID_SENSOR_HUB
891+
default n
892+
---help---
893+
HID Sensor hub specification allows definition of some custom and
894+
generic sensors. Unlike other HID sensors, they can't be exported
895+
via Linux IIO because of custom fields. This is up to the manufacturer
896+
to decide how to interpret these special sensor ids and process in
897+
the user space. Currently some manufacturers are using these ids for
898+
sensor calibration and debugging other sensors. Manufacturers
899+
should't use these special custom sensor ids to export any of the
900+
standard sensors.
901+
Select this config option for custom/generic sensor support.
902+
888903
endmenu
889904

890905
endif # HID

drivers/hid/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ obj-$(CONFIG_HID_WACOM) += wacom.o
101101
obj-$(CONFIG_HID_WALTOP) += hid-waltop.o
102102
obj-$(CONFIG_HID_WIIMOTE) += hid-wiimote.o
103103
obj-$(CONFIG_HID_SENSOR_HUB) += hid-sensor-hub.o
104+
obj-$(CONFIG_HID_SENSOR_CUSTOM_SENSOR) += hid-sensor-custom.o
104105

105106
obj-$(CONFIG_USB_HID) += usbhid/
106107
obj-$(CONFIG_USB_MOUSE) += usbhid/

0 commit comments

Comments
 (0)