Commit Graph

11003 Commits

Author SHA1 Message Date
Boian Bonev
9f366b943d
hwdb: Add Chromebook accel orientation quirks based on sysfs label
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
2022-09-22 01:28:34 +03:00
Boian Bonev
fa741e87a8
udev: hwdb: Match iio sensors based on their label
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
2022-09-22 01:17:17 +03:00
Boian Bonev
e4bbbc8e36
Do not free a static string
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]
2022-09-22 00:51:17 +03:00
Boian Bonev
ba2cff9c54
Prepare a pre-release of 3.2.12-pre3 2022-06-14 02:44:42 +03:00
Boian Bonev
91066e4a66
Merge pull request #233 from bbonev/time32warn
Avoid warning on 32bit
2022-06-12 12:26:25 +03:00
Boian Bonev
da0ca7eb21
Avoid warning on 32bit
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"
2022-06-11 17:43:28 +03:00
Boian Bonev
2c969a36db
Revert "Avoid warning on 32bit"
This reverts commit b1de2b70bc.
2022-06-11 17:42:31 +03:00
Boian Bonev
b1de2b70bc
Avoid warning on 32bit
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"
2022-06-10 04:03:00 +03:00
Boian Bonev
dd6b068a56
Prepare a pre-release of 3.2.12-pre2 2022-06-10 02:09:47 +03:00
Boian Bonev
3211655fd8
Merge pull request #232 from bbonev/buffers
Fix problems detected by fortified builds
2022-06-09 20:55:13 +03:00
Boian Bonev
54d0df107e
Use snprintf (for posterity)
Also fix code style of sizeof()

Suggested-by: Arsen Arsenović <arsen@aarsen.me>
2022-06-09 20:08:33 +03:00
Boian Bonev
20f79fab0f
Add error checking
lseek and ftruncate may fail; do not continue the processing if that happens

Suggested-by: Arsen Arsenović <arsen@aarsen.me>
2022-06-09 20:01:17 +03:00
Boian Bonev
fe9bac1092
Change prepare to never return an unlocked fd
- fix coding style while at it
- add checks and fail in case lockf failed

Suggested-by: Arsen Arsenović <arsen@aarsen.me>
2022-06-09 19:50:12 +03:00
Boian Bonev
9bffb8a8cc
Do not try to lock a negative fd 2022-06-09 19:24:05 +03:00
Boian Bonev
07afd28617
Mark as safe to ignore
Suggested-by: Arsen Arsenović <arsen@aarsen.me>
2022-06-09 19:16:07 +03:00
Boian Bonev
74b5af522e
Fix code style
Suggested-by: Arsen Arsenović <arsen@aarsen.me>
2022-06-09 19:03:34 +03:00
Boian Bonev
1833f76239
Increase the path buffer and fail on truncation
Add a check to avoid creating files with path that may be truncated
2022-06-08 08:28:31 +03:00
Boian Bonev
aaa76e5173
Kill warnings for unused result
ftruncate and lockf are declared with attribute ‘warn_unused_result’.
Kill the warning and add a TODO comment.
2022-06-08 08:24:40 +03:00
Boian Bonev
ed95424f74
Refuse to generate truncated USB modalias
In case of invalid input the resulting modalias would exceed the buffer and be
truncated. Add checks to avoid generating truncated modalias.
2022-06-08 08:20:08 +03:00
Boian Bonev
9f99dba5a0
Avoid buffer overrun with long version strings
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
2022-06-08 08:13:23 +03:00
Boian Bonev
49222bcc9c
Build and install hwdb.7 man page 2022-06-08 02:41:44 +03:00
Boian Bonev
f566c4ae32
Merge the generated man page 2022-06-06 16:30:50 +03:00
Boian Bonev
8bf47b7dfb
Prepare a pre-release of 3.2.12-pre1 2022-06-06 16:14:03 +03:00
Boian Bonev
639f6b25d3
Merge pull request #219 from bbonev/hwdb
Merge hwdb from systemd
2022-06-06 12:47:46 +03:00
Boian Bonev
e3e483ced5
Merge pull request #220 from bbonev/rules
Merge suitable rules changes from systemd
2022-06-06 12:47:30 +03:00
Boian Bonev
cd61841483
Merge pull request #223 from bbonev/precompiled_hwdb
Precompiled hwdb
2022-05-31 20:35:00 +03:00
Boian Bonev
68fd2f55c9
Merge pull request #221 from bbonev/hwdb.7
Hwdb.7
2022-05-31 17:50:31 +03:00
Boian Bonev
247724da45
Merge suitable rules changes from systemd
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
2022-05-26 19:31:43 +03:00
Boian Bonev
b11e438970
udev hwdb: Support shipping pre-compiled database in system images
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:
2022-05-26 19:25:56 +03:00
Boian Bonev
ce9d0aadfb
Use reproducible man page generation 2022-05-26 19:16:16 +03:00
Boian Bonev
322765fe74
Copy the missing man page from systemd
The respective systemd commits are not listed
2022-05-26 19:16:16 +03:00
Boian Bonev
95ab90723d
Keep the reproducible generated man pages in git 2022-05-26 19:16:16 +03:00
Boian Bonev
f2128f5e49
Rework custom man page template from systemd
- remove the non-reproducible top.comment section from the generated man pages
- do not change the other aspects of man page contents
2022-05-26 19:16:13 +03:00
Boian Bonev
6309427c50
Merge hwdb from systemd
All systemd's hwdb changes up to commit 5674b74c4f99e433fd8e7242e9f16f6ddfece94c
2022-05-26 11:18:11 +03:00
Boian Bonev
cf2012867a
Merge pull request #231 from akiernan/remove-g-i-r
build: Remove dead g-i-r configuration
2022-05-24 00:24:24 +05:30
Alex Kiernan
ccbe41e3b8 build: Remove dead g-i-r configuration
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>
2022-05-20 18:19:15 +01:00
Boian Bonev
31089dc3de
Merge pull request #225 from oreo639/udev_dir
udev: add udev_dir as synonym of udevdir
2022-04-09 18:10:58 +03:00
Boian Bonev
381d129a64
Merge pull request #222 from bbonev/warn
Fix warnings
2022-04-09 18:05:40 +03:00
Boian Bonev
f0e5a20064
Merge pull request #224 from lu-zero/update-build-docs
Add the BUILD instructions for Gentoo
2022-04-09 18:04:24 +03:00
oreo639
9d9e802396 udev: add udev_dir as synonym of udevdir 2022-04-09 05:39:56 -07:00
Luca Barbato
796cd3e4db Add the BUILD instructions for Gentoo 2022-04-09 08:38:01 +02:00
Boian Bonev
f8eb1d45e7
Document the requirement of a modern cc 2022-04-09 04:11:31 +03:00
Boian Bonev
dce2732c37
Fix warnings 2022-04-06 06:55:28 +03:00
Boian Bonev
db3e14bc61
Add the missing xsltproc deps 2022-04-06 05:37:52 +03:00
Boian Bonev
eb4911d8c5
Add note to udev.conf that changes to that file require a rebuild of the initramfs
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
2022-04-06 04:17:59 +03:00
Boian Bonev
985b9c0768
Fix spelling 2022-04-06 03:47:47 +03:00
Boian Bonev
d27c310316
Fix spelling 2022-04-06 03:47:40 +03:00
Boian Bonev
84af6532cd
Fix spelling 2022-04-06 03:47:31 +03:00
Boian Bonev
a250f6488e
Fix spelling 2022-04-06 03:47:20 +03:00
Boian Bonev
94d06a2f55
Fix spelling 2022-04-06 03:47:09 +03:00