Skip to content
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

fix(video): avoid timeout during check for v4l2 device #347

Closed
wants to merge 1 commit into from

Conversation

fmoessbauer
Copy link
Member

At least on debian bookworm, the v4l2 devices are not managed by systemd (the udev rule does not add the systemd tag). By that, we cannot use systemd to wait for the device as this will always timeout. It is also not easily possible to check if a device is (or will be) managed by systemd. Hence, we simply check if the device is present. In this case, we do not add the systemd device dependency. In other cases, we add it as the device might be managed by systemd and show up later.

We also considered adding a udev rule to tag the devices, but this makes the mtda package less portable.

cc @bovi

At least on debian bookworm, the v4l2 devices are not managed by
systemd (the udev rule does not add the systemd tag). By that, we cannot
use systemd to wait for the device as this will always timeout.
It is also not easily possible to check if a device is (or will be)
managed by systemd. Hence, we simply check if the device is present. In
this case, we do not add the systemd device dependency. In other cases,
we add it as the device might be managed by systemd and show up later.

We also considered adding a udev rule to tag the devices, but this makes
the mtda package less portable.

Signed-off-by: Felix Moessbauer <[email protected]>
@chombourger
Copy link
Collaborator

I suppose the udev approach would involve a rule such as the following:

KERNEL=="video0", SYMLINK="video0", TAG+="systemd"

and have the drop-in use the following clauses:

[Unit]
BindsTo=dev-video0.device
After=dev-video0.device

if so, what are your concerns around portability?

@fmoessbauer
Copy link
Member Author

I suppose the udev approach would involve a rule such as the following:

KERNEL=="video0", SYMLINK="video0", TAG+="systemd"

In principle yes, but the /dev/video* device is not a symlink but the device itself. Maybe the following could work:

KERNEL=="video*", TAG+="systemd"

But I'm not sure how duplicated tags are handled. If that works, it could be a good solution. However, I'm unaware about why these devices are not managed by systemd in the first place, maybe there is a reason to it. How is it done on ubuntu? Do they have the udev rule?

@chombourger
Copy link
Collaborator

looking into this

@fmoessbauer
Copy link
Member Author

Closing in favor of #353

@fmoessbauer fmoessbauer closed this Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants