Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[fixed] usb mouse cursor hang after power in/out my laptop
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Dominique_71
Veteran
Veteran


Joined: 17 Aug 2005
Posts: 1649
Location: Switzerland (Romandie)

PostPosted: Tue Nov 10, 2015 6:50 pm    Post subject: [fixed] usb mouse cursor hang after power in/out my laptop Reply with quote

I have a weird issue, I have a laptop acer aspire and after plug-in or out its power cord, the cursor doesn't work with the external usb mouse (it still work with the touchpad). If I plug-out and in again the mouse in the same usb slot, the cursor doesn't work either. I must plug it out, and plug it in in another USB slot to get back the mouse cursor.

That append each time the power is plugged in or out. Another way to get back the mouse cursor is to click with the mouse and to immediately move the mouse. But as soon I don't the mouse 1 or 2 seconds, the cursor doesn't move and I must click again.

Code:
acpitool -e
  Kernel version : 3.18.0-gentoo_v   -    ACPI version : 20140926
  -----------------------------------------------------------
  Battery #1     : present
    Remaining capacity : 30514 mWh, 99.53%, 00:02:20
    Design capacity    : 48400 mWh
    Last full capacity : 30657 mWh, 63.34% of design capacity
    Capacity loss      : 36.66%
    Present rate       : 3652 mW
    Charging state     : charging
    Battery type       : rechargeable
    Model number       : 484 mWh
    Serial number      : AS10B75

  AC adapter     : on-line
  Fan            : <not available>

  CPU type               : AMD E-450 APU with Radeon(tm) HD Graphics
  Min/Max frequency      : 825/1650 MHz
  Current frequency      : 1650 MHz
  Frequency governor     : performance
  Freq. scaling driver   : acpi-cpufreq
  Cache size             : 1650.000 KB
  Bogomips               : 3293.08
  Bogomips               : 3293.08
  Function Show_CPU_Info : could not read directory /proc/acpi/processor/
  Make sure your kernel has ACPI processor support enabled.

  Thermal info   : <not available>

   Device   S-state     Status   Sysfs node
  ---------------------------------------
  1. PB6     S4   *disabled
  2. SPB0     S4   *disabled  pci:0000:00:15.0
  3. SPB2     S4   *disabled  pci:0000:00:15.2
  4. USB0     S3   *enabled   pci:0000:00:12.0
  5. USB1     S3   *enabled   pci:0000:00:13.0
  6. USB2     S3   *enabled   pci:0000:00:16.0
  7. USB3     S4   *enabled   pci:0000:00:14.5
  8. USB4     S3   *enabled   pci:0000:00:12.2
  9. USB5     S3   *enabled   pci:0000:00:13.2
  10. USB6     S3   *enabled   pci:0000:00:16.2
  11. P2P     S5   *disabled  pci:0000:00:14.4


Code:
# lsusb
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 0402:7675 ALi Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 009: ID 046d:c01d Logitech, Inc. MX510 Optical Mouse
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub


If I look at the dmesg output, after a power in (or out) I get the following diff:
Code:
# diff -u dmesg.orig dmesg.afterpowerin
--- dmesg.orig   2015-11-10 18:53:07.000000000 +0100
+++ dmesg.afterpowerin   2015-11-10 18:53:30.000000000 +0100
@@ -1388,3 +1388,5 @@
 [14979.344950] usb 4-2: Manufacturer: Logitech
 [14979.354031] input: Logitech USB-PS/2 Optical Mouse as /devices/pci0000:00/0000:00:12.0/usb4/4-2/4-2:1.0/0003:046D:C01D.0007/input/input56
 [14979.354440] hid-generic 0003:046D:C01D.0007: input,hidraw0: USB HID v1.10 Mouse [Logitech USB-PS/2 Optical Mouse] on usb-0000:00:12.0-2/input0
+[15109.002668] atl1c 0000:08:00.0: irq 25 for MSI/MSI-X
+[15109.025036] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready

The eth0 message is not related but normal because I am only using the wifi at that time.

No diff after the plug-out of the mouse.
After the plug-in of the mouse in the same usb slot:
Code:
# diff -u dmesg.afterpowerin+aftermouseout dmesg.afterpowerin+aftermouseout+in
--- dmesg.afterpowerin+aftermouseout   2015-11-10 18:53:49.000000000 +0100
+++ dmesg.afterpowerin+aftermouseout+in   2015-11-10 18:54:07.000000000 +0100
@@ -1390,3 +1390,4 @@
 [14979.354440] hid-generic 0003:046D:C01D.0007: input,hidraw0: USB HID v1.10 Mouse [Logitech USB-PS/2 Optical Mouse] on usb-0000:00:12.0-2/input0
 [15109.002668] atl1c 0000:08:00.0: irq 25 for MSI/MSI-X
 [15109.025036] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
+[15148.004448] usb 4-2: reset low-speed USB device number 8 using ohci-pci


No diff after a new plug out of the mouse.
After a mouse plug-in into a new USB slot:
Code:
# diff -u dmesg.afterpowerin+aftermouseout+in+out dmesg.afterpowerin+aftermouseout+in+out+inotherport
--- dmesg.afterpowerin+aftermouseout+in+out   2015-11-10 18:54:26.000000000 +0100
+++ dmesg.afterpowerin+aftermouseout+in+out+inotherport   2015-11-10 18:54:48.000000000 +0100
@@ -1391,3 +1391,11 @@
 [15109.002668] atl1c 0000:08:00.0: irq 25 for MSI/MSI-X
 [15109.025036] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
 [15148.004448] usb 4-2: reset low-speed USB device number 8 using ohci-pci
+[15185.681846] usb 4-2: USB disconnect, device number 8
+[15185.960813] usb 4-1: new low-speed USB device number 9 using ohci-pci
+[15186.111893] usb 4-1: New USB device found, idVendor=046d, idProduct=c01d
+[15186.111905] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
+[15186.111910] usb 4-1: Product: USB-PS/2 Optical Mouse
+[15186.111915] usb 4-1: Manufacturer: Logitech
+[15186.120679] input: Logitech USB-PS/2 Optical Mouse as /devices/pci0000:00/0000:00:12.0/usb4/4-1/4-1:1.0/0003:046D:C01D.0008/input/input57
+[15186.121939] hid-generic 0003:046D:C01D.0008: input,hidraw0: USB HID v1.10 Mouse [Logitech USB-PS/2 Optical Mouse] on usb-0000:00:12.0-1/input0


My kernel config: https://bpaste.net/show/4ec2cc75d169

My grub command line kernel parameters:
Code:
GRUB_CMDLINE_LINUX_DEFAULT="resume=/dev/sda3 resume_offset=81955 no_console_suspend acpi_osi=Linux"


This issue append with all kernels I have running on that box in at least 2 years. The acpi_osi=Linux didn't changed anything, I try it just yesterday, and was without that parameter before.

Another issue with hibernate/resume, but I don't know if it is related. I always unplug the external mouse after shutdown, and when I plug-in back after restart, it just work. But sometime (1 on 2 or 3 hibernate/resume) I get no keyboard and no touchpad in X (the keyboard work in grub). This append also sometime after a normal restart (1 time on maybe 20 or 50 boots), the keyboard work with grub, work at the console (I use startx) but don't work in X. When that append, the external usb mouse is working, and I can use it to put the laptop in sleep to ram and resume, the keyboard and the touchpad are back. The worst is if when resuming from hibernation, the screen saver is in action, it resume to it and I cannot get the hibernation/resume to ram menu.
_________________
[[[ To any NSA and FBI agents reading that text: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]


Last edited by Dominique_71 on Thu Jan 28, 2016 9:38 pm; edited 3 times in total
Back to top
View user's profile Send private message
CrankyPenguin
Apprentice
Apprentice


Joined: 19 Jun 2003
Posts: 274

PostPosted: Mon Nov 16, 2015 4:47 pm    Post subject: Reply with quote

Hi Dominique let me ask you two questions:

  • Are these unpowered ports? I ask because my laptop has two USB ports. One is designed to maintain power even in battery mode. The other will go into a low power state automatically as soon as I run off of battery. This appears to be built into the system. In my case simply reinserting the mouse works.
  • Are you running laptop-mode? If you are and if that kicks on when the power is changed it is possible that that is set to power down your USB. I had a similar problem on a prior version of it (that may be connected with my prior question) that has now disappeared. In effect laptop-mode can power down some parts of the system. It is possible that yours is triggering a module that limits usb.

_________________
Linux, the OS for the obsessive-compulsive speed freak in all of us.
Back to top
View user's profile Send private message
Dominique_71
Veteran
Veteran


Joined: 17 Aug 2005
Posts: 1649
Location: Switzerland (Romandie)

PostPosted: Wed Nov 25, 2015 9:57 am    Post subject: Reply with quote

CrankyPenguin wrote:
Hi Dominique let me ask you two questions:


  • Are you running laptop-mode? ... In effect laptop-mode can power down some parts of the system. It is possible that yours is triggering a module that limits usb.


Hi CrankyPenguin,

Yes I am. Adding the device id of the mouse, as given by lsusb, in AUTOSUSPEND_RUNTIME_DEVID_BLACKLIST (file runtime-pm.conf) fixed it.

EDIT: In fact this issue is fixed by laptop-mode, because it was already present before installing laptop-mode.
_________________
[[[ To any NSA and FBI agents reading that text: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
Back to top
View user's profile Send private message
Dominique_71
Veteran
Veteran


Joined: 17 Aug 2005
Posts: 1649
Location: Switzerland (Romandie)

PostPosted: Thu Nov 26, 2015 9:38 am    Post subject: Reply with quote

Now I have another issue. This morning, after resuming, the keyboard and the mouse cursor was dead in X. Both the touchpad and the external mouse was dead. That imply it was not even possible to shift to a primary console via Ctrl-Alt-Fn or the quit menu. The only working things was the mouse buttons and the kernel magic keys.

That imply I reverted the change in runtime-pm.conf and I am back to case 1. :?
_________________
[[[ To any NSA and FBI agents reading that text: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
Back to top
View user's profile Send private message
CrankyPenguin
Apprentice
Apprentice


Joined: 19 Jun 2003
Posts: 274

PostPosted: Mon Nov 30, 2015 5:05 pm    Post subject: Reply with quote

Dominique. My blacklist contains the following:
Code:
AUTOSUSPEND_RUNTIME_DEVID_BLACKLIST="usbhid"


Perhaps that will help.
_________________
Linux, the OS for the obsessive-compulsive speed freak in all of us.
Back to top
View user's profile Send private message
Dominique_71
Veteran
Veteran


Joined: 17 Aug 2005
Posts: 1649
Location: Switzerland (Romandie)

PostPosted: Wed Dec 02, 2015 2:02 pm    Post subject: Reply with quote

CrankyPenguin wrote:
Dominique. My blacklist contains the following:
Code:
AUTOSUSPEND_RUNTIME_DEVID_BLACKLIST="usbhid"


Perhaps that will help.


Thanks, but unfortunately not.
_________________
[[[ To any NSA and FBI agents reading that text: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1368
Location: Montréal

PostPosted: Wed Dec 02, 2015 2:41 pm    Post subject: Reply with quote

Hello,

I do not use laptop-mode but what I understand of the variable AUTOSUSPEND_RUNTIME_DEVID_BLACKLIST is that it blacklist devices from autosuspend according with their hexadecimal ID numbers xxxx:xxxx like the ones you get when you execute the command lspci -nn and lsusb. Use this variable with kernel modules names values to blacklist from autosuspend devices look without effect to me.

What can be done to verify if the source of your problem come from laptop-mode, is to stop it and than run X. You will see if your problem occur again or not. This should help.

The usbcore module have the parameter autosuspend who can be set to -1 to tell the module to not autosuspend
Code:
echo 'options usbcore autosuspend=-1' > /etc/modprobe.d/usb.conf

Since CONFIG_USB=m in your kernel configuration this parameter will work if you remake your initramfs if you use one.
_________________
Paul
Back to top
View user's profile Send private message
CrankyPenguin
Apprentice
Apprentice


Joined: 19 Jun 2003
Posts: 274

PostPosted: Fri Dec 04, 2015 4:52 am    Post subject: Reply with quote

Interesting Logicien, now that I look at it you are right I have the value in the wrong location. I am surprised that it still seemed to work.
_________________
Linux, the OS for the obsessive-compulsive speed freak in all of us.
Back to top
View user's profile Send private message
Dominique_71
Veteran
Veteran


Joined: 17 Aug 2005
Posts: 1649
Location: Switzerland (Romandie)

PostPosted: Mon Dec 07, 2015 8:16 pm    Post subject: Reply with quote

Logicien wrote:
Hello,

I do not use laptop-mode but what I understand of the variable AUTOSUSPEND_RUNTIME_DEVID_BLACKLIST is that it blacklist devices from autosuspend according with their hexadecimal ID numbers xxxx:xxxx like the ones you get when you execute the command lspci -nn and lsusb. Use this variable with kernel modules names values to blacklist from autosuspend devices look without effect to me.

What can be done to verify if the source of your problem come from laptop-mode, is to stop it and than run X. You will see if your problem occur again or not. This should help.

This issue was already occurring before the installation of laptop-mode. When I start the computer, the keyboard is always working when in grub prompt. After the system initialisation, I am in a root console, and generally the keyboard is working, but sometime it doesn't work, which imply I cannot login.

This issue occur more often when resuming, and when it append, the touchpad is also dead. Even the external mouse, if connected before to resume is dead.

Logicien wrote:
The usbcore module have the parameter autosuspend who can be set to -1 to tell the module to not autosuspend
Code:
echo 'options usbcore autosuspend=-1' > /etc/modprobe.d/usb.conf

Since CONFIG_USB=m in your kernel configuration this parameter will work if you remake your initramfs if you use one.

It doesn't solve this issue.

I have not much clue, and kernel debugging is not my cup of tea.
_________________
[[[ To any NSA and FBI agents reading that text: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
Back to top
View user's profile Send private message
Dominique_71
Veteran
Veteran


Joined: 17 Aug 2005
Posts: 1649
Location: Switzerland (Romandie)

PostPosted: Tue Dec 22, 2015 7:00 pm    Post subject: Reply with quote

I found this:
Code:
# cat /proc/bus/input/devices
...
I: Bus=0011 Vendor=0001 Product=0001 Version=ab41
N: Name="AT Translated Set 2 keyboard"
P: Phys=isa0060/serio0/input0
S: Sysfs=/devices/platform/i8042/serio0/input/input7
...


And this: http://ubuntuforums.org/archive/index.php/t-1321032.html

I am trying it and will report later if it work for me.
_________________
[[[ To any NSA and FBI agents reading that text: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
Back to top
View user's profile Send private message
Dominique_71
Veteran
Veteran


Joined: 17 Aug 2005
Posts: 1649
Location: Switzerland (Romandie)

PostPosted: Wed Dec 30, 2015 3:05 pm    Post subject: Reply with quote

When doing it, I get the following:
Code:
# echo -n "i8042" > /sys/bus/platform/drivers/i8042/bind
bash: /sys/bus/platform/drivers/i8042/bind: Permission denied


I also done a new kernel with i8042 build as module. It seem to help a little bit, as the keyboard hang less often during a normal boot. I begin to suspect a buggy hardware or bios combination. If the battery is high, the keyboard is working fine at the prompt, but if the battery is low, even when the AC adapter is plugged in and charging the battery, I need 2 or 3 boot in order to get a working keyboard at the prompt.

That changed nothing when resuming from hibernation. I try to put
Code:
SUSPEND_MODULES="i8042"

in /etc/pm/config/i8042, without success.
_________________
[[[ To any NSA and FBI agents reading that text: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
Back to top
View user's profile Send private message
Dominique_71
Veteran
Veteran


Joined: 17 Aug 2005
Posts: 1649
Location: Switzerland (Romandie)

PostPosted: Thu Jan 28, 2016 9:37 pm    Post subject: Reply with quote

Thanks to a typo, I managed to get it to work. I wrote the following script, /etc/pm/sleep.d/00i8042 :

Code:
#!/bin/sh
# Make the f. keyboard and mouse to work

resume_i8042()
{
   rmmod atkbd
   rmmod psmouse
   modprobe atkbd
   modprobe psmouse
   echo "Unloaded-reloaded atkbd and psmouse."
}

case "$1" in
   thaw|resume)
      resume_modules
      ;;
   *) echo "Nothing to do."
      ;;
esac



It is working, but calling that script with a "resume" argument will call a function that is not in that script, but in /usr/lib64/pm-utils/sleep.d/75modules

I still have /etc/pm/config/i8042, but its content is now:

Code:
SUSPEND_MODULES="atkbd psmouse"

which are modules depending on the i8042 module.

What is funny, the script doesn't work if I fix the typo and made it to call "resume_i8042", so I just removed that function. I found these 2 modules by trying the "rmmod ...; modprobe ..." commands at a terminal with the externaal USB mouse. The final script in /etc/pm/sleep.d/00i8042 :

EDIT: new version, the modules must be unloaded if we want to load them.
Code:
#!/bin/sh
# Make the f. keyboard and mouse to work

. "${PM_FUNCTIONS}"

case "$1" in
   thaw|resume)
      [ -z "$SUSPEND_MODULES" ] && return $NA
      for x in $SUSPEND_MODULES ; do
         printf "Unloading kernel module %s..." "$x"
         modunload $x && echo Done. || echo Failed.
      done
      modreload
      echo "Reloaded i8042 modules"
      ;;
   *) echo "Nothing to do."
      ;;
esac


_________________
[[[ To any NSA and FBI agents reading that text: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum