hadess / iio-sensor-proxy

IIO accelerometer sensor to input device proxy
197 stars 64 forks source link

Fix compile errors with gcc8 and fix the sensors on Asus T100HA laptops not working #222

Closed jwrdegoede closed 6 years ago

jwrdegoede commented 6 years ago

Hi Bastien,

I've been working today on getting the sensors on Asus T100HA devices to work properly, the second commit in this set is the result of this.

When I went to test my patch I would not compile, so the first patch in this set fixes compiling with gcc8.

Regards,

Hans

jwrdegoede commented 6 years ago

Hmm, I'm testing some sensor stuff on another device now (Lenovo Miix 320), the sensor there only does polling, but it does have a sampling_frequency attribute (without a prefix) and that one defaults to 1 (Hz) which is somewhat slow. I wonder if we should do something about that too?

jwrdegoede commented 6 years ago

Yeah, the 1Hz really is no good:

[root@localhost iio:device0]# time cat inaccel?_raw -1 59 -20

real 0m11,932s user 0m0,000s sys 0m0,012s

So the reads while polling block until the device has gotten a sample, which is really really slow at 10Hz, since iio-sensor-proxy uses blocking reads while reading the sysfs files this blocks all of iio-sensor-proxy and anything making requests to iio-sensor-proxy is also waiting this long. E.g. monitor-sensor takes about 20 second before it prints: === Has accelerometer (orientation: right-up) === No ambient light sensor`

At 10Hz it is better (still not great though) : [root@localhost iio:device0]# time cat inaccel?_raw 0 57 -25

real 0m1,438s user 0m0,002s sys 0m0,007s

I'm preparing a new version of the sample_freq patch to fix this.

jwrdegoede commented 6 years ago

Ok I just pushed a new version (weird that github does not automatically adds a comment for this).

Let me know what you think of the new version.

jwrdegoede commented 6 years ago

Ok, I just pushed a new version adding the exact compile error from gcc (and dropping the .) and adding a #define for the 10 Hz minimum sample-freq.

hadess commented 6 years ago

one which actually expects arguments, causing it to throw erros like these:

typo, "errors"

hadess commented 6 years ago

Looks good to merge after those.

jwrdegoede commented 6 years ago

On 17-04-18 12:41, hadess wrote:

typo, "errors"

Fixed.

jwrdegoede commented 6 years ago

I was too quick :) Also added the / Hz / comment now.

hadess commented 6 years ago

As usual, thanks! :)