Commit Graph

306 Commits

Author SHA1 Message Date
Luís Ferreira
f14d26d14c accel-location: add helper functions for ACCEL_LOCATION udev property 2019-05-02 09:34:07 +02:00
Daniel Drake
25cb8f3f17 mount-matrix: Read mount matrix from sysfs
If we don't have an ACCEL_MOUNT_MATRIX property for this device,
then check if there is a mount matrix available in sysfs.
Some kernel drivers export the mount matrix there, e.g. st_accel.

This fixes an issue where the screen was automatically rotated to
an incorrect orientation on Acer Veriton Z4660G/Z6860G/A890.
2019-03-21 08:55:12 +01:00
Daniel Drake
83875cc4e9 mount-matrix: move setup to a helper function
The logic to parse the mount matrix from udev is duplicated in 3
places. Move it to a common helper function.
2019-03-21 08:55:12 +01:00
Bastien Nocera
43fb8be70b iio: More debug in process_scan_1() 2019-03-16 12:26:01 +01:00
Bastien Nocera
22c48ccf85 README: Add ASUS T100Chi to the supported list (#254) 2019-01-16 10:33:18 +01:00
Bastien Nocera
bb35319f6c test: Add test for a mount matrix with an ignored axis 2018-10-18 19:46:42 +02:00
Bastien Nocera
e31de5f50a mount-matrix: Throw error if the mount matrix is invalid
If all the members of an axis are zero, that means that axis would be
ignored, which is never something we want. Consider this an invalid
matrix and return FALSE when that happens.

Closes: #177
2018-10-18 19:46:42 +02:00
Victor Toso
f71b609c70 monitor-sensor: Clear GVariant after gdbus call
Fix the small leak:

80 bytes in 2 blocks are definitely lost in loss record 810 of 1,096
   at 0x4C2EBAB: malloc (vg_replace_malloc.c:299)
   by 0x568F435: g_malloc (in /usr/lib64/libglib-2.0.so.0.5600.3)
   by 0x56A7056: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.5600.3)
   by 0x56C6701: ??? (in /usr/lib64/libglib-2.0.so.0.5600.3)
   by 0x56C334B: g_variant_builder_end (in /usr/lib64/libglib-2.0.so.0.5600.3)
   by 0x56C4A40: ??? (in /usr/lib64/libglib-2.0.so.0.5600.3)
   by 0x56C4EA1: g_variant_new_va (in /usr/lib64/libglib-2.0.so.0.5600.3)
   by 0x56C4FFA: g_variant_new (in /usr/lib64/libglib-2.0.so.0.5600.3)
   by 0x4EFB37D: ??? (in /usr/lib64/libgio-2.0.so.0.5600.3)
   by 0x4F00BC9: ??? (in /usr/lib64/libgio-2.0.so.0.5600.3)
   by 0x4F0CEF6: ??? (in /usr/lib64/libgio-2.0.so.0.5600.3)
   by 0x4F0E327: g_dbus_proxy_call_sync (in /usr/lib64/libgio-2.0.so.0.5600.3)
2018-10-18 19:31:35 +02:00
Victor Toso
dd5ef07f98 monitor-sensor: Clear GVariantDict after usage
Fix the following leak:

4,436 (792 direct, 3,644 indirect) bytes in 9 blocks are definitely lost in loss record 1,103 of 1,104
   at 0x4C2EBAB: malloc (vg_replace_malloc.c:299)
   by 0x568F435: g_malloc (in /usr/lib64/libglib-2.0.so.0.5600.3)
   by 0x56A7056: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.5600.3)
   by 0x56779E1: g_hash_table_new_full (in /usr/lib64/libglib-2.0.so.0.5600.3)
   by 0x56C56CC: g_variant_dict_init (in /usr/lib64/libglib-2.0.so.0.5600.3)
   by 0x400DDF: properties_changed (monitor-sensor.c:25)
2018-10-18 19:31:35 +02:00
Bastien Nocera
9e061b93bb monitor-sensor: Don't use assertion for errors
Otherwise automated bug reporting tools will fill up our issue tracker.

Closes: #240
2018-10-10 17:10:08 +02:00
Bastien Nocera
701ba61a13 accel: Fix gcc warning and double-free
Don't free a const char *

src/drv-input-accel.c: In function ‘input_accel_close’:
glib-2.0/glib/gmem.h:121:18: warning: passing argument 1 of ‘g_free’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
       (destroy) (_ptr);                                                        \
                  ^~~~
2018-10-10 17:09:07 +02:00
Bastien Nocera
bf0803201b 2.5 2018-10-09 10:22:56 +02:00
Bastien Nocera
5fc5b76fec README: Add reference to yet another kernel bug 2018-10-09 10:15:33 +02:00
Ayman Bagabas
3c17674a65 README.md: Huawei Matebook X Pro sensors work fine. 2018-10-09 09:58:06 +02:00
Bastien Nocera
afe1f6c7f3 iio: Fix indentation 2018-10-09 09:55:08 +02:00
Bastien Nocera
7424113cfc iio: Also set a scale for unsigned channels
Avoids the default value being used when a scale is present.

Closes: #238
2018-10-09 09:55:08 +02:00
Bastien Nocera
d7725e8b3a iio: Always set the scale
When calling process_scan_1(), make sure to always set the scale to 1.0
so it always has a default value.
2018-10-09 09:55:08 +02:00
Bastien Nocera
af44746c96 iio-buffer-utils: Add more debug to some utility functions 2018-05-14 07:01:37 +02:00
Bastien Nocera
6cdc1b5971 build: Fix -Wdouble-promotion warnings
Closes: #226
2018-05-14 07:00:46 +02:00
Bastien Nocera
f4cd8e803b data: Make filesystem access strict
We don't need write access to /etc, so block it.
2018-05-04 16:11:07 +02:00
Bastien Nocera
e608d2c70f build: Re-add srcdir != builddir support
Now that gtk-doc is fixed.

See https://bugzilla.gnome.org/show_bug.cgi?id=771359
2018-05-04 16:11:07 +02:00
Bastien Nocera
99e42d3aff fake-input-accelerometer: Use unused vid/pid
0x00/0x00 is a fine VID/PID, we don't actually need any fake data.
2018-05-04 16:11:07 +02:00
Bastien Nocera
3132518436 light: Make fake light sensor driver work on desktops
Rather than attach to a Lid Switch that's only available on laptops,
attach it to the power button, which we're much more likely to find on
any machine.

This also fixes the logic of the conditional which would exit when it
found a lid switch...
2018-05-04 16:11:07 +02:00
Hans de Goede
5828b05b0c iio-buffer-utils: Make sure sampling_frequency is 10Hz or more
Add a new iio_fixup_sampling_frequency() helper to iio-buffer-utils.c and
call this for all iio devices. iio_fixup_sampling_frequency() makes sure that
devices with *sampling_frequency attributes are sampling at 10Hz or more.

This fixes 2 problems:

1) Some buffered devices default their sampling_frequency to 0Hz and then
never produce any readings. This fixes e.g. the sensors on Asus T100HA
2-in-1s not working.

2) Some polled devices default to 1Hz and wait for a fresh sample before
returning from sysfs *_raw reads, blocking all of iio-sensor-proxy for
multiple seconds, this fixes e.g. rotation being detected up to 10 seconds
later then the actual rotating of the device on a Lenovo Miix 320.
2018-04-17 13:00:47 +02:00
Hans de Goede
761314c230 all: Fix "error: cast between incompatible function types" errors with gcc8
gcc8 does not like it when casting from a function with no arguments to one
which actually expects arguments, causing it to throw errors like these:

drv-fake-compass.c: In function ‘first_values’:
drv-fake-compass.c:66:51: error: cast between incompatible function types from ‘gboolean (*)(void)’ {aka ‘int (*)(void)’} to ‘gboolean (*)(void *)’ {aka ‘int (*)(void *)’} [-Werror=cast-function-type]
  drv_data->timeout_id = g_timeout_add_seconds (1, (GSourceFunc) compass_changed, NULL);
                                                   ^

This fixes this.
2018-04-17 13:00:47 +02:00
RussianNeuroMancer
6f322963ee README: Lenovo IdeaTab Miix2 8 is supported (#217)
Ambient sensor and accelerometer of Lenovo IdeaTab Miix2 8 works without issues.
2018-03-09 15:46:18 +01:00
Enno Boland
30c3fb9b65 README.md: Lenovo Yoga 520 works nicely too. (#206) 2018-01-10 16:20:11 +01:00
Bastien Nocera
7dad6c74b9 README: Mention that iio-sensor-proxy isn't GNOME specific
I use GNOME, so I wrote the integration code in GNOME. KDE, XFCE,
Mate, Cinnamon, i3, etc. developers are welcome to do the same.
2017-12-17 18:47:20 +01:00
Bastien Nocera
d801e3cf91 README: Add Cube Mix Plus to the tested list
Closes: #203
2017-12-06 00:35:38 +01:00
Bastien Nocera
d5e2c24d21 2.4 2017-11-02 19:17:32 +01:00
Bastien Nocera
9d8861b2be build: Fix distcheck in data/
Commit 2a2f5c5 broke distcheck, as it did not add the input file
net.hadess.SensorProxy.conf.in to the tarball.
2017-11-02 19:17:32 +01:00
Bastien Nocera
4bf3b38a59 iio: Fix 32-bit unaligned helper
0640bf0 added helpers to fetch unaligned memory, but didn't take
the offset to the data location into account, reading from
the header instead.

Closes: #195
2017-10-24 13:46:29 +02:00
Bastien Nocera
d1c06920ab README: Add Lenovo Yoga 710-11ISK to the test devices
Closes: #197
2017-10-24 10:44:39 +02:00
Bastien Nocera
393c1139dd iio: Use unaligned access helpers to access buffer values
So as to avoid unaligned access warnings on ARM, or unsigned values be
interpreted as signed.

Closes: #191
2017-10-11 18:24:03 +02:00
Bastien Nocera
0640bf01a6 iio: Add helper to get unaligned 32-bit integers 2017-10-11 18:23:23 +02:00
Bastien Nocera
70da85b8c3 Revert "iio-buffer-utils: Fix cast-align warnings on ARM"
This was causing unsigned buffer values to be read as signed.

This reverts commit ebc348abfe.
2017-10-11 18:22:44 +02:00
Bastien Nocera
ef83ad2c66 README: Fix link to hid-sensor-trigger race bug fix
The original link was to a temporary merge branch.
2017-10-10 13:59:00 +02:00
Bastien Nocera
64aacae439 accel: Fallback if NAME property isn't available
The PS3 Sixaxis controller motion sensor doesn't have a NAME assigned to
it, get the model instead so we print *something*.
2017-10-09 16:28:33 +02:00
Bastien Nocera
565b36ab56 README: Add Dell XPS 9365 to the tested devices
See #190
2017-10-09 00:07:56 +02:00
Frederic Crozat
2a2f5c5c3b data: fix permissions when geoclue runs with a different user (#185)
Geoclue can be configured to use another user than geoclue.
2017-09-22 13:31:44 +02:00
Bastien Nocera
b67414f78e 2.3 2017-09-20 18:39:03 +02:00
Bastien Nocera
8e994daa3b iio-buffer-utils: Print error when reading from device fails
Rather than just "Failed to read float from...", also print the
errno so can start taking guesses at what the problem is.
2017-09-06 10:21:52 +02:00
Bastien Nocera
401d59e54b accel: Ignore accelerometers that are part of a joypad
This will avoid having a PlayStation 3 or 4 joypad control your
laptop or tablet's display orientation.

This code requires a newer gudev.
2017-08-31 18:09:09 +02:00
Bastien Nocera
91123ec21f fake-input-accelerometer: Shush GCC warnings
fake-input-accelerometer.c: In function 'send_uinput_event':
fake-input-accelerometer.c:90:2: error: ignoring return value of 'write', declared with attribute warn_unused_result [-Werror=unused-result]
  write (data->uinput, &ev, sizeof(ev));
  ^
fake-input-accelerometer.c:94:2: error: ignoring return value of 'write', declared with attribute warn_unused_result [-Werror=unused-result]
  write (data->uinput, &ev, sizeof(ev));
  ^
fake-input-accelerometer.c:98:2: error: ignoring return value of 'write', declared with attribute warn_unused_result [-Werror=unused-result]
  write (data->uinput, &ev, sizeof(ev));
  ^
fake-input-accelerometer.c:104:2: error: ignoring return value of 'write', declared with attribute warn_unused_result [-Werror=unused-result]
  write (data->uinput, &ev, sizeof(ev));
  ^
2017-08-17 01:13:53 +02:00
Bastien Nocera
ebc348abfe iio-buffer-utils: Fix cast-align warnings on ARM
iio-buffer-utils.c: In function 'process_scan_1':
iio-buffer-utils.c:495:20: error: cast increases required alignment of target type [-Werror=cast-align]
     guint32 val = *(guint32 *) (data + buffer_data->channels[k]->location);
                    ^
iio-buffer-utils.c:501:19: error: cast increases required alignment of target type [-Werror=cast-align]
     gint32 val = *(gint32 *) (data + buffer_data->channels[k]->location);
                   ^

Looks like there's no need to cast.

Closes: #113
2017-08-17 01:10:10 +02:00
Bastien Nocera
e69580583b iio-buffer-utils: Indentation changes 2017-08-17 01:09:55 +02:00
Bastien Nocera
d0ced55668 iio-buffer-utils: Don't throw warnings on ENOENT
As we don't return when the file doesn't exist, don't print a warning
either, as this would pollute logs and throw people off when debugging
real problems.

Closes: #180
2017-08-16 16:52:23 +02:00
Bastien Nocera
20c41c1126 Revert "main: Add artificial delay before starting daemon"
This reverts commit 5468452f7a as
the problem was root-caused and fixed in the upstream kernel.

Please see README for the fix' details.

Closes: #116
2017-08-16 16:44:50 +02:00
Bastien Nocera
02dfc189c0 README: Add Asus UX330UA to the tested devices
Closes: #155
2017-06-12 15:38:14 +02:00
Bastien Nocera
72db85b1be README: Fix linux-iio ML thread link 2017-06-12 14:30:47 +02:00