aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>2015-04-10 14:22:23 -0400
committerJiri Kosina <jkosina@suse.cz>2015-04-10 16:22:56 -0400
commitb2eafd7282fdfd148fc09032540b0ff42bfedfbf (patch)
tree7d72b6c4bb8dfa3c7e2cb50bd398370701cd7c4b
parent4a7de0519df5e8fb89cef6ee062330ffe4b50a4d (diff)
HID: sensor: Update document for custom sensor
Added custom sensor documentation Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--Documentation/hid/hid-sensor.txt84
1 files changed, 84 insertions, 0 deletions
diff --git a/Documentation/hid/hid-sensor.txt b/Documentation/hid/hid-sensor.txt
index 948b0989c433..b287752a31cd 100644
--- a/Documentation/hid/hid-sensor.txt
+++ b/Documentation/hid/hid-sensor.txt
@@ -138,3 +138,87 @@ accelerometer wants to poll X axis value, then it can call this function with
138the usage id of X axis. HID sensors can provide events, so this is not necessary 138the usage id of X axis. HID sensors can provide events, so this is not necessary
139to poll for any field. If there is some new sample, the core driver will call 139to poll for any field. If there is some new sample, the core driver will call
140registered callback function to process the sample. 140registered callback function to process the sample.
141
142
143----------
144
145HID Custom and generic Sensors
146
147HID Sensor specification defines two special sensor usage types. Since they
148don't represent a standard sensor, it is not possible to define using Linux IIO
149type interfaces.
150The purpose of these sensors is to extend the functionality or provide a
151way to obfuscate the data being communicated by a sensor. Without knowing the
152mapping between the data and its encapsulated form, it is difficult for
153an application/driver to determine what data is being communicated by the sensor.
154This allows some differentiating use cases, where vendor can provide applications.
155Some common use cases are debug other sensors or to provide some events like
156keyboard attached/detached or lid open/close.
157
158To allow application to utilize these sensors, here they are exported uses sysfs
159attribute groups, attributes and misc device interface.
160
161An example of this representation on sysfs:
162/sys/devices/pci0000:00/INT33C2:00/i2c-0/i2c-INT33D1:00/0018:8086:09FA.0001/HID-SENSOR-2000e1.6.auto$ tree -R
163.
164????????? enable_sensor
165????????? feature-0-200316
166??????? ????????? feature-0-200316-maximum
167??????? ????????? feature-0-200316-minimum
168??????? ????????? feature-0-200316-name
169??????? ????????? feature-0-200316-size
170??????? ????????? feature-0-200316-unit-expo
171??????? ????????? feature-0-200316-units
172??????? ????????? feature-0-200316-value
173????????? feature-1-200201
174??????? ????????? feature-1-200201-maximum
175??????? ????????? feature-1-200201-minimum
176??????? ????????? feature-1-200201-name
177??????? ????????? feature-1-200201-size
178??????? ????????? feature-1-200201-unit-expo
179??????? ????????? feature-1-200201-units
180??????? ????????? feature-1-200201-value
181????????? input-0-200201
182??????? ????????? input-0-200201-maximum
183??????? ????????? input-0-200201-minimum
184??????? ????????? input-0-200201-name
185??????? ????????? input-0-200201-size
186??????? ????????? input-0-200201-unit-expo
187??????? ????????? input-0-200201-units
188??????? ????????? input-0-200201-value
189????????? input-1-200202
190??????? ????????? input-1-200202-maximum
191??????? ????????? input-1-200202-minimum
192??????? ????????? input-1-200202-name
193??????? ????????? input-1-200202-size
194??????? ????????? input-1-200202-unit-expo
195??????? ????????? input-1-200202-units
196??????? ????????? input-1-200202-value
197
198Here there is a custom sensors with four fields, two feature and two inputs.
199Each field is represented by a set of attributes. All fields except the "value"
200are read only. The value field is a RW field.
201Example
202/sys/bus/platform/devices/HID-SENSOR-2000e1.6.auto/feature-0-200316$ grep -r . *
203feature-0-200316-maximum:6
204feature-0-200316-minimum:0
205feature-0-200316-name:property-reporting-state
206feature-0-200316-size:1
207feature-0-200316-unit-expo:0
208feature-0-200316-units:25
209feature-0-200316-value:1
210
211How to enable such sensor?
212By default sensor can be power gated. To enable sysfs attribute "enable" can be
213used.
214$ echo 1 > enable_sensor
215
216Once enabled and powered on, sensor can report value using HID reports.
217These reports are pushed using misc device interface in a FIFO order.
218/dev$ tree | grep HID-SENSOR-2000e1.6.auto
219??????? ????????? 10:53 -> ../HID-SENSOR-2000e1.6.auto
220????????? HID-SENSOR-2000e1.6.auto
221
222Each reports can be of variable length preceded by a header. This header
223consist of a 32 bit usage id, 64 bit time stamp and 32 bit length field of raw
224data.