PixlOne / logiops

An unofficial userspace driver for HID++ Logitech devices
GNU General Public License v3.0
3.41k stars 271 forks source link

"Error adding device" -- need to restart logid service to fix #156

Open gobbedy opened 4 years ago

gobbedy commented 4 years ago

Hello and thank you for your wonderful driver.

This issue is related to the problem I described here but I thought I'd open my own issue rather than continue to hijack someone else's.

The following warning appears to be the problem: [WARN] Error adding device /dev/hidraw2: std::exception

I always get the warning when I run sudo logid -v (asterisks are mine for emphasis):

[DEBUG] Unsupported device /dev/hidraw4 ignored
**[WARN] Error adding device /dev/hidraw2: std::exception**
[DEBUG] Unsupported device /dev/hidraw0 ignored
[INFO] Detected receiver at /dev/hidraw1
[INFO] Device found: Wireless Mouse MX Master 3 on /dev/hidraw1:1
[DEBUG] /dev/hidraw1:1 remappable buttons:
[DEBUG] CID  | reprog? | fn key? | mouse key? | gesture support?
[DEBUG] 0x50 |         |         | YES        | 
[DEBUG] 0x51 |         |         | YES        | 
[DEBUG] 0x52 | YES     |         | YES        | YES
[DEBUG] 0x53 | YES     |         | YES        | YES
[DEBUG] 0x56 | YES     |         | YES        | YES
[DEBUG] 0xc3 | YES     |         | YES        | YES
[DEBUG] 0xc4 | YES     |         | YES        | YES
[DEBUG] 0xd7 | YES     |         |            | YES
[DEBUG] Thumb wheel detected (0x2150), capabilities:
[DEBUG] timestamp | touch | proximity | single tap
[DEBUG] YES       | YES   | YES       | YES       
[DEBUG] Thumb wheel resolution: native (18), diverted (120)

The warning occurs no matter what my logid.cfg is; or indeed whether I have one or not.

Still, in case it matters, I got the above output with the following /etc/logid.cfg:

devices: (
{
    name: "Wireless Mouse MX Master 3";
    buttons: (
        {
            # Forward button
            cid: 0x56;
            action =
            {
                type :  "Keypress";
                keys: ["KEY_VOLUMEUP"];
            };
        }
    );
}
);

Note that when I run the above command (sudo logid -v), the warning appears to be harmless: the driver still works without issue.

However, when logid is started as a service, the same warning appears at random, and when it does, I get the scrolling issues described in the issue 148.

I then have to restart the service in order to get my mouse working properly again.

This happens on average every 2 hours or so, enough to be annoying lol.

I'd be grateful for any help resolving this issue.

Here is the output of my uname -v: #1 SMP Debian 5.7.6-1kali2 (2020-07-01)

Thanks in advance!

fastcat commented 3 years ago

I have a very similar issue -- mine shows up when disconnecting & reconnecting the receiver ... which in my case is really when switching systems on my KVM, but the same thing happens if I manually unplug & re-plug the receiver.

I specifically see the "running it interactively with -v avoids the problem" ... and in fact I found that setting the systemd service to use -v also works around the issue!

Edit: correction: ... sometimes works around the issue :frowning_face:

gfarrell commented 3 years ago

I have exactly the same problem -- breaks after suspend and reboot. Restarting the service with systemctl fixes it for me every time.

leviable commented 3 years ago

I'm having the same or similar issue as @fastcat, specifically getting logid to work correctly with my Master 2S after using a KVM to switch between work stations. Bouncing the service rarely works, but manually running logid with -v makes it work most of the time.

I suspect there is some sort of timeout that needs to happen first. On this particular work station (Ubuntu 20.04.3), sometimes Ill remote desktop into it, and sometimes switch from RDP to the actual box with my KVM. If I don't wait ~20 seconds between killing the RDP session and logging into the box via the KVM, my sound wont work, as there is a 20 second timeout that needs to pop. I suspect something similar is occurring here.

DimitriDaSilva commented 2 years ago

I'm having the same issue. Restarting the service also fixes it for me

araujorm commented 2 years ago

Confirmed here too. MX Master 3, connected via bluetooth.

hbarcelos commented 2 years ago

Same issue here. MX Master 3, connected through bluetooth.

For context, here's the relevant part of journalctl -u logid:

-- Boot a48bf66ff9984ce9b0fcb50620cdda9b --
jul 29 16:58:29 henrique-a70mob systemd[1]: Started Logitech Configuration Daemon.
jul 29 14:01:12 henrique-a70mob logid[1027]: [WARN] Error adding device /dev/hidraw3: Invalid function ID
jul 29 14:01:12 henrique-a70mob logid[1027]: [WARN] Error adding device /dev/hidraw3: Invalid function ID
lines 1481-1521/1521 (END)
jandresfg commented 2 years ago

Same issue here. MX Master 3, connected through bluetooth. This keeps me from launching successfully at startup, gotta always restart the service manually for it to work...

NoChance777 commented 2 years ago

Same here. The device is MX 3 Master 3 Mac, connected via Bluetooth. Adding 'After=bluetooth.target' in service file does not solve the problem.

gnos28 commented 2 years ago

same issue for me as well mx master 3 bluetooth / ubuntu 22

very likely because bluetooth mouse isn't automatically paired when system boot (you have to click any mouse button to "activate it")

might be solved with a tweak in service file like @NoChance777 said but I'm not enough comfortable to play with that

wmbruckner commented 2 years ago

Having the same issue here when starting (Kubuntu 22.04), modified logid.service did not fix it. However, if I do not touch the mouse for like some 20 secs after booting to desktop, logid runs just fine.

dszmaj commented 1 year ago

same problem here with master 3 on fedora 37

im-calvin commented 1 year ago

Just to bump this thread I'm running into the same issue with Mx Master 3 on Fedora 37 using exclusively Bluetooth.

I've tried some of the fixes in the linked thread but the main issue is that when the laptop goes to sleep / mouse goes to sleep I run into the following error: [WARN] Error adding device /dev/hidraw1: Invalid function ID. This error doesn't show up when I either restart or fully shut down the system, only when something goes to sleep.

https://github.com/PixlOne/logiops/issues/204#issuecomment-841861932

im-calvin commented 1 year ago

I fixed the issue by removing the Solaar package which I had already installed on my system. I presume the issue was that they were both fighting for the mouses' config. Hope this helps others!

fastcat commented 1 year ago

I fixed the issue by removing the Solaar package

You're my hero for today :)

I still see the [WARN] Error adding device /dev/hidraw13: std::exception error in the logs ... but the mouse still gets properly reconfigured on insert now.

im-calvin commented 1 year ago

Yeah I get that same error as well, seems like the drivers work though.

I initially installed Solaar to monitor the battery life, kinda sucks that they aren't compatible with each other. Maybe a potential improvement?

fastcat commented 1 year ago

I maybe spoke too soon yesterday. Disabling/removing solaar does make things better, but it doesn't fix everything. When switching away & back with my KVM, I'm now getting the button-remapping working right where it sometimes wouldn't before, but my scroll wheel is sometimes not getting reconfigured for the correct scrolling speed (but sometimes is).

im-calvin commented 1 year ago

I'll look into it when I get a chance, I haven't actually had a chance to use my Linux device all that much but I'll see if I get the same behaviour.

im-calvin commented 1 year ago

Following up, I've been seeing some buggy behaviour with the service. Sometimes when the service is not on none of my binds are working (including scroll wheel which I guess used to be fixed with the Solaar package). Not too sure what the fix is atm. Seems to be reproducible whenever I turn my Bluetooth on my device on / off? When I power cycle the mouse it fixed it. When I set my device to suspend then it also stops working.

im-calvin commented 1 year ago

I seem to have possibly fixed the issue by changing hirresscroll: { hires: false } to true in my config file. Not sure if this is a permanent fix but I found the solution through #116

raymondshiner commented 1 year ago

Any updates on this? I am having the same problem. As far as i can tell, i have uninstalled Solaar, but it still wont work on reboot. I have to restart service via CLI to get gesture button func.

raymondshiner commented 1 year ago

So not a fix, but a workaround. The AI Overlord suggested I make a seperate timer service to restart logid shortly after restart. It works now i have gestures after logging in, without having to manually restart.

https://chat.openai.com/share/1393c511-d92b-41f8-b019-742d9cda2ef4

arthurbarros commented 12 months ago

So not a fix, but a workaround. The AI Overlord suggested I make a seperate timer service to restart logid shortly after restart. It works now i have gestures after logging in, without having to manually restart.

https://chat.openai.com/share/1393c511-d92b-41f8-b019-742d9cda2ef4

Worked for me, not a fix but I will take the workaround. @raymondshiner thank you

c-kr commented 10 months ago

Had the same problem with MX Master 3 via bluetooth. A better approach instead of starting with a delay is a udev rule that starts logid after the hidraw device appears:

cat /etc/udev/rules.d/50-restart_logid.rules 
ACTION=="add", KERNEL=="hidraw0", RUN+="/usr/bin/systemctl --no-block restart logid.service"

This allows to disable the logid.service and have the daemon just started once, right after connection without a need to restart.

Tested on arch with the logiops AUR package