Bug 5475

Summary: USB mouse freezes in X
Product: Drivers Reporter: Christoffer S (kernelbug)
Component: USBAssignee: Dmitry Torokhov (dmitry.torokhov)
Severity: normal CC: dmitry.torokhov, stern, vojtech
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: Subsystem:
Regression: --- Bisected commit-id:
Bug Depends on:    
Bug Blocks: 5089    
Attachments: dump of usbmon
Dump of usbmon while mouse is working
A patch that fixed it for a couple users

Description Christoffer S 2005-10-20 14:30:56 UTC
Most recent kernel where this bug did not occur: 2.6.10
Distribution: Ubuntu
Hardware Environment: AMD Athlpn 1300, Nvidia GeForce2, Logitech Optical USB Mouse
Software Environment: Ubuntu 5.04/Ubuntu 5.10
Problem Description: 

Booting into Gnome and reading webpages. Not using the mouse for a while. When I
grab the mouse and want to move the pointer, the mouse is frozen. I have to
switch terminals (Ctrl+Alt+F1) and back to F7 to get the mouse working again.

Steps to reproduce:

1. Boot, log into Gnome.
2. Use your computer for a while (eg. type in a bugreport on kernel.org)
3. Move the mouse pointer. It appears frozen.

This did not appear in kernel 2.6.10. The problem is apparent also in 2.6.12.
Comment 1 Dmitry Torokhov 2005-10-20 14:53:33 UTC
Does the mouse freeze if you are using it with GPM in console? What device are 
you usign to get mouse data (/dev/input/mice, /dev/psaux, etc)?
Comment 2 Christoffer S 2005-10-21 00:48:32 UTC
I am using /dev/input/mice.

Using gpm it freezes also. When I started using gpm and when the mouse froze, I
could not get to unfreeze again by switching terminals.

I have tried looking in syslog, messages and dmesg, nothing there to pinpoint
the problem.
Comment 3 Greg Kroah-Hartman 2005-11-14 21:41:08 UTC
Does this happen on 2.6.14?
Comment 4 Christoffer S 2005-11-17 11:45:31 UTC
I just tried kernel and the same thing happened.

Is there any debug logging I can set or see somewhere?
Comment 5 Christoffer S 2005-12-05 11:16:21 UTC
I am using kernel 2.6.15 on Ubuntu development version and the same thing
happens. There is no information in kern.log or messages.log.

My mouse is a Logitech Optical Mouse M/N: M-BD58.

I've tried using a PS/2 adaptor and the mouse works fine.
Comment 6 Alan Stern 2006-02-03 19:53:14 UTC
There are two things you can do.  First, turn on CONFIG_USB_DEBUG and check the
dmesg log.  Second, use the usbmon facility to keep track of USB data flowing
back and forth (see the instructions in Documentation/usb/usbmon.txt).  This
should tell us if the problem is in the lower part of the driver stack.
Comment 7 Greg Kroah-Hartman 2006-03-06 10:27:56 UTC
No response in 2 months, closing.  If this is still a problem, please reopen
with the requested information.
Comment 8 Christoffer S 2006-03-18 01:42:32 UTC

Sorry for my late answer.

I have tried using usbmon on 2.6.15 but I did not see all my usb devices, only 2
( I have three usb devices, a mouse, keyboard and a logitech headset).

I followed the instructions in usbmon.txt, mounted the debug_fs.

In the doc it says:

ls /sys/kernel/debug/usbmon
1s  1t  2s  2t  3s  3t  4s  4t

but I only have 4:

1s 1t 2s 2t

Also it says, 

cat /proc/bus/usb/devices


dir /proc/bus/usb/

gives an empty directory.

From lsusb:

Bus 001 Device 004: ID 046d:c00c Logitech, Inc. Optical Wheel Mouse

So it must be device 4 but that does not correspond to ls /sys/kernel/debug/usbmon.

I am pretty confused.
Comment 9 Alan Stern 2006-03-18 10:23:38 UTC
The entries in /sys/kernel/debug/usbmon correspond to your computer's USB
controllers (or buses), not to USB devices.  Apparently your computer has only
two controllers, so there are only four files.  Since the mouse shows up on bus
1 according to lsusb, the file you need to monitor is 1t.

In some distributions, /proc/bus/usb isn't mounted by default.  You have to
mount it by hand:

   mount -t usbfs none /proc/bus/usb

Comment 10 Christoffer S 2006-03-19 07:31:18 UTC
Created attachment 7602 [details]
dump of usbmon

This is a dump of usbmon. The mouse freezed while catting 1t. I stopped,
unplugged the mouse and then plugged it in again.
Comment 11 Christoffer S 2006-03-19 07:33:09 UTC
Created attachment 7603 [details]
Dump of usbmon while mouse is working

This is a dump after the mouse was unplugged and plugged in again (ie. while
the mouse was working).
Comment 12 Alan Stern 2006-03-22 07:33:04 UTC
The dump indicates that the mouse simply stopped working.  Of course, it's
possible that the USB host controller stopped working instead.

Have you tried booting a 2.6.10 kernel recently?  Do you know that it still works?

What shows up in the usbmon output if the mouse freezes under Gnome and you
unfreeze it by switching terminals?
Comment 13 Christoffer S 2006-03-22 08:54:56 UTC

I'm using 2.6.10 (Ubuntu Hoary - 5.04) on a daily basis and there are no
problems here.

I have see other people reporting this problem:


There is a difference using 2.6.12 and 2.6.15. On 2.6.12 I can unfreeze the
mouse by switching terminals.

On 2.6.15 I have to unplug it. Switching terminals does not work.
Comment 14 Alan Stern 2006-03-22 09:19:55 UTC
Okay, try doing this with 2.6.15:  Turn on CONFIG_USB_DEBUG in the kernel
configuration and make sure that CONFIG_USB_HID is set to M, not Y.  Rebuild the
USB drivers and load uhci-hcd with

   modprobe uhci-hcd debug=3

Next, mount /sys/kernel/debug.  When the mouse freezes, go to
/sys/kernel/debug/uhci and post the contents of the file which corresponds to
the USB controller the mouse is plugged into.  After that, try doing

   rmmod usbhid
   modprobe usbhid

and see if that gets the mouse to start working again.
Comment 15 Vojtech Pavlik 2006-03-28 21:13:23 UTC
Created attachment 7698 [details]
A patch that fixed it for a couple users

Try this patch - it fixed it for a number of SuSE users. I believe I have
sent it to Dmitry already, if not, please correct me.

The problem is that the mouse in question sometimes caused EILSEQ
resulting in the driver giving up on it. This makes the driver ignore the
intermittent errors.
Comment 16 Christoffer S 2006-03-30 09:08:16 UTC
The provided patch works for me.

Thanks to everyone.
Comment 17 Dmitry Torokhov 2006-03-31 09:34:18 UTC
Alan has reworked HID driver interrupt handling quite a bit, could you please 
try the latest git snapshot (or 2.6.17-rc1 when it comes out)?
Comment 18 Christoffer S 2006-03-31 09:38:58 UTC
I'll try 2.6.17-rc1 when it comes out.
Comment 19 Christoffer S 2006-04-06 11:21:50 UTC
2.6.17-rc1 seems to be working fine. The mouse doesn't freeze.