The base-mounted accelerometer on Chromebooks return values same as the
display when the lid angle is 180 degrees, instead of when the lid is
closed. To match userspace expectations we must further rotate the
existing accelerometer mounting matrix by 180 degrees around the X axis:
[[-1, 0, 0], [[ 1, 0, 0], [[-1, 0, 0],
[ 0, -1, 0], X [ 0, -1, 0], = [ 0, 1, 0],
[ 0, 0, -1]] [ 0, 0, -1]] [ 0, 0, 1]]
A previous commit lets us distinguish between the two cros-ec-accel
devices on these boards by their 'label' sysfs file. Add hwdb entries
that make base-mounted accelerometers use this correct matrix, and
display-mounted ones use the existing one.
Note that the cros-ec-accel drivers use 'label' only since Linux v6.0.
The old match strings are not removed to support older kernels, even
though they are only correct for the display-mounted sensor.
systemd-commit fea267f8c71d0edffee5ccbb806755fb626c5e29
Author: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Date: Thu Aug 18 18:24:05 2022 +0300
The IIO subsystem exposes a 'label' sysfs file to help userspace better
identify its devices [1]. Standardized labels include the sensor type
along with its location, including 'accel-base' and 'accel-display'.
Most Chrome OS boards have two accelerometers that are indistinguishable
except for this label (or a 'location' sysfs file before Linux v6.0),
and need different mounting matrix corrections based on their location.
Add a udev rule that matches hwdb entries using this label, so we can
correct both accelerometers on these devices with hwdb entries. The
existing rules and hwdb entries are not modified to keep potential
out-of-tree entries working, but new entries in this form will override
existing ones. Also add currently standardized labels to parse-hwdb.py.
[1] https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-iio
systemd-commit e2f25ae64889ea7fe8a7556ee5fba91bc2a0eab8
Author: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Date: Thu Aug 18 17:27:22 2022 +0300
In file included from udevadm-hwdb.c:26:
In function ‘freep’,
inlined from ‘adm_hwdb’ at udevadm-hwdb.c:624:38:
../../src/shared/util.h:289:9: warning: ‘free’ called on a pointer to an unallocated object ‘"/usr/etc/udev/hwdb.bin"’ [-Wfree-nonheap-object]
289 | free(*(void**) p);
| ^~~~~~~~~~~~~~~~~
../../src/shared/util.h:289:9: warning: ‘free’ called on a pointer to an unallocated object ‘"/usr/etc/udev/hwdb.bin"’ [-Wfree-nonheap-object]
On 32bit arches where time_t is defined as long int and where
sizeof(long)==sizeof(int), PRI_TIME is PRIu32 which is "u" and gcc warns about
ignoring the long part of the integer type. There is no problem besides the
warning.
Upcast time_t to 64bit and get rid of PRI_TIME and configure checks
udevadm-monitor.c: In function ‘print_device’:
udevadm-monitor.c:49:16: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 3 has type ‘__time_t’ {aka ‘long int’} [-Wformat=]
49 | printf("%-6s[%"PRI_TIME".%06ld] %-8s %s (%s)\n",
| ^~~~~~~~
50 | source,
51 | ts.tv_sec, ts.tv_nsec/1000,
| ~~~~~~~~~
| |
| __time_t {aka long int}
In file included from ../../src/shared/macro.h:26,
from udev.h:26,
from udevadm-monitor.c:35:
/usr/include/inttypes.h:104:19: note: format string is defined here
104 | # define PRIu32 "u"
On 32bit arches where time_t is defined as long int and where
sizeof(long)==sizeof(int), PRI_TIME is PRIu32 which is "u" and gcc warns about
ignoring the long part of the integer type. There is no problem besides the
warning.
Use "lu" in the above conditions and PRIu32 in all other 32bit time_t cases.
udevadm-monitor.c: In function ‘print_device’:
udevadm-monitor.c:49:16: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 3 has type ‘__time_t’ {aka ‘long int’} [-Wformat=]
49 | printf("%-6s[%"PRI_TIME".%06ld] %-8s %s (%s)\n",
| ^~~~~~~~
50 | source,
51 | ts.tv_sec, ts.tv_nsec/1000,
| ~~~~~~~~~
| |
| __time_t {aka long int}
In file included from ../../src/shared/macro.h:26,
from udev.h:26,
from udevadm-monitor.c:35:
/usr/include/inttypes.h:104:19: note: format string is defined here
104 | # define PRIu32 "u"
This condition may happen with version as 3.2.12-pre1 which would generate
udev-3.2.12-pre1 with length of 17 including the terminating 0, while
struct udev_ctrl.version is only 16 bytes
Merge up to commit 5674b74c4f99e433fd8e7242e9f16f6ddfece94c
- change @bindir@ to {{ROOTBINDIR}} in templates (better future tracking)
- keep rules/50-udev-default.rules as plain instead of template
- add
60-autosuspend.rules
60-fido-id.rules
70-camera.rules
70-memory.rules
81-net-dhcp.rules
From: Martin Pitt <martin.pitt@ubuntu.com>
Date: Fri, 17 Oct 2014 15:01:01 +0200
Subject: udev hwdb: Support shipping pre-compiled database in system images
In some cases it is preferable to ship system images with a pre-generated
binary hwdb database, to avoid having to build it at runtime, avoid shipping
the source hwdb files, or avoid storing large binary files in /etc.
So if hwdb.bin does not exist in /etc/udev/, fall back to looking for it in
UDEVLIBEXECDIR. This keeps the possibility to add files to /etc/udev/hwdb.d/
and re-generating the database which trumps the one in /usr/lib.
Add a new --usr flag to "udevadm hwdb --update" which puts the database
into UDEVLIBEXECDIR.
Adjust systemd-udev-hwdb-update.service to not generate the file in /etc if we
already have it in /usr.
Anto:
g-i-r support was removed in 2015 as part of removal of Gobject libudev
support, but the autoconf support wasn't removed but is dead.
Fixes: 252150e181 ("src/gudev: remove Gobject libudev support.")
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Alex Kiernan <alexk@zuma.ai>
Based on debian/patches/udev_conf_comments from the old udev package.
systemd-commit: f6de1b02fe703f57cceb59922fde17385e7c4510
Author: Michael Biebl <biebl@debian.org>
Date: Thu Jul 18 15:33:51 2013 +0200