Re: Resource Temporarily Unavailable error when trying to read from the accelerator on a ThinkPad twist

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey Elad,

I read through the commit log for the hid-sensor-hub and noticed this commit:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/hid/hid-sensor-hub.c?id=af5666e0f76023d9c296016024297903a4c83108
It adds support for the ms surface but removes support for an STM
sensor hub, which matches your STM sensor hub product id.

Sorry I didn't catch this before. This probably explains the
regression you experienced when upgrading from 3.15-3.16.

I have attached a patch that fixes this deletion and ensures your
devices sensor hub is set up correctly. If the patch works you should
get continuous printing of new data from the iio device and new or
changing values from the in_accel_x_raw when moving your laptop.

I noticed your values were negative when you read from the
in_accel_x_raw. When I read from my device i get values in the range
of 0-65433. You might need some offset set as well but first test this
patch to add your device to the quirks list.

Thank you,
Reyad Attiyat


On Fri, Aug 22, 2014 at 6:44 AM, Elad Alfassa <elad@xxxxxxxxxxxxxxxxx> wrote:
> Hello Reyad!
>
> I've preformed the steps to enable the scan elements and the buffer,
> and when using `cat` on the character device I got some gibberish
> (looked like ���� /���).
>
> Here's the dmeg output: https://elad.fedorapeople.org/iio-debug/dmesg.txt
> and here's the rdesc file: https://elad.fedorapeople.org/iio-debug/rdesc.txt
>
> Furthermore, after preforming these steps, I tried to read the _raw files,
> [root@rincewind iio:device3]# cat in_accel_*raw
> -27
> 56
> -974
>
> According to the developer of iio-sensor-proxy the numbers should
> always be lower than 400, and as you can see one of the raw values is
> 974
>
> It seems that iio-sensor-proxy is getting EAGAIN when trying to read
> the data, but I can still cat the raw files.
> Examining the iio-sensor-proxy output it seems that it manages to read
> the sensor data ONCE and then gets EAGAIN in all the following read
> attempts.
>
> ** (process:2889): DEBUG: Found accel_3d at
> /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.5/2-1.5:1.0/0003:0483:91D1.0003/HID-SENSOR-200073.1.auto/iio:device3
> ** (process:2889): DEBUG: Found associated trigger at
> /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.5/2-1.5:1.0/0003:0483:91D1.0003/HID-SENSOR-200073.1.auto/trigger3
> ** (process:2889): DEBUG: Got type for in_accel_x: is signed: 1,
> bytes: 4, bits_used: 32, shift: 0, mask: 0x0, be: 0
> ** (process:2889): DEBUG: Got type for in_accel_y: is signed: 1,
> bytes: 4, bits_used: 32, shift: 0, mask: 0x0, be: 0
> ** (process:2889): DEBUG: Got type for in_accel_z: is signed: 1,
> bytes: 4, bits_used: 32, shift: 0, mask: 0x0, be: 0
> ** (process:2889): DEBUG: Built channel array for in_accel_x: is
> signed: 1, bytes: 4, bits_used: 32, shift: 0, mask: 0x0, be: 0
> ** (process:2889): DEBUG: Built channel array for in_accel_y: is
> signed: 1, bytes: 4, bits_used: 32, shift: 0, mask: 0x0, be: 0
> ** (process:2889): DEBUG: Built channel array for in_accel_z: is
> signed: 1, bytes: 4, bits_used: 32, shift: 0, mask: 0x0, be: 0
> ** (process:2889): DEBUG: Read from IIO: 18, -51, -976
> ** (process:2889): DEBUG: Found orientation: undefined, prev:undefined
>
> ** (process:2889): WARNING **: Couldn't read from device: Resource
> temporarily unavailable
> ** (process:2889): DEBUG: Found orientation: undefined, prev:undefined
>
> ** (process:2889): WARNING **: Couldn't read from device: Resource
> temporarily unavailable
> ** (process:2889): DEBUG: Found orientation: undefined, prev:undefined
> ^C
>
>
> While trying to figure out what's going on, I tried to `cat` the _raw
> files while iio-sensor-proxy was running, and I noticed that every
> time I `cat` them, iio-sensor-proxy can read the data too!
>
> So, we have two issues here:
> 1) The numbers returned from the raw file are "weird", as
> iio-sensor-proxy expects them to be under 400
> 2) When iio-sensor-proxy is running it can't read the data until I
> manually read the _raw files in a different terminal window, upon
> which iio-sensor-proxy suddenly gets the data too.
>
> I hope this helps debug the issue.
>
> Do you think it's a driver problem, or is it iio-sensor-proxy doing
> something wrong?
>
> --
> -Elad Alfassa.
From 08107dc33080c41fc8c0b8351df8c70e563535f3 Mon Sep 17 00:00:00 2001
From: Reyad Attiyat <reyad.attiyat@xxxxxxxxx>
Date: Fri, 22 Aug 2014 13:14:55 -0500
Subject: [PATCH] hid: hid-sensor-hub: Add support for STM sensor hub

Rename ID for STM sensor hub to match others.
Add sensor hub enum quirk, for STM device (0x91d1),
to enable proper bits in the USB HID report.

Signed-off-by: Reyad Attiyat <reyad.attiyat@xxxxxxxxx>
---
 drivers/hid/hid-ids.h        | 2 +-
 drivers/hid/hid-sensor-hub.c | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 25cd674..2025e96 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -463,7 +463,7 @@
 #define USB_DEVICE_ID_INTEL_HID_SENSOR_1	0x0a04
 
 #define USB_VENDOR_ID_STM_0             0x0483
-#define USB_DEVICE_ID_STM_HID_SENSOR    0x91d1
+#define USB_DEVICE_ID_STM_HID_SENSOR_0  0x91d1
 #define USB_DEVICE_ID_STM_HID_SENSOR_1  0x9100
 
 #define USB_VENDOR_ID_ION		0x15e4
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index e244e44..65c1bb8 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -720,6 +720,9 @@ static const struct hid_device_id sensor_hub_devices[] = {
 			USB_DEVICE_ID_MS_TYPE_COVER_2),
 			.driver_data = HID_SENSOR_HUB_ENUM_QUIRK},
 	{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, USB_VENDOR_ID_STM_0,
+			USB_DEVICE_ID_STM_HID_SENSOR_0),
+			.driver_data = HID_SENSOR_HUB_ENUM_QUIRK},
+	{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, USB_VENDOR_ID_STM_0,
 			USB_DEVICE_ID_STM_HID_SENSOR_1),
 			.driver_data = HID_SENSOR_HUB_ENUM_QUIRK},
 	{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, USB_VENDOR_ID_TEXAS_INSTRUMENTS,
-- 
1.9.3


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux