Logitech mouse lagging

I’m using a logitech M7350 with the unifying receiver and I tried plugging it into both rear and front panel USB ports as well as USB 3 and USB 2 ports. Neither worked and all exhibit the same behaviour. I’ve noticed that each time this “lag” happens, udevadm monitor shows

KERNEL[11699.241220] change   /devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb1/1-1/1-1:1.2/0003:046D:C52B.0003/0003:046D:405E.0006/power_supply/hidpp_battery_0 (power_supply)
UDEV  [11699.245403] change   /devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb1/1-1/1-1:1.2/0003:046D:C52B.0003/0003:046D:405E.0006/power_supply/hidpp_battery_0 (power_supply)

The “lag” is like this, I’d move the mouse and randomly the mouse would responding for like half a second and the icon on the mouse blinks like its trying to reconnect to the host. Whenever I plug it into a new port it works fine for some time, then starts exhibiting the same behaviour

Whats your dmesg and journal say when you take it out and put it back in?

[Sat Jan 18 13:07:34 2025] usb 1-1: USB disconnect, device number 6
[Sat Jan 18 13:07:37 2025] usb 1-1: new full-speed USB device number 7 using xhci_hcd
[Sat Jan 18 13:07:38 2025] usb 1-1: New USB device found, idVendor=046d, idProduct=c52b, bcdDevice=12.11
[Sat Jan 18 13:07:38 2025] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[Sat Jan 18 13:07:38 2025] usb 1-1: Product: USB Receiver
[Sat Jan 18 13:07:38 2025] usb 1-1: Manufacturer: Logitech
[Sat Jan 18 13:07:38 2025] logitech-djreceiver 0003:046D:C52B.0015: hiddev96,hidraw0: USB HID v1.11 Device [Logitech USB Receiver] on usb-0000:02:00.0-1/input2
[Sat Jan 18 13:07:38 2025] input: Logitech M720 Triathlon as /devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb1/1-1/1-1:1.2/0003:046D:C52B.0015/0003:046D:405E.0016/input/input33
[Sat Jan 18 13:07:38 2025] logitech-hidpp-device 0003:046D:405E.0016: input,hidraw2: USB HID v1.11 Keyboard [Logitech M720 Triathlon] on usb-0000:02:00.0-1/input2:1
[Sat Jan 18 13:07:45 2025] logitech-hidpp-device 0003:046D:405E.0016: HID++ 4.5 device connected.
[Sat Jan 18 13:08:35 2025] usb 1-1: USB disconnect, device number 7
[Sat Jan 18 13:08:40 2025] usb 1-1: new full-speed USB device number 8 using xhci_hcd
[Sat Jan 18 13:08:40 2025] usb 1-1: New USB device found, idVendor=046d, idProduct=c52b, bcdDevice=12.11
[Sat Jan 18 13:08:40 2025] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[Sat Jan 18 13:08:40 2025] usb 1-1: Product: USB Receiver
[Sat Jan 18 13:08:40 2025] usb 1-1: Manufacturer: Logitech
[Sat Jan 18 13:08:40 2025] logitech-djreceiver 0003:046D:C52B.0019: hiddev96,hidraw0: USB HID v1.11 Device [Logitech USB Receiver] on usb-0000:02:00.0-1/input2
[Sat Jan 18 13:08:41 2025] input: Logitech M720 Triathlon as /devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb1/1-1/1-1:1.2/0003:046D:C52B.0019/0003:046D:405E.001A/input/input34
[Sat Jan 18 13:08:41 2025] logitech-hidpp-device 0003:046D:405E.001A: input,hidraw2: USB HID v1.11 Keyboard [Logitech M720 Triathlon] on usb-0000:02:00.0-1/input2:1

This is the disconnect and connect from dmesg

Hmm. Are you seeing any errors within the journal with like kwin, or x11 or anything like that in reference to this?

Also, does this mouse work as intended on another machine or is it just confined to this machine, and was there a previous time this mouse worked or is it new?

I am using Hyprland, I forgot to mention. Yes the mouse works perfectly on other linux ( endeavouros, also Hyprland) machines and works well on the windows installation that’s also on the same machine. So I doubt its a hardware issue.

Is there some sort of USB power management built into the kernel or something? I know programs like powertop and tlp do these things but I have neither of those installed

Nothing on the journal either

If you are using the default kernel which is the current LTS, any bug in the usb manager would have long since been worked out so i suspect its something weirder.

Are you sure its an M7350? dmesg returns Logitech M720. If its not an M720, it might be loading the wrong driver software.

Do you have a BT card in your machine?

Yeah its an M720. I was mistaken before, I have TP link router connected whose model num is M7350. I got it mixed up. I have a BT card on the way so I won’t be able to test for at least a week with BT

I was wondering why a logitech search returned TP Link router suggestions, guess thats why lol

Hmm.

Share your full config if your willing, you can exclude the users section and such. Mostly want to inspect boot and kernel params along with pipewire if you are running it

Configuration.nix

# Edit this configuration file to define what should be installed on
# your system.	Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, lib, pkgs, stylix, ... }:

{
	imports =
		[ # Include the results of the hardware scan.
			./hardware-configuration.nix
		];

	# Bootloader.
	boot.loader.efi.canTouchEfiVariables = true;
	boot.loader.grub = {
		enable = true;
		useOSProber = true;
		device = "/dev/nvme0n1p1";
		efiSupport = true;
		forceInstall = true;
	};

	networking.hostName = "nixos"; # Define your hostname.
	# networking.wireless.enable = true;	# Enables wireless support via wpa_supplicant.

	# Configure network proxy if necessary
	# networking.proxy.default = "http://user:password@proxy:port/";
	# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";

	# Enable networking
	networking.networkmanager.enable = true;

	# Set your time zone.
	time.timeZone = "Asia/Colombo";

	# Select internationalisation properties.
	i18n.defaultLocale = "en_US.UTF-8";

	# Configure keymap in X11
	services.xserver.xkb = {
		layout = "us";
		variant = "";
	};

	services.udisks2.enable = true;
	services.gvfs.enable = true;
	services.tumbler.enable = true;

	programs.xfconf.enable = true;
	programs.thunar = {
		enable = true;
		plugins = with pkgs.xfce; [
			thunar-archive-plugin
			thunar-volman
		];
	};

	# Define a user account. Don't forget to set a password with ‘passwd’.
	users.users.lasan = {
		isNormalUser = true;
		description = "Lasan";
		extraGroups = [ "networkmanager" "wheel" "docker"];
		packages = with pkgs; [];
	};

	virtualisation.docker.enable = true;

	# Allow unfree packages
	nixpkgs.config.allowUnfree = true;

	# List packages installed in system profile. To search, run:
	# $ nix search wget
	environment.systemPackages = with pkgs; [
		kitty
		rofi-wayland
		bibata-cursors
		grim
		slurp
		grimblast
		wget
		git
		gnugrep	
		wl-clipboard
	];

	zramSwap = {
		enable = true;

	};

	# List services that you want to enable:
	services.greetd = {
		enable = true;
		settings= {
				default_session = {
						command = "Hyprland";
						user = "lasan";
				};
		};
		vt = 7;
	};

	nix.settings.experimental-features = ["nix-command" "flakes"];

	security.pam.services.hyprlock = {};
		stylix = {
				enable = true;
				image = ./default.jpg;
				polarity = "dark";
				cursor = {
						name = "Bibata-Modern-Ice";
						size = 24;
				};
				targets = {
						fish.enable = true;
				};

		};

	# Enable the OpenSSH daemon.
	# services.openssh.enable = true;

	# Open ports in the firewall.
	# networking.firewall.allowedTCPPorts = [ ... ];
	# networking.firewall.allowedUDPPorts = [ ... ];
	# Or disable the firewall altogether.
	# networking.firewall.enable = false;

	# This value determines the NixOS release from which the default
	# settings for stateful data, like file locations and database versions
	# on your system were taken. It‘s perfectly fine and recommended to leave
	# this value at the release version of the first install of this system.
	# Before changing this value read the documentation for this option
	# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
	system.stateVersion = "24.11"; # Did you read the comment?

	nix.settings = {
	substituters = ["https://hyprland.cachix.org"];
	trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="];
 };

}

hardware-configuration.nix

# Do not modify this file!  It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations.  Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:

{
  imports =
    [ (modulesPath + "/installer/scan/not-detected.nix")
    ];

  boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ "kvm-amd" ];
  boot.extraModulePackages = [ ];

  fileSystems."/" =
    { device = "/dev/disk/by-uuid/41de5de0-6ef9-4216-886a-d73e4f92330d";
      fsType = "ext4";
    };

  fileSystems."/boot" =
    { device = "/dev/disk/by-uuid/2034-20F0";
      fsType = "vfat";
      options = [ "fmask=0077" "dmask=0077" ];
    };

  swapDevices = [ ];

  # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
  # (the default) this is the recommended approach. When using systemd-networkd it's
  # still possible to use this option, but it's recommended to use it in conjunction
  # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
  networking.useDHCP = lib.mkDefault true;
  # networking.interfaces.enp12s0f3u1.useDHCP = lib.mkDefault true;
  # networking.interfaces.enp6s0.useDHCP = lib.mkDefault true;

  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
  hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
  hardware.i2c.enable = true;
}

I am using flakes and home-manager btw. Thanks for taking time to help me. I really appreciate it : )

No problem bro, thats what we are here for.

Now i dont see anything that sticks out to me in your config, and the dmesg logs dont indicate any kind of failure.

So i did some digging and actually found a few different forum posts complaining of this exact issue, many of them not returning much in the way of useful data from dmesg like yourself.

Theres a theory among some of the communities that that mouse might just have a shit antenna in it.

Several users reported fixes by moving the unifying receiver closer physically to the mouse using a usb extension cable.

If this a problem specific to linux, as it seems to be given this issue was reported on the arch and manjaro forums years ago, it likely stems from the unifying receiver not getting enough current from the USB port, or barring that some signal interference the driver in the linux kernel is unable to deal with for some reason.

But there might be hope yet if moving the receiver closer doesnt pan out, some of the mods included the xanmod and zen1 kernel variations actually address HID problems like these.

if you want to try running a non stock kernel to see if that fixes it, i’d suggest zen1 as its optimized for what you like to do just glancing at your config.

You can pin a kernel version and pull down src to build one like this:

boot.kernelPackages = pkgs.linuxPackages_zen;

Just add this to your /etc/nixos/config file just above boot.loader.efi

1 Like

Cool. From a quick google search, it seems that zen and LTS aren’t that different from a user perspective. I’ll try out zen to see if that fixes things

Tried zen but the issue still persists. Thank god I only play games on my windows installation. Moving the mouse close does indeed seem to work. So I guess its a driver / signal thing. Thanks for your time. I’ll be switching to BT and see if that works when the card arrives

Anytime, let me know how it goes with the BT module, there are alot more options for that.

If moving it closer fixed it, another rather ghetto temp fix is to make some antennas.

This is actually not too complicated, though it will take some fiddling.

Get some tin foil, make a roll with a hollow tube, the inner diameter being about the size of your pinky, ish.

Wrap one side around the usb receiver, tape also works, and then kinda fold the other side and point it at where your desk pad is.

This is a really crude directional antenna that will help reduce signal interference even more by isolating out unrelated RF in the AOE

EDIT: Grammar
EDIT 2: A helpful hint for making the antennas hollow and straight initially, grab a cigar (if you are a smoker) or a bic pen and wrap it around that to get your initial shape. Makes working it a bit easier. then just slide the tin foil off

I switched the mouse to bluetooth. It works great so far. I think the issue is indeed weak antenna / bad filtering / interference. Bluetooth works great ( might be a placebo but I feel like there’s a very small latency. Much better than outright cutting out tho ). Ig I’ll switch to RF in windows and bluetooth on linux.

Thanks for the suggestions. : )

Eeeexcellent, glad to hear it all panned out.

You can try unpairing and pairing again the mouse to the receiver with solaar. It solved a similar issue with my MX master

There’s a pkg for nixos NixOS Search