Commit Graph

155 Commits

Author SHA1 Message Date
Johannes Nixdorf
917ae648f6 78-sound-card.rules: Import ID_PATH early
Pipewire requires ID_PATH to use the same device names as with systemd's
udev. Some rules, such as the ones in asahi-audio [1] use those names, and
fail if they don't match [2].

On systemd's udev this is instead imported in 71-seat.rules, which we don't
have.

[1]: https://github.com/AsahiLinux/asahi-audio
[2]: https://github.com/AsahiLinux/asahi-audio/issues/16

Signed-off-by: Johannes Nixdorf <mixi@shadowice.org>
2023-12-22 10:27:08 +01:00
Matthias Schiffer
944803d916 rules: add mtd/by-name symlinks
Add persistent symlinks for MTD devices like SPI-NOR flash, based on the
partition names specified on the cmdline, in a Device Tree, or by other
MTD partitioning parser drivers. Using the persistent name can be
preferable to using the numbered /dev/mtdX device, as the latter can
change depending on probe order or when partitioning has changed.
2023-10-17 11:55:55 +02: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
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
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
Dermot Bradley
4e9b7892da rules/50-udev-default.rules: add PTP entry for Hyper-V/Azure
udev rules: add rule to create /dev/ptp_hyperv

As for the KVM case, necessary for network cards with
PTP devices when running a guest on HyperV

systemd-commit: 32e868f058da8b90add00b2958c516241c532b70
Author: Luca Boccassi <luca.boccassi@microsoft.com>
Date:   Fri Feb 26 10:25:31 2021 +0000
2022-03-13 19:37:05 +00:00
Yann Dirson
9a240b197b
Revert bad 78-sound-card.rules update causing path_id skip
The following device properly got assigned ID_PATH with eudev 3.2.1,
but does not get it any more with recent versions:

P: /devices/platform/rt5651-sound/sound/card0
E: DEVPATH=/devices/platform/rt5651-sound/sound/card0
E: SOUND_FORM_FACTOR=internal
E: SOUND_INITIALIZED=1
E: SUBSYSTEM=sound
E: USEC_INITIALIZED=507638688065

This results in pulseaudio giving a non-stable card name by using a
device number.

I tracked the problem to commit
47367bc4df, which changed (without
explaining why it does so) the rules for "internal" sound cards,
notably preventing `IMPORT{builtin}="path_id"` from being reached.

Signed-off-by: Yann Dirson <yann@blade-group.com>
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2021-01-14 12:52:26 -05:00
Ethan Sommer
79f7650b59 switch make usage to be POSIX compatible
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2020-04-22 18:04:20 -04:00
Marius Bakke
941d20bce3
rules/64-btrfs.rules: Expand @bindir@ to the absolute directory name.
This fixes #182 by ensuring @bindir@ is fully expanded at installation
time.  See "Installation Directory Variables" in the GNU Autoconf
manual, in particular the note about AC_CONFIG_FILES.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2020-04-10 09:26:02 -04:00
Anthony G. Basile
96c5552c52 rules/64-btrfs.rules: substitue @bindir@
See https://bugs.gentoo.org/666892

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2018-09-23 21:03:33 -04:00
Anthony G. Basile
a8ffcd1b98 rules/50-udev-default.rules: fix issue 160
Thanks Joel Barrios (darkshram).

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2018-09-21 08:27:23 -04:00
Anthony G. Basile
9727d157d0 rules/Makefile.am: install 60-input-id.rules and 70-joystick.rules
Commit bb070c1 forgot to include the installation of 60-input-id.rules
and 70-joystick.rules via the Makefile.  Without this, commits dba4728
and 5df0137 leave the system without any useable input devices.
2018-02-18 04:13:42 -05:00
Marcus Folkesson
bb070c154e rules: update
Update to match systemd v235-1952-gba3182b91

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2018-02-20 07:36:20 -05:00
Anthony G. Basile
99e12e394f rules: restore input SUBSYSTEM rule in default
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2017-09-04 18:29:33 -04:00
Anthony G. Basile
47367bc4df rules: update
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2017-09-03 13:20:33 -04:00
Ioan-Adrian Ratiu
2edc3cf879 configure.ac: add option to disable mtd_probe
FTL is not necessarily present on all kernels so it's useful to
have an option to disable this.

Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
2016-12-21 16:30:44 +02:00
Bastien Nocera
c61e6c912b udev: Add rules for accelerometer orientation quirks
This commit adds a rules file to extract the properties from hwdb
to set on i2c IIO devices. This is used to set the ACCEL_MOUNT_MATRIX
property on IIO devices, to be consumed by iio-sensor-proxy or
equivalent daemon.

The hwdb file contains documentation on how to write quirks. Note
however that mount information is usually exported in:
- the device-tree for ARM devices
- the ACPI DSDT for Intel-compatible devices
but currently not extracted by the kernel.

Also note that some devices have the framebuffer rotation that changes
between the bootloader and the main system, which might mean that the
accelerometer is then wrongly oriented. This is a missing feature in the
i915 kernel driver: https://bugs.freedesktop.org/show_bug.cgi?id=94894
which needs to be fixed, and won't require quirks.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2016-12-11 10:55:12 -05:00
Anthony G. Basile
48e435dcfd hwdb, rules: update
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2016-12-11 10:52:02 -05:00
Anthony G. Basile
b226ddfc1b rules: update
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2016-11-23 20:00:48 -05:00
Anthony G. Basile
5ad7d7f9e7 rules: update
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2016-05-25 14:09:04 -04:00
Anthony G. Basile
31ce9f89a5 rules: update
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2016-05-10 07:59:30 -04:00
Anthony G. Basile
3677c2e3ae hwdb and rules: import changes from upstream. 2015-10-12 06:43:45 -04:00
Ian Stakenvicius
305f0eef4d Forward-ported network rule-generator code from eudev-1.10 2015-09-25 12:38:07 -04:00
Richard Yao
b38f3aaba1 Solid state drives should use noop IO elevator
It is often suggested that users set noop on SSDs and it turns out that
udev can do this for users.

Setting noop disables the IO priorization and IO reordering logic inside
the kernel, but leaves front/back merging in place. This reduction in
overhead should increase the number of requests sent to solid state
media to the maximum possible,which is said to improve performance on
SSDs. Unfortunately, few benchmarks try real world work loads with a
clear cache to measure the actual difference.

The benchmarks conducted by Daniel Nashed cleared the cache. They favor
noop, although the workload seems somewhat unrealistic:

http://blog.nashcom.de/nashcomblog.nsf/dx/linux-io-performance-tweek.htm

The BFQ developers' benchmarks on SSDs appear to account for both. They
show noop as being far better than CFQ and second only to BFQ, which is
out of tree:

https://lwn.net/Articles/600366/

In addition, I have experienced lockup-like effects on ext4 on an OCZ
Vertex 2 SSD with the discard mount option enabled when recursively
unlinking a subdirectory path that contains millions of files. The
system was useless for hours. Setting noop allowed the unlink to finish
in minutes. This is because the reordering from CFQ interleaved the
TRIM command with write IOs, effectively putting barriers between them
because because TRIM is a non-queued command prior to SATA 3.1.

A good default should perform well in general and have the property that
poor performance in the worst case scenarios is minimized. The
previous examples contradict CFQ's ability to achieve that on solid
state media.

I believe that we should implement a udev rule to set noop on solid
state media by default. It should be said that Milan Broz wrote it
first, although there is only one way to write this rule in a manner
consistent with the codebase:

http://permalink.gmane.org/gmane.linux.kernel.device-mapper.dm-crypt/6045

It should be said that this will be a regression for those that rely on
the "Block IO Controller" cgroup because it is only supported by CFQ
when CONFIG_CFQ_GROUP_IOSCHED=y. My experience as a ZoL developer is
that very few users rely on this behavior and consequently, I believe
that the benefit from enabling this far outweighs the harm to the few
that need it. Those that do need it should be able to disable this rule
themselves. Container management software that expects the Block IO
Controller to be supported should be modified to enable CFQ explicitly
if it does not already do that.

This has been tested against both a SATA mechanical drive and a SATA
solid state drive. It changes the elevator to noop on the solid state
drive, but does not touch it on the mechanical drive.

Signed-off-by: Richard Yao <ryao@gentoo.org>
2015-08-29 15:21:44 -04:00
Kay Sievers
97fbeb0b45 rules: block - add dasd to whitelist
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-07-20 07:52:06 -04:00
Cédric Delmas
224a128b0a Process cciss devices
Do not skip the persistent storage rules for cciss devices

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-07-20 07:50:17 -04:00
Bastien Nocera
e172381913 It's moved to the iio-sensor-proxy D-Bus service.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-07-20 07:45:23 -04:00
Peter Hutterer
a5cb5f0b4c Revert "hwdb: add a touchpad hwdb"
The main purpose of this hwdb was to tag touchpads that have the physical
trackstick buttons wired to the touchpad (Lenovo Carbon X1 3rd, Lenovo *50
series).  This hwdb is not required on kernels 4.0 and above, the kernel now
re-routes button presses through the trackstick's device node. Userspace does
not need to do anything.

See kernel commit cdd9dc195916ef5644cfac079094c3c1d1616e4c.

This reverts commit 001a247324b44c0e0b8fdba41a6fc66e7465b8b6.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-07-20 07:28:05 -04:00
Kay Sievers
b5ac92fb85 rules: remove all power management from udev
It is not udev's task to apply any of these setting that way, or
from udev rules files. Things need to be sortet out in the kernel,
or explicit whitelist can possibly be added to the hardware database.
Until that is sorted out, and general agreement, udev is not
willing to maintain any such lists or power management settings
in general.

"Thanks for digging this out! I thought my Kinesis keyboard got broken
and ordered a new one, only to find out that the new one doesn't work
as well. I'm not sure whether we should start collecting a blacklist
of keyboards which don't work with USB autosuspend, or rather a
whitelist? Or revert this wholesale?"

  https://github.com/systemd/systemd/issues/340

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-07-20 07:20:01 -04:00
Alex Crawford
73c2d3cd6d rules: re-add cciss rules
The original commit (1aff206) doesn't explain why these were removed.
This adds them back since they are in fact needed.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-07-20 07:17:36 -04:00
Alex Crawford
03638dd242 rules: whitelist xvd* devices
Xen disks need to be whitelisted as well.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-07-20 07:17:13 -04:00
Ed Swierk
19d2ceea61 Add /dev/xvd* to 60-persistent-storage whitelist Without this, systemd-udevd does not create persistent storage symlinks for xen block devices.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-07-20 07:16:26 -04:00
David Mohr
be3ceedb88 udev: Bring back persistant storage symlinks for bcache
https://bugs.debian.org/787367

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-07-20 07:15:57 -04:00
Tom Gundersen
0617e636ab rules: restore block watch after CHANGE events
When processing an event, the watch is disabled, make sure it is restorted after
a CHANGE event has been processed.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-07-20 07:14:41 -04:00
Tom Gundersen
ebcaf4b310 rules: fix typo in block watch rule
The intention was to turn this rule from using a blacklist to a whitelist, but
there was a stray '!'.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-07-20 07:13:39 -04:00
Anthony G. Basile
2eba1b8055 80-net-name-slot.rules: restored for issue #117.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-06-02 10:10:45 -04:00
Adam Goode
ed2fa53c4a rules: Add more firewire properties for sound, to be closer to USB and PCI
USB and PCI soundcards have a nice set of ID_* properties. It would
be handy for firewire soundcards to have the same.

Note that this removes the explicit setting of ID_ID in the firewire
conditional. Because we are now setting ID_SERIAL, ID_ID will come
from later in the file.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-03 13:58:03 -04:00
Adam Goode
b743095184 rules: Don't use ALSA card id in ID_ID
The ALSA id sysattr is generated by the sound subsystem and is not
a stable identifier. It is generated though some string manipulation
then made unique if there is a conflict. This means that it is
enumeration-dependent and shouldn't be used for ID_ID.

If ID_ID is supposed to be system-unique, it is not already since
for firewire it is generated from the guid and there are broken
firewire devices that have duplicate guids across devices.

This is tracked for PulseAudio at
https://bugs.freedesktop.org/show_bug.cgi?id=90129.

This is essentially a revert of systemd
ed1b2d9fc7.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-03 13:57:26 -04:00
Zbigniew Jędrzejewski-Szmek
37668c896a rules: finish incomplete rename
Fixup for 51c0c2869845a058268d54c3111d55d0dd485704.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12 13:14:46 -04:00
Matthew Garrett
32610f8a5f rules: fix tests for removable state
We only care about whether our direct parent is removable, not whether any
further points up the tree are - the kernel will take care of policy for
those itself. This enables autosuspend on devices where the root hub reports
that its removable state is unknown.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12 13:13:28 -04:00
Anthony G. Basile
c5bf58cafc udev: builtin-keyboard: add support for EVDEV_ABS_*
Parse properties in the form
EVDEV_ABS_00="<min>:<max>:<res>:<fuzz>:<flat>"

and apply them to the kernel device. Future processes that open that device
will see the updated EV_ABS range.

This is particularly useful for touchpads that don't provide a resolution in
the kernel driver but can be fixed up through hwdb entries (e.g. bcm5974).

All values in the property are optional, e.g. a string of "::45" is valid to
set the resolution to 45.

The order intentionally orders resolution before fuzz and flat despite it
being the last element in the absinfo struct. The use-case for setting
fuzz/flat is almost non-existent, resolution is probably the most common case
we'll need.

To avoid multiple hwdb invocations for the same device, replace the
hwdb "keyboard:" prefix with "evdev:" and drop the separate 60-keyboard.rules
file. The new 60-evdev.rules is called for all event nodes
anyway, we don't need a separate rules file and second callout to the hwdb
builtin.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12 13:09:45 -04:00
Harald Hoyer
288fc0a1fb 50-udev-default.rules: don't run anything but REMOVE_CMD on remove
we don't want to run usb_id and input_id on ACTION=="remove"

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12 11:22:21 -04:00
Mantas Mikulėnas
8f2f61f0a3 rules: storage - support MemoryStick (non-Pro) cards
These are handled by a different driver than MemoryStick Pro.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12 11:21:14 -04:00
Kay Sievers
c0823e9525 rules: storage - whitelist partitioned MS & MMC devices
On Mon, Mar 23, 2015 at 8:55 AM, Mantas Mikulėnas <grawity@gmail.com> wrote:
> On Tue, Mar 17, 2015 at 11:50 PM, Kay Sievers <kay@vrfy.org> wrote:
>> On Tue, Mar 17, 2015 at 5:00 PM, Mantas Mikulėnas <grawity@gmail.com>
>> wrote:
>> > Accidentally dropped in 1aff20687f4868575.
>> > ---
>> >  rules/60-persistent-storage.rules | 2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> > +KERNEL!="loop*|mmcblk[0-9]*|mspblk[0-9]*|nvme*|sd*|sr*|vd*",
>> > GOTO="persistent_storage_end"
>>
>> We can't do that, we need to ignore the mmc*rpmb devices:
>>
>> http://cgit.freedesktop.org/systemd/systemd/commit/?id=b87b01cf83947f467f3c46d9831cd67955fc46b9
>>
>> Maybe "mmcblk*[0-9]" will work?
>
> Yeah, that would probably work (the names are like mmcblk0p1 etc.)

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12 11:20:15 -04:00
Tom Gundersen
bf6e9fab7b rules: storage - don't apply rules to remove events
This line was accidentally lost in 52346b5f5424.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12 11:19:21 -04:00
David Herrmann
7457718859 rules: avoid 'device/' accesses
We should never access parents, as the sysfs hierarchy is in no way
stable. Use KERNELS== etc. to match on a parent, then access it via
$attr{} (which accesses the matching device, not the current device).

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12 11:18:38 -04:00
David Herrmann
d8e2e4c3a4 rules: fix input-name for keyboard rules
We match on the evdev node, but only the parent has a "name" attribute.
Use $attr{device/name} to access it.

This is borked since 2013, I wonder how that ever worked? Maybe this will
suddenly fix all the DMI-based key detections.

Thanks to Peter Hutterer for catching this!

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12 11:18:11 -04:00
Kay Sievers
a45a9a1c32 rules: keyboard - prefix "atkbd" match strings like we prefix the "name" strings
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18 17:06:01 -04:00
Anthony G. Basile
73c6fdf901 rules: remove unsed net rules
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18 17:05:36 -04:00
Kay Sievers
bf856b7c02 rules: keyboard - remove platform from comments + prefix "atkbd" match strings like we prefix the "name" strings
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18 16:21:02 -04:00