New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
displaylink: manually activate dlm.service #107294
Conversation
The shell script coming with the vendor-provided udev rule simply starts dlm.service (and sets up some symlinks), and stops dlm.service if that was the last card plugged in. On NixOS, some of the cat/grep/sed commands are not available, causing the script to fail. Turns out, the symlinks aren't needed at all. Archlinux ships their own script (https://aur.archlinux.org/cgit/aur.git/plain/udev.sh?h=displaylink), which only starts and stops dlm.service, depending on whether there's cards left or not. We can further optimize this by simply starting dlm.service on the first card, and not stopping it at all. Considering dlm won't get stopped if one of multiple cards is unplugged, it seems to handle disconnects.
So instead of rolling it the Arch way, we just start the dlm.service once a card is inserted? I will of course test this soon! |
The arch one might also work, but looking at the script itself, it really only starts dlm (and stops it later). The udev rule in this PR simply pulls in/starts I saw a bunch of errors when executing our script (or theirs), and fear this is due to things like IMHO, that udev rule oneliner is much cleaner, and we should point the maintainer of the AUR package to it, too. |
This is definitely the cleaner way to do this. One thing though - the |
From my understanding of the article, udev rules should match on specific events they care about ("adding the device", in our case), and the linked problem was mostly due to assumptions on a specific set of events. By now matching on IMHO, matching on the
The only case I could see how this might be incomplete would be if users manually unbind the device and stop dlm. On a manual |
@peterhoeg do you agree? Is this good to merge? |
Okay, let's get this in. The current udev rules also only did listen on add (and remove). |
@flokli sorry for not testing, Christmas holidays got me away from home :( But seems like a fine solution. But with this change, it should now work to hotplug a Displaylink device? |
Yes. We had the udev rule before, but it was just a shell script checking if a card is connected (in addition to the udev rule already doing that ;-)), that then started I asked someone to verify this works with a displaylink docking station. Not precisely that commit, but that commit cherry-picked to 20.09. |
Thanks for getting this done @flokli! |
I sent a backport PR in #107795. |
The shell script coming with the vendor-provided udev rule simply
starts dlm.service (and sets up some symlinks), and stops dlm.service if
that was the last card plugged in.
On NixOS, some of the cat/grep/sed commands are not available, causing
the script to fail.
Turns out, the symlinks aren't needed at all. Archlinux ships their own
script
(https://aur.archlinux.org/cgit/aur.git/plain/udev.sh?h=displaylink),
which only starts and stops dlm.service, depending on whether there's
cards left or not.
We can further optimize this by simply starting dlm.service on the first
card, and not stopping it at all. Considering dlm won't get stopped if
one of multiple cards is unplugged, it seems to handle disconnects.
Motivation for this change
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)