Commit Graph

10999 Commits

Author SHA1 Message Date
Boian Bonev
5262448fd9
Ensure that standard file descriptors are open
- this will avoid unwillingly using fd in the 0..2 range
- closes: #185
2023-10-03 22:41:28 +03:00
Boian Bonev
231c23fbbc
Tabs to spaces 2023-10-03 20:54:58 +03:00
Boian Bonev
c5bae0b656
Merge pull request #253 from bbonev/bump251
Add missing API from 247
2023-10-03 19:41:39 +03:00
Boian Bonev
2e4dd05900
Merge pull request #265 from vivien-consider-dropping-github/master
More wording fixes for the manual page for udev
2023-10-01 20:53:06 +03:00
Vivien Kraus
89a68e7c7e Clarify the /etc/udev/hwdb.d file override with respect to UDEV_HWDB_PATH
Overriding a file in /etc/udev/hwdb.d also hides the files with that
name in UDEV_HWDB_PATH.
2023-10-01 19:51:23 +02:00
Vivien Kraus
672cbb5742 Remove references to /run/udev/hwdb.d
This directory never seemed to exist. The wording is very similar to
that of the Rules Files section, so it is possible that the same text
was copied and pasted by mistake. The HWDB never looked for files in
/run.

Having a non-volatile index of volatile files would probably not be
useful.
2023-10-01 19:50:37 +02:00
Boian Bonev
02a2afffc1
Improve wording
Generate udevadm.8 from udevadm.xml
2023-09-30 22:35:38 +00:00
Boian Bonev
218489052f
Improve wording and restore lines lost in merges
Generate udev.7 from udev.xml
2023-09-30 22:29:22 +00:00
Boian Bonev
805c07a07b
Merge pull request #262 from vivien-consider-dropping-github/master
Dynamically get the udevadm hwdb files with a path variable
2023-10-01 00:45:45 +03:00
Vivien Kraus
92ab29e3d5 fixup! Dynamically get the udevadm hwdb files with a path variable 2023-09-30 23:40:24 +02:00
Boian Bonev
060dc0ffaf
Merge branch 'master' into master 2023-10-01 00:26:08 +03:00
Boian Bonev
0c8f0021a4
Merge pull request #263 from vivien-consider-dropping-github/udevadm-hwdb-update-output
Add a generic --output argument to udevadm hwdb
2023-10-01 00:21:12 +03:00
Boian Bonev
701d83f686
Merge branch 'master' into udevadm-hwdb-update-output 2023-10-01 00:16:38 +03:00
Boian Bonev
a3ee57f010
Merge pull request #264 from vivien-consider-dropping-github/hwdb-bin-file-environment
Let libudev find hwdb.bin under UDEV_HWDB_BIN
2023-10-01 00:09:44 +03:00
Boian Bonev
5f98fb38c1
Merge branch 'master' into hwdb-bin-file-environment 2023-10-01 00:04:32 +03:00
Vivien Kraus
65e17b2f2f Dynamically get the udevadm hwdb files with a path variable
Introduce UDEV_HWDB_PATH, containing a colon-separated path with hwdb
files in it. The whole path is searched, in addition to the system
locations, when searching for hwdb files.

Due to how conf_files_list_strv is implemented, as a thin wrapper
around the internal function, it is easy to also implement a variant
accepting a search path in the same way. Since the internal function
expects an allocated array of allocated strings, the path scanning is
done in 2 steps, to first get the array length, and then duplicate the
items. It is not possible to use strtok(_r) here because it would work
for only 1 pass.

* src/shared/conf-files.c (conf_files_list_follow_path): New function.
(conf_files_list_strv_path): Use it here.
* src/shared/conf-files.h: Export the signature for the _path variant.
* src/udev/udevadm-hwdb.c (list_conf_file_path): New function
replacing conf_file_dirs.
(help): Document the search path for hwdb files.
(adm_hwdb): Use list_conf_file_path and conf_files_list_strv_path.
* man/udevadm.xml: Mention UDEV_HWDB_PATH.
* man/udev.xml: Same.
* man/udevadm.8: Regenerate.
* man/udev.7: Same.
2023-09-30 19:40:17 +02:00
Vivien Kraus
1eca0ef6c4 Add a generic --output argument to udevadm hwdb
Instead of always writing /etc/udev/hwdb.bin or UDEV_LIBEXEC_DIR
/hwdb.bin, let the user specify a full file name.

* src/udev/udevadm-hwdb.c (adm_hwdb): New option "output". Construct
hwdb_bin when processing options, and prepend root after processing
options.
* man/udev.xml: Mention --output.
* man/udevadm.xml: Document --output.
* man/udev.7: Regenerate.
* man/udevadm.8: Same.
2023-09-30 19:38:30 +02:00
Vivien Kraus
c7da117e5c Let libudev find hwdb.bin under UDEV_HWDB_BIN
* src/libudev/libudev-hwdb.c (get_hwdb_bin_paths): New function,
replacing hwdb_bin_paths.
(struct udev_hwdb): New bin_paths field.
(udev_hwdb_new): Initialize it with get_hwdb_bin_paths.
(udev_hwdb_validate): Use the bin_paths field to find hwdb.bin.
(udev_hwdb_unref): Free the bin_paths field.
* src/libudev/libudev.h: Warn about UDEV_HWDB_BIN.
* man/udev.xml: Mention run-time UDEV_HWDB_BIN.
* man/udev.7: Re-generate.
2023-09-30 19:36:55 +02:00
Boian Bonev
19aa81d9bf
Regenerate according to 0cf14fb and e5e4013 2023-09-30 16:55:44 +00:00
Boian Bonev
e5e4013cb7
Move the changes from udev.7 to udev.xml
Commit 0cf14fb changed only the generated udev.7 without touching the
source file udev.xml
2023-09-30 16:52:12 +00:00
Boian Bonev
072d94137f
Merge pull request #257 from bbonev/issue256
Fix := not preventing further assignments to RUN
2023-09-30 19:18:50 +03:00
Boian Bonev
0d86dd9a2a
Merge pull request #260 from bbonev/usrlocal
Add /usr/local/lib/udev/rules.d
2023-09-12 00:10:06 +02:00
Boian Bonev
298ef249e3
Add /usr/local/lib/udev/rules.d
Closes #259
2023-09-11 19:15:17 +03:00
Boian Bonev
f49af0b03b
Fix := not preventing further assignments to RUN
Closes #256

Suggested by: Aksel Lunde Aase
2023-08-31 23:46:56 +00:00
NaofumiHonda
b9cc389aab
Clear sysattr cache if a null pointer is passed (#255)
* Clear sysattr cache if a null pointer is passed

* remove tabs
2023-08-21 18:17:45 +03:00
Boian Bonev
df220edbc5
bump version to 3.2.14 2023-08-11 23:16:10 +00:00
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