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.
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
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)
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)
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); \
^~~~
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...
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.
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.
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
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
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