Last active
September 10, 2024 13:37
-
-
Save antonmry/8bf2d07db75df538c385bfa1cd6d5cf2 to your computer and use it in GitHub Desktop.
This is script to auto on/off a Logitech light when the webcam is on/off in Mac. It requires hidapitester
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>litra-auto-on</string> | |
<key>ProgramArguments</key> | |
<array><string>/Library/LaunchDaemons/litra-auto-on.sh</string></array> | |
<key>RunAtLoad</key> | |
<true/> | |
</dict> | |
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# Download both files and https://github.com/todbot/hidapitester to /Library/LaunchDaemons/ | |
# Execute the following commands to launch it on login | |
# sudo chown root:wheel /Library/LaunchDaemons/litra-auto-on.plist | |
# sudo chmod o-w /Library/LaunchDaemons/litra-auto-on.plist | |
# sudo launchctl load -w /Library/LaunchDaemons/litra-auto-on.plist | |
# For test it: | |
# launchctl start litra-auto-on | |
# tail -f /var/log/system.log | |
# Use 046D/C900 for older models | |
model="046D/C901" | |
# Change to your own path | |
hidapitester="/Library/LaunchDaemons/hidapitester" | |
log stream --predicate 'subsystem contains "com.apple.UVCExtension" and composedMessage contains "Post PowerLog"' | while read LOGLINE | |
do | |
[[ "${LOGLINE}" == *"On;"* ]] && eval "$hidapitester --vidpid $model --open --length 20 --send-output 0x11,0xff,0x04,0x1c,0x01" | |
[[ "${LOGLINE}" == *"Off;"* ]] && eval "$hidapitester --vidpid $model --open --length 20 --send-output 0x11,0xff,0x04,0x1c" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I enjoyed the feature in G-Hub but unfortunately G-Hub also caused lots of problems with my Yeti Mic. https://www.reddit.com/r/LogitechG/comments/oypw43/logitech_ghub_update_breaks_blue_yeti_mic/
The version in https://gist.github.com/antonmry/8bf2d07db75df538c385bfa1cd6d5cf2?permalink_comment_id=4723193#gistcomment-4723193 worked well for me, except that it would turn on whenever my phone came near my computer (i.e. the continuity camera logs triggered the light to turn on). This was the script I have that is working well. Note the addition of
bundleNames
: