who is using my camera?
paulirish opened this issue · comments
lsof | grep -i "AppleCamera"
lsof | grep "USBVDC"
lsof | grep -i "iSight"
will get you process ID.
need some function to find which app owns it.
ez pz
lsof | grep -w "AppleCamera\|USBVDC\|iSight" | awk '{printf $2"\n"}' | xargs ps
This will output the COMMAND
path using ps.
When I run imagesnap -l
, the camera name is "FaceTime HD Camera". Maybe there is a way to search this without knowing the names. Maybe?
+1 Nice!
Hmm. That's the same for me, even when the camera is not in use, the file descriptors seems to be open by Chrome. I suppose that's the intended behavior, will see if I find a better solution to match an actual active process.
TBH i'd be OK with dealing with the multiple results.
at least for now.
does this sort of design make sense to yall? someone wanna toss into a function and PR?
$ camerausedby
Checking to see who is using the iSight camera…
Results:
PID TT STAT TIME COMMAND
1796 ?? S 216:57.68 /Applications/Google Chrome.app/Contents/MacOS/Google Chrome -psn_0_53261
2090 ?? S 0:03.19 /Applications/Photo Booth.app/Contents/MacOS/Photo Booth
96675 ?? S 12:37.15 /opt/homebrew-cask/Caskroom/google-chrome-canary/latest/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary
Like this?
camerausedby() {
echo "Checking to see who is using the iSight camera… 📷"
usedby=$(lsof | grep -w "AppleCamera\|USBVDC\|iSight" | awk '{printf $2"\n"}' | xargs ps)
echo -e "Results:\n$usedby"
}
lookin hot. i just pushed it.
thx yall!!
On Thu, Apr 9, 2015 at 10:40 AM, Vincenzo Prignano <notifications@github.com
wrote:
Like this?
camerausedby() {
echo "Checking to see who is using the iSight camera…"
usedby=$(lsof | grep -w "AppleCamera|USBVDC|iSight" | awk '{printf $2"\n"}' | xargs ps)
echo -e "Results:\n$usedby"
}—
Reply to this email directly or view it on GitHub
#39 (comment).