diff options
author | Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> | 2015-04-10 14:22:23 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2015-04-10 16:22:56 -0400 |
commit | b2eafd7282fdfd148fc09032540b0ff42bfedfbf (patch) | |
tree | 7d72b6c4bb8dfa3c7e2cb50bd398370701cd7c4b | |
parent | 4a7de0519df5e8fb89cef6ee062330ffe4b50a4d (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.txt | 84 |
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 | |||
138 | the usage id of X axis. HID sensors can provide events, so this is not necessary | 138 | the usage id of X axis. HID sensors can provide events, so this is not necessary |
139 | to poll for any field. If there is some new sample, the core driver will call | 139 | to poll for any field. If there is some new sample, the core driver will call |
140 | registered callback function to process the sample. | 140 | registered callback function to process the sample. |
141 | |||
142 | |||
143 | ---------- | ||
144 | |||
145 | HID Custom and generic Sensors | ||
146 | |||
147 | HID Sensor specification defines two special sensor usage types. Since they | ||
148 | don't represent a standard sensor, it is not possible to define using Linux IIO | ||
149 | type interfaces. | ||
150 | The purpose of these sensors is to extend the functionality or provide a | ||
151 | way to obfuscate the data being communicated by a sensor. Without knowing the | ||
152 | mapping between the data and its encapsulated form, it is difficult for | ||
153 | an application/driver to determine what data is being communicated by the sensor. | ||
154 | This allows some differentiating use cases, where vendor can provide applications. | ||
155 | Some common use cases are debug other sensors or to provide some events like | ||
156 | keyboard attached/detached or lid open/close. | ||
157 | |||
158 | To allow application to utilize these sensors, here they are exported uses sysfs | ||
159 | attribute groups, attributes and misc device interface. | ||
160 | |||
161 | An 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 | |||
198 | Here there is a custom sensors with four fields, two feature and two inputs. | ||
199 | Each field is represented by a set of attributes. All fields except the "value" | ||
200 | are read only. The value field is a RW field. | ||
201 | Example | ||
202 | /sys/bus/platform/devices/HID-SENSOR-2000e1.6.auto/feature-0-200316$ grep -r . * | ||
203 | feature-0-200316-maximum:6 | ||
204 | feature-0-200316-minimum:0 | ||
205 | feature-0-200316-name:property-reporting-state | ||
206 | feature-0-200316-size:1 | ||
207 | feature-0-200316-unit-expo:0 | ||
208 | feature-0-200316-units:25 | ||
209 | feature-0-200316-value:1 | ||
210 | |||
211 | How to enable such sensor? | ||
212 | By default sensor can be power gated. To enable sysfs attribute "enable" can be | ||
213 | used. | ||
214 | $ echo 1 > enable_sensor | ||
215 | |||
216 | Once enabled and powered on, sensor can report value using HID reports. | ||
217 | These 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 | |||
222 | Each reports can be of variable length preceded by a header. This header | ||
223 | consist of a 32 bit usage id, 64 bit time stamp and 32 bit length field of raw | ||
224 | data. | ||