aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-sensor-hub.c
diff options
context:
space:
mode:
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>2013-10-26 13:04:09 -0400
committerJiri Kosina <jkosina@suse.cz>2013-10-30 09:24:51 -0400
commitd4b1bba76171cb783e32441b28462fe841073ed8 (patch)
tree31130bbf6888e1a210c9b7ce28b6cf5fa5177042 /drivers/hid/hid-sensor-hub.c
parenta94c79bdc972f7b3d66756043edbd6d04e8486d6 (diff)
HID: hid-sensor-hub: fix report size
Most of the hid sensor field size is reported in report_size field in the report descriptor. For rotation fusion sensor the quaternion data is 16 byte field, the report size was set to 4 and report count field is set to 4. So the total size is 16 bytes. But the current driver has a bug and not taking account for report count field. This causes user space to see only 4 bytes of data sent via IIO interface. The number of bytes in a field needs to take account of report_count field. Need to multiply report_size and report_count to get total number of bytes. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-sensor-hub.c')
-rw-r--r--drivers/hid/hid-sensor-hub.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index 10e1581022cf..9e4cdca549c0 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -326,7 +326,8 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev,
326 field->logical == attr_usage_id) { 326 field->logical == attr_usage_id) {
327 sensor_hub_fill_attr_info(info, i, report->id, 327 sensor_hub_fill_attr_info(info, i, report->id,
328 field->unit, field->unit_exponent, 328 field->unit, field->unit_exponent,
329 field->report_size); 329 field->report_size *
330 field->report_count);
330 ret = 0; 331 ret = 0;
331 } else { 332 } else {
332 for (j = 0; j < field->maxusage; ++j) { 333 for (j = 0; j < field->maxusage; ++j) {
@@ -338,7 +339,8 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev,
338 i, report->id, 339 i, report->id,
339 field->unit, 340 field->unit,
340 field->unit_exponent, 341 field->unit_exponent,
341 field->report_size); 342 field->report_size *
343 field->report_count);
342 ret = 0; 344 ret = 0;
343 break; 345 break;
344 } 346 }
@@ -425,9 +427,10 @@ static int sensor_hub_raw_event(struct hid_device *hdev,
425 hid_dbg(hdev, "%d collection_index:%x hid:%x sz:%x\n", 427 hid_dbg(hdev, "%d collection_index:%x hid:%x sz:%x\n",
426 i, report->field[i]->usage->collection_index, 428 i, report->field[i]->usage->collection_index,
427 report->field[i]->usage->hid, 429 report->field[i]->usage->hid,
428 report->field[i]->report_size/8); 430 (report->field[i]->report_size *
429 431 report->field[i]->report_count)/8);
430 sz = report->field[i]->report_size/8; 432 sz = (report->field[i]->report_size *
433 report->field[i]->report_count)/8;
431 if (pdata->pending.status && pdata->pending.attr_usage_id == 434 if (pdata->pending.status && pdata->pending.attr_usage_id ==
432 report->field[i]->usage->hid) { 435 report->field[i]->usage->hid) {
433 hid_dbg(hdev, "data was pending ...\n"); 436 hid_dbg(hdev, "data was pending ...\n");