fin-ger / logitech-m720-config

A configuration script for Logitech M720 that remaps mouse buttons (Linux)
GNU General Public License v3.0
88 stars 8 forks source link

m720-config script fails to run #9

Open regul4rj0hn opened 3 years ago

regul4rj0hn commented 3 years ago

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 commented 3 years ago

Looks like you're running into this problem

fin-ger commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 2 years ago

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!