Thursday, February 7, 2019

ThermalTake Tt esports Commander Mouse intermittently stops working in Linux Mint

So far nothing worked yet but I am making all attempt to document the things I have tried.
sudo sh -c "echo -1 > /sys/module/usbcore/parameters/autosuspend"

sudo apt-get install powernap
sudo powernap-action --disable usb_autosuspend
------
cat /etc/X11/xorg.conf
Section "InputClass"
    Identifier "Mouse Remap"
    MatchProduct "TT Esport Commander Mouse"
    MatchDevicePath "/dev/input/event*"
    Option "ButtonMapping" "1 2 3 4 5 6 7 8 9 10 11 12 0 0 0"
EndSection


sudo -i
echo N> /sys/module/drm_kms_helper/parameters/poll 
echo "options drm_kms_helper poll=N">/etc/modprobe.d/local.conf




I removed default libinput drivers

apt remove xserver-xorg-input-libinput
and installed evdev ones

apt install xserver-xorg-input-evdev
 <hr>
 
First copy the file /lib/udev/rules.d/69-libmtp.rules to /etc/udev/rules.d/69-libmtp.rules:
$ sudo cp /lib/udev/rules.d/69-libmtp.rules /etc/udev/rules.d/69-libmtp.rules
At the top of this file you can find:
# Some sensitive devices we surely don't wanna probe
ATTR{idVendor}=="0670", GOTO="libmtp_rules_end"
ATTR{idVendor}=="0471", ATTR{idProduct}=="083f", GOTO="libmtp_rules_end"
Then exclude the device from mtp-probe by adding next line after mentioned lines:
ATTR{idVendor}=="093a", ATTR{idProduct}=="2516", GOTO="libmtp_rules_end"
I found my USB device ID with lsusb shell command. It is 093a:2516
<hr>
 
 
 
The mouse sliders are broken in all the *buntu 18.04 flavors I have 
tried. the only "fix" that worked for me was to disable acceleration 
completely and adjust sensitivity with the mouse hardware (dpi setting) 
itself.



sudo nano /usr/share/X11/xorg.conf.d/50-mouse-acceleration.conf



paste in:

Section "InputClass"
    Identifier "Mouse"
    MatchIsPointer "yes"
    Option "AccelerationProfile" "-1"
    Option "AccelerationScheme" "none"
    Option "AccelSpeed" "-1"
EndSection
 
Or just create the "50-mouse-acceleration.conf" (with the above text in it) with your text editor and move/copy it to "/usr/share/X11/xorg.conf.d"

<hr>

This script disables the two drivers
File: mouseTemporaryFix.sh
chmod +x mouseTemporaryFix.sh

#!/bin/bash
if [[ $EUID != 0 ]] ; then
  echo This must be run as root!
  exit 1
fi
#for xhci in /sys/bus/pci/drivers/?hci_hcd ; do
 for xhci in /sys/bus/pci/drivers/?hci-pci ; do
  if ! cd $xhci ; then
    echo Weird error. Failed to change directory to $xhci
    exit 1
  fi
  echo Resetting devices from $xhci...
  for i in ????:??:??.? ; do
    if [ $i == "????:??:??.?" ]; then
    echo “ignoring”
    continue
    fi
    echo “Device $xhci:$i”
    echo -n "$i" > unbind
    echo -n "$i" > bind
  done
done

<hr>

A possible solution - Blacklisting USB related kernel modules in a trial and error procedure revealed that the ehci-pci kernel module was the cause of the problem.
For a temporary solution, simply remove the kernel module:
sudo rmmod ehci_pci
For a permanent solution, either blacklist the module via kernel boot arguments, e.g.
modprobe.blacklist=ehci_pci 
vi /etc/modprobe.d/blacklist.conf 
add 
blacklist ehci_pci
blacklist xhci_hcd

nb. Blacklisting ehci_pci will also prevent kernel module ehci-hcd from getting loaded.
Once done update initramfs and reboot your system:
# update-initramfs -u
# reboot
After reboot use lsmode to see whether module is present. 
The ehci* kernel modules are the kernel’s USB 2 drivers.
Luckily, the USB 3 kernel modules xhci* support USB 2 devices as well and you will experience no performance loss with these