502 Commits

Author SHA1 Message Date
Bastien Nocera
4b1fb8db28 main: Add Light sensors as a possible driver type
This means:
- reworking the driver callbacks so they can pass more than x/y/z
- handling sensors going (not just one single sensor anymore)
2015-03-05 18:04:57 +01:00
Bastien Nocera
5ac84a8ceb main: Make accelerometer one of a type of drivers 2015-03-05 17:38:19 +01:00
Bastien Nocera
4b873a049b rules: Auto-start iio-sensor-proxy for input accels too 2015-03-05 16:05:11 +01:00
Bastien Nocera
7ba7e4cbca main: Add test tool for orientations
Given an x/y/z, give out the orientation if it was previously undefined.
2015-03-05 10:47:07 +01:00
Bastien Nocera
a1b721ebf3 main: Separate out orientation code 2015-03-05 10:47:07 +01:00
Bastien Nocera
5c28fa9606 main: Add a fake accel to test the new input driver 2015-03-05 10:47:07 +01:00
Bastien Nocera
8bc50a306c main: Add support for input driver accelerometers 2015-03-05 10:47:07 +01:00
Bastien Nocera
fd4b7f7d65 main: Use D-Bus instead of uinput
Instead of exporting the orientation state using a combination of
uinput and udev, use D-Bus.
2015-03-05 10:47:07 +01:00
Bastien Nocera
186eb78298 main: Const'infy 2 strings in the buffered driver 2014-11-25 01:56:07 +01:00
Jan-Michael Brummer
d9854b312a main: Skip processing if the device returns EAGAIN
Skip process_scan() in case we are receiving EGAIN from read.
2014-11-25 01:50:38 +01:00
Jan-Michael Brummer
16c2635cd6 main: Fix compiling issues in buffered accelerometer 2014-11-25 01:49:14 +01:00
Bastien Nocera
748176bcee main: Fix memleak in buffer driver 2014-11-24 09:13:31 +01:00
Bastien Nocera
3f33643f95 main: Fix missing dev_path and dev_dir_path assignments 2014-11-24 09:12:34 +01:00
Bastien Nocera
742837303a main: Fix open() retval of buffer driver 2014-11-24 09:07:18 +01:00
Bastien Nocera
4a5fb99b34 README: Add more tested models
Though it's possible things have slightly regressed...
2014-11-20 05:41:00 +01:00
Bastien Nocera
348fc043e6 data: Correct path to binary in service file 2014-11-20 05:39:51 +01:00
Bastien Nocera
43f5f0194a build: Install helper in sbin, not bin 2014-11-20 05:37:51 +01:00
Bastien Nocera
0a21b826e3 main: Add quirk for the Onda v975w to the poll driver 2014-11-20 05:32:42 +01:00
Bastien Nocera
6a63023a7f main: Move quirk into driver
This is a common quirk for hid based sensors it seems.
2014-11-20 05:32:42 +01:00
Bastien Nocera
ea1ba3807d main: Fix unchanging accel values in polling driver
g_udev_device_get_sysfs_attr_as_int() uses libudev internally, which
does caching. This means that the values wouldn't have changed past
the first read.
2014-11-20 00:20:59 +01:00
Bastien Nocera
126b758323 main: Fix scale handling in IIO drivers
Our code expects 256 to corresponds to 1G acceleration.
IIO drivers give out a value that, when multiplied by the scale, gives
an acceleration in m/s².

Do the math to transform the IIO sensor's value to the scale we use
internally.
2014-11-20 00:17:10 +01:00
Bastien Nocera
f1adea43f4 main: Fix open() for the polling driver 2014-11-19 21:25:57 +01:00
Bastien Nocera
0fedce7124 main: Fix warning on 32-bit
error: format ‘%lX’ expects argument of type ‘long unsigned int’, but argument 9 has type ‘guint64’
2014-11-19 20:55:25 +01:00
Bastien Nocera
cf07e42524 main: Add driver for polling IIO 2014-11-19 20:34:05 +01:00
Bastien Nocera
e93182c62e main: Split IIO code into its own driver
And implement a driver scheme.
2014-11-19 20:06:49 +01:00
Bastien Nocera
07897adea3 build: Autotoolify 2014-11-19 17:03:45 +01:00
Bastien Nocera
62efef9fff build: Add autotools required files 2014-11-19 17:00:43 +01:00
Valentin David
b4627ffe03 main: Fix a double free when uinput setup fails 2014-11-19 00:24:50 +01:00
Bastien Nocera
74f38135be main: Fix compilation warning
io-sensor-proxy.c: In function ‘process_scan’:
iio-sensor-proxy.c:790:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘ssize_t’ [-Wformat=]
    g_debug ("Not enough data to read (read_size: %d scan_size: %d)", data.read_size, (int) or_data->scan_size);
    ^
2014-11-19 00:18:26 +01:00
Bastien Nocera
893e7c2b8f main: Scale readings so they're normalised
By applying the scale to the accelerometer, we should be able to
handle accelerometers that use more than 1G as the max reading.

Closes: #4
2014-11-19 00:16:58 +01:00
Bastien Nocera
c8fb9e16f8 main: Set trigger before enabling the buffer
As advised in:
http://article.gmane.org/gmane.linux.kernel.iio/14742
2014-11-19 00:03:34 +01:00
Bastien Nocera
e03bae26b6 main: Fix incorrect error output
Before:
Couldn't read from device: Unknown error -11
After:
Couldn't read from device: Resource temporarily unavailable
2014-08-11 12:46:15 +02:00
Cosimo Cecchi
4fff41f15d Add more debug output 2014-07-26 16:31:57 +02:00
Bastien Nocera
c17a58a33b README: Tested on the Yoga 2 Pro
Thanks to Cosimo.
2014-07-26 15:51:54 +02:00
Bastien Nocera
86aa318a2d README: Add note about kernel bugs 2014-07-26 15:51:36 +02:00
Bastien Nocera
768342cdd4 build: Add dist target 2014-07-23 22:40:15 +02:00
Bastien Nocera
3d1ba0ec3f main: Increase the threshold necessary for switching to portrait
20 degrees made a slightly tilted (laptop, raise one knee) switch
to portrait mode too quickly.
2014-07-23 18:43:46 +02:00
Bastien Nocera
6e07a398ba main: Fix warning if permissions are missing 2014-07-23 18:08:29 +02:00
Bastien Nocera
c4732ba875 README: Add MS Surface Pro as a tested device 2014-07-23 12:36:03 +02:00
Bastien Nocera
db78d1a121 main: Really exit when the sensor disappears
When the sensor disappears, we only stopped polling the accelerometer
for new values. This wasn't enough to actually exit cleanly.
2014-07-21 13:08:13 +02:00
Bastien Nocera
2df0afc5a1 main: Fix possible crash when sensor disappears
When the sensor disappears, we get a read error within the
prepare_output() callback. But as we assign the retval of that function
to an OrientationUp value, we lose the signedness and never see the
error.

Instead, assign the retval to an integer that we can check correctly,
and only assign to an OrientationUp value once we've checked for errors.
2014-07-21 13:04:46 +02:00
Bastien Nocera
f5f2d20f7e main: Remove dead debug code 2014-07-10 00:12:06 +02:00
Bastien Nocera
6ea3d7a5ba main: Replace printf warning by g_warning 2014-07-10 00:12:06 +02:00
Bastien Nocera
6e909754cc main: Setup ring buffer and trigger on startup
This shouldn't be something we need to do for every loop, so
only do that on startup, and tear down on exit.
2014-07-10 00:12:06 +02:00
Bastien Nocera
b9b455ec12 main: Comment unused debug function
string_to_orientation() is unused for now.
2014-07-10 00:12:06 +02:00
Bastien Nocera
9d7eca4470 main: Don't create the device path in the loop
There's no need to do this in each and every loop, the device
path doesn't change from one loop to another.
2014-07-10 00:12:06 +02:00
Bastien Nocera
625b439789 main: Scan size never changes, so calculate it once
As the channels never change, the scan size never changes either,
so calculate it at the beginning of the program, and reuse that
value.
2014-07-10 00:12:06 +02:00
Bastien Nocera
e868255342 main: Make read timeout longer
We're targetting to have the device change orientation after being
in the same position for 800 msecs by default, to avoid mid-flight
changes.

So we don't need to check more often than every 800 msecs. Shave
about 100 msecs for the processing of the information.
2014-07-10 00:12:06 +02:00
hadess
4c1d4f3932 README: Update
Add requirements and debug information
2014-07-09 16:29:37 +02:00
Bastien Nocera
8c14265a68 build: Add gitignore file 2014-07-09 15:57:46 +02:00