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

m720-config script fails to run #9

Open
regul4rj0hn opened this issue Oct 18, 2021 · 5 comments
Open

m720-config script fails to run #9

regul4rj0hn opened this issue Oct 18, 2021 · 5 comments

Comments

@regul4rj0hn
Copy link

regul4rj0hn commented Oct 18, 2021

Thanks for creating this repo. I was trying to get the Logitech M720 buttons and gestures to work on Arch Linux (kernel: 15.14.12) and installed this package, which successfully installed, but I'm having some issues when I try to run the script. Here's the output:

% m720-config
DeviceInfo(path='/dev/hidraw0', vendor_id='046D', product_id='C52B', serial='', release=None, manufacturer=None, product=None, interface=2, driver='logitech-djreceiver', bus_id=3, isDevice=None)
open DeviceInfo(path='/dev/hidraw0', vendor_id='046D', product_id='C52B', serial='', release=None, manufacturer=None, product=None, interface=2, driver='logitech-djreceiver', bus_id=3, isDevice=None)
Traceback (most recent call last):
  File "/home/mark/.local/lib/python3.9/site-packages/logitech_receiver/receiver.py", line 281, in open
    handle = _base.open_path(device_info.path)
  File "/home/mark/.local/lib/python3.9/site-packages/logitech_receiver/base.py", line 166, in open_path
    return _hid.open_path(path)
  File "/home/mark/.local/lib/python3.9/site-packages/hidapi/udev.py", line 297, in open_path
    return _os.open(device_path, _os.O_RDWR | _os.O_SYNC)
PermissionError: [Errno 13] Permission denied: '/dev/hidraw0'
Traceback (most recent call last):
  File "/home/mark/.local/bin/m720-config", line 33, in <module>
    sys.exit(load_entry_point('m720-config', 'console_scripts', 'm720-config')())
  File "/home/mark/pkg/logitech-m720-config/m720_config/__init__.py", line 149, in main
    buttons = SpecialKeysMseButtons ()
  File "/home/mark/pkg/logitech-m720-config/m720_config/__init__.py", line 29, in __init__
    self.receiver = Receiver.open (device_info)
  File "/home/mark/.local/lib/python3.9/site-packages/logitech_receiver/receiver.py", line 281, in open
    handle = _base.open_path(device_info.path)
  File "/home/mark/.local/lib/python3.9/site-packages/logitech_receiver/base.py", line 166, in open_path
    return _hid.open_path(path)
  File "/home/mark/.local/lib/python3.9/site-packages/hidapi/udev.py", line 297, in open_path
    return _os.open(device_path, _os.O_RDWR | _os.O_SYNC)
PermissionError: [Errno 13] Permission denied: '/dev/hidraw0'

Seeing those permission errors I figured that the script was being prevented from touching /dev so I ran as root, which was also unsuccessful:

% sudo m720-config
[sudo] password for mark: 
Traceback (most recent call last):
  File "/home/mark/.local/bin/m720-config", line 33, in <module>
    sys.exit(load_entry_point('m720-config', 'console_scripts', 'm720-config')())
  File "/home/mark/.local/bin/m720-config", line 22, in importlib_load_entry_point
    for entry_point in distribution(dist_name).entry_points
  File "/usr/lib/python3.9/importlib/metadata.py", line 524, in distribution
    return Distribution.from_name(distribution_name)
  File "/usr/lib/python3.9/importlib/metadata.py", line 187, in from_name
    raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: m720-config

That appears to not be able to find the m720-config package.
Any help is greatly appreciated!

@fin-ger
Copy link
Owner

fin-ger commented Oct 18, 2021

Looks like you're running into this problem

@fin-ger
Copy link
Owner

fin-ger commented Oct 18, 2021

Also, do not run this script as root. It is not necessary and generally a bad idea to run wild scripts from the internet as root...

@regul4rj0hn
Copy link
Author

regul4rj0hn commented Oct 18, 2021

Thanks a lot for the prompt reply.

Looks like you're running into this problem

Sorry I failed to include the fact that I had already tried both rebooting the system and removing and re-inserting the receiver. I still get permission denied.

Also, do not run this script as root. It is not necessary and generally a bad idea to run wild scripts from the internet as root...

Thanks, I know. This is a sandbox environment.

Any other thoughts appreciated.

@regul4rj0hn
Copy link
Author

regul4rj0hn commented Oct 18, 2021

Ok, I figured it out. It was indeed a problem with the receiver device. This is what I did:
The plugdev group wasn't present on my system (thus not assigned to my user). To fix that:

% sudo groupadd plugdev
% sudo usermod -a -G plugdev mark
% sudo udevadm control --reload-rules

Install ltunify to manage the Logitech Unifying Receiver from the AUR:

% pacaur -S ltunify
% ltunify list
Devices count: 1
Connected devices:
idx=1   Mouse   M720 Triathlon

Unplug receiver and plug back in. After that, m720-config run successfully.

You may close the issue, unless you want to mention some of this on the readme/docs. Thanks for the help, man!

@fin-ger
Copy link
Owner

fin-ger commented Oct 19, 2021

You may close the issue, unless you want to mention some of this on the readme/docs.

Yeah, sure. Will add this to the readme. Thanks for the solution!

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

No branches or pull requests

2 participants