Commit Graph

10973 Commits

Author SHA1 Message Date
Boian Bonev
dacff83d87
Export dummies for
- udev_device_has_current_tag
 - udev_device_get_current_tags_list_entry

since the current eudev device database does not support the concept of
current tags
2023-08-11 23:14:02 +00:00
Boian Bonev
7d2123ead5
Bump udev version to 251 2023-08-11 22:08:27 +00:00
Boian Bonev
ffc1b77871
Update as per IRC discussion 2023-05-30 16:16:33 +00:00
Boian Bonev
2703baf556
Include unaligned.h in dist 2023-05-16 15:08:56 +00:00
Boian Bonev
490b90da5a
Merge branch 'master' of github.com:eudev-project/eudev 2023-05-16 14:18:09 +00:00
Boian Bonev
ee12a0afd7
Prepare a release of 3.2.12 2023-05-16 14:17:36 +00:00
Boian Bonev
39979ddf46
Merge pull request #247 from cockroach/master
Fix compile-time issue on very old kernels
2023-04-06 21:40:29 +03:00
Stefan Ott
09b536e0b9 Fix compile-time issue on very old kernels
Kernel versions prior to 3.4 did not have V4L2_CAP_DEVICE_CAPS and
compiling against such a kernel will fail.

This patch introduces a version check and makes eudev fall back to
v2cap.capabilities on these kernels.
2023-04-05 18:20:37 +02:00
Boian Bonev
9bcbc131a6
Merge pull request #240 from bbonev/missing-tools
Missing tools
2023-02-18 02:29:39 +02:00
Boian Bonev
8bc3169766
Merge pull request #246 from omnivagant/udev-7-mention-split-usr
man: udev.7, mention /usr/lib with split-usr
2023-02-18 02:28:48 +02:00
omni
0cf14fbdce man: udev.7, mention /usr/lib with split-usr 2023-02-04 13:39:20 +00:00
Boian Bonev
c2a042eb1d
Allocate udev struct 2022-11-13 03:59:04 +02:00
Ralph Ronnquist
0d94554d9e Rewrite using current API 2022-11-13 03:42:29 +02:00
Boian Bonev
b359e32d07
WIP not compilable fido_id 2022-10-04 17:39:05 +03:00
Boian Bonev
6836c0e9a2
Rework dmi_memory_id from systemd 2022-10-04 17:38:38 +03:00
Boian Bonev
99b0381c85
Merge pull request #238 from bbonev/fix-free-nonheap-object
Do not free a static string
2022-10-03 14:36:17 +03:00
Boian Bonev
bebf651fbf
Merge pull request #239 from bbonev/sd-pr-24353
Systemd PR 24353
2022-09-22 21:48:14 +03:00
Boian Bonev
1c10b23250
Do not initialize dynamic string with static value
- the value is unused anyways
- thanks to Arsen for spotting this

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 01:45:31 +03:00
Boian Bonev
189f05e874
Revert "Do not free a static string"
This reverts commit e4bbbc8e36.
2022-09-22 01:43:19 +03:00
Boian Bonev
152456e741
udev: hwdb: Add rules to match cros-ec-accel by 'location' sysfs file
The cros-ec-accel devices report their mounting location by the 'label'
sysfs file only since Linux v6.0. With earlier kernels, a nonstandard
'location' file reports this, but slightly differently (lid instead of
display) [1].

Add udev rules to import the correct hwdb entries based on this
'location' file for cros-ec-accel devices, so that the base-mounted
accel matrix has the correct value for older kernels as well.

[1] https://kernel.org/doc/Documentation/ABI/testing/sysfs-bus-iio-cros-ec

systemd-commit ac3c031e3862e3d74e64b108e0bafcaefa71c792
Author: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Date:   Thu Aug 18 19:56:13 2022 +0300
2022-09-22 01:29:51 +03:00
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