Skip to content

fix: re-enable add udev rule functionality #125

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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,22 +269,13 @@ def main():
"--add-udev-rule",
action="store_true",
dest="udev",
help="Add udev rule to access BlinkSticks without root permissions. Must be run as root.",
help="Add udev rule to access BlinkSticks without root permissions. Must be run as root e.g. `sudo $(which blinkstick) --add-udev-rule`.",
)

parser.add_option_group(group)

(options, args) = parser.parse_args()

if options.serial is None:
sticks = find_all()
else:
sticks = [find_by_serial(options.serial)]

if len(sticks) == 0:
print("BlinkStick with serial number " + options.backend + " not found...")
return 64

# Global action
if options.udev:

Expand All @@ -307,6 +298,15 @@ def main():
print("Reboot your computer for changes to take effect")
return 0

if options.serial is None:
sticks = find_all()
else:
sticks = [find_by_serial(options.serial)]

if len(sticks) == 0:
print("BlinkStick with serial number " + options.serial + " not found...")
return 64

for stick in sticks:
if options.inverse:
stick.set_inverse(True)
Expand Down