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

camera_sensor.sh not accurate when using Wireplumber and/or Pipewire. #44

Open
W-Floyd opened this issue Nov 3, 2022 · 4 comments
Open
Labels
bug Something isn't working scripts Something related to bundled scripts

Comments

@W-Floyd
Copy link
Owner

W-Floyd commented Nov 3, 2022

These processes will show as using the camera. This is likely going to be the case moving forward, especially under Wayland. This present a challenge, as we may instead need to check Pipewire for camera status instead.

@W-Floyd W-Floyd added bug Something isn't working scripts Something related to bundled scripts labels Nov 3, 2022
@dev-foo-bar
Copy link
Contributor

Stupid question - as far as I understand the fuser command it checks if the camera is used by a process.

Quote from the manpage

fuser displays the PIDs of processes using the specified files or file systems. 

To be honest, I have not so much experience with pipewire. But even with pipewire fuser should be a reliable source if the camera is in use or not. If I am wrong - please correct me. New knowledge is always welcome on my side :-)

@W-Floyd
Copy link
Owner Author

W-Floyd commented Nov 5, 2022

In my case, pipewire and wireplumber both are reported as using it even when the camera isn't actually in use.

@dev-foo-bar
Copy link
Contributor

dev-foo-bar commented Nov 5, 2022

Interesting - I run pipewire and I have not the issue - but to be honest, I am not very familiar with pipewire. Yesterday I had a video conference and the sensors works well. I use Arch Linux - and if I am correct you as well (acorrding to your config template :-))

@esenliyim
Copy link

esenliyim commented Nov 15, 2023

More than a year later...

fuser and lsof remain to be not very good for detecting whether or not the camera is in active use. fuser just gives a list of PIDs and nothing else, which is quite useless, but lsof might be usable.

I've been observing the output from lsof and as @W-Floyd said, wireplumb and pipewire are always there no matter what the camera is doing. Even if it's sitting idle without recording, those two are there. But when I start using the camera actively, on the browser or inside the Zoom desktop app or whatever, they appear as new processes in the lsof output AND they look different. They always appear like this:

image

One process as two lines in the output, one with mem as the file descriptor. Firefox does the same. Discord does the same. Maybe that can be used to detect that the camera is currently being used to capture video. Though I don't know what those mean exactly, so it might not be as useful as I wish.

Also, for some reason, Cheese doesn't show up on lsof even when it's actively using the camera. That means there are ways around lsof too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working scripts Something related to bundled scripts
Projects
None yet
Development

No branches or pull requests

3 participants