Mouse doesn't work unless Xorg restarted and mouse replugged in

Hey, this problem has been bothering me for quite a while now. Upon booting up I like to start Xorg via gdm, or sometimes startx from the command line. In either case the mouse in X does not initially work. I must kill X via killall gdm-binary or killall gdm, then unplug and replug in the mouse, then start X again and the mouse works. How can I make it so that the mouse works upon the first instance of starting X?
 
Hi,

I have this problem too, but a there's a little difference:

I always start X from the command line with [cmd=]$ startx[/cmd]

After this I have to exit X and start it again. Now my mouse works perfectly.
But it only concerns my machine at home (FreeBSD 8.2, Xorg 7.5.2). My machine at work works fine (FreeBSD 9, Xorg 7.5.2).
 
Here is my xorg.conf:

Code:
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 295.40  (root@BlackBox.Free.BSD)  Sat May 12 12:55:46 EDT 2012

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "Files"
    FontPath        "/usr/local/lib/X11/fonts/misc/:unscaled"
    FontPath        "/usr/local/lib/X11/fonts/100dpi/:unscaled"
    FontPath        "/usr/local/lib/X11/fonts/75dpi/:unscaled"
    FontPath        "/usr/local/lib/X11/fonts/misc/"
    FontPath        "/usr/local/lib/X11/fonts/Type1/"
    FontPath        "/usr/local/lib/X11/fonts/100dpi/"
    FontPath        "/usr/local/lib/X11/fonts/75dpi/"
    FontPath        "/usr/local/lib/X11/fonts/cyrillic/"
    FontPath        "/usr/local/lib/X11/fonts/TTF/"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/sysmouse"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "keyboard"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Unknown"
    HorizSync       28.0 - 33.0
    VertRefresh     43.0 - 72.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection
 
It's set to use /dev/sysmouse, that's good. This is a virtual device created by moused(8). Does that function properly?
 
Well I suppose moused is working properly if the mouse works in console? I'm not sure how to check if moused is working. On boot though the mouse works fine in console.
 
Doesn't help. I've had the same problem for some 5 or so weeks now, but I can't pinpoint it because it's a sporadic error. It doesn't seem to be a hardware problem though - the mouse (old PS/2 trackball in my case) always appears in dmesg:
Code:
 psm0: model Generic PS/2 mouse, device ID 0
 
zeissoctopus said:
Do you install and load webcamd?

No, but I just removed an unnecessary dbus entry from rc.conf. This may have helped - I need a few more system starts to be certain.
 
Well here is some more information on the problem from my Xorg.0.log:

Code:
(II) Initializing extension GLX
(II) config/hal: Adding input device HP Wireless Keyboard Kit
(II) LoadModule: "mouse"
(II) Loading /usr/local/lib/xorg/modules/input/mouse_drv.so
(II) Module mouse: vendor="X.Org Foundation"
        compiled for 1.7.7, module version = 1.7.1
        Module class: X.Org XInput Driver
        ABI class: X.Org XInput driver, version 7.0
(WW) HP Wireless Keyboard Kit: No Device specified, looking for one...
(II) HP Wireless Keyboard Kit: Setting Device option to "/dev/sysmouse"
(--) HP Wireless Keyboard Kit: Device: "/dev/sysmouse"
(==) HP Wireless Keyboard Kit: Protocol: "Auto"
(**) HP Wireless Keyboard Kit: always reports core events
(**) Option "Device" "/dev/sysmouse"
(==) HP Wireless Keyboard Kit: Emulate3Buttons, Emulate3Timeout: 50
(**) HP Wireless Keyboard Kit: ZAxisMapping: buttons 4 and 5
(**) HP Wireless Keyboard Kit: Buttons: 9
(II) XINPUT: Adding extended input device "HP Wireless Keyboard Kit" (type: MOUSE)
(**) HP Wireless Keyboard Kit: (accel) keeping acceleration scheme 1
(**) HP Wireless Keyboard Kit: (accel) acceleration profile 0
(II) HP Wireless Keyboard Kit: SetupAuto: hw.iftype is 4, hw.model is 0
(II) HP Wireless Keyboard Kit: SetupAuto: protocol is SysMouse
(II) config/hal: Adding input device HP Wireless Keyboard Kit
(II) LoadModule: "kbd"
(II) Loading /usr/local/lib/xorg/modules/input/kbd_drv.so
(II) Module kbd: vendor="X.Org Foundation"
        compiled for 1.7.7, module version = 1.6.1
        Module class: X.Org XInput Driver
        ABI class: X.Org XInput driver, version 7.0
(**) HP Wireless Keyboard Kit: always reports core events
(**) Option "Protocol" "standard"
(**) Option "XkbRules" "base"
(**) Option "XkbModel" "pc105"
(**) Option "XkbLayout" "us"
(II) XINPUT: Adding extended input device "HP Wireless Keyboard Kit" (type: KEYBOARD)
(II) config/hal: Adding input device AT Keyboard
(**) AT Keyboard: always reports core events
(**) Option "Protocol" "standard"
(**) Option "XkbRules" "base"
(**) Option "XkbModel" "pc105"
(**) Option "XkbLayout" "us"
(II) XINPUT: Adding extended input device "AT Keyboard" (type: KEYBOARD)
 
Actually this snippet from the terminal when I started startx for the first time is probably more useful:

Code:
(WW) HP Wireless Keyboard Kit: No Device specified, looking for one...
(II) HP Wireless Keyboard Kit: Setting Device option to "/dev/ums0"
(--) HP Wireless Keyboard Kit: Device: "/dev/ums0"
(==) HP Wireless Keyboard Kit: Protocol: "Auto"
(**) HP Wireless Keyboard Kit: always reports core events
(**) Option "Device" "/dev/ums0"
(EE) xf86OpenSerial: Cannot open device /dev/ums0
        Device busy.
(EE) HP Wireless Keyboard Kit: cannot open input device
(II) UnloadModule: "mouse"
(EE) PreInit returned NULL for "HP Wireless Keyboard Kit"
 
I thought I'd posted in this thread, but maybe it was a different one.

Anyway, the combination of running moused(8) and disabling HAL has solved some problems:
/etc/rc.conf:
Code:
moused_enable="YES"

Then disable HAL in the ServerLayout section of xorg.conf:
Code:
Option "AutoAddDevices" "Off"

devel/dbus is relatively harmless and can be useful.
 
I have the same or a similar problem. The mouse stops working about 20% of the time when I exit X and am returned to the xdm login screen. If I log back in to X the mouse usually starts working again. If it doesn't I log back out of X and it will work. The happens of an Lenovo x220 running 9.0-STABLE and an IBM R51 running 8.3-RELEASE. This only started in the last few weeks on the R51 and I just got the x220. Hal isn't running on either system. I did setup webcams on both. I mention this because it was asked above. The mouse isn't working now and I see this at the end of /var/log/Xorg.0.log:

Code:
[  3842.425] (II) Using input driver 'mouse' for '<default pointer>'
[  3842.425] (II) Loading /usr/local/lib/xorg/modules/input/mouse_drv.so
[  3842.426] (**) Option "CorePointer"
[  3842.426] (**) <default pointer>: always reports core events
[  3842.426] (WW) <default pointer>: No Device specified, looking for one...
[  3842.443] (EE) <default pointer>: Cannot find which device to use.
[  3842.443] (==) <default pointer>: Protocol: "Auto"
[  3842.443] (**) <default pointer>: always reports core events
[  3842.443] (EE) xf86OpenSerial: No Device specified.
[  3842.443] (EE) <default pointer>: cannot open input device
[  3842.443] (EE) PreInit returned 2 for "<default pointer>"
[  3842.443] (II) UnloadModule: "mouse"

Here is xorg.conf
Code:
Section "ServerLayout"
	Identifier     "X.org Configured"
	Screen      0  "Screen0" 0 0
	Screen      1  "Screen1" RightOf "Screen0"
	InputDevice    "Mouse0" "CorePointer"
	InputDevice    "Keyboard0" "CoreKeyboard"
	Option		   "AutoAddDevices" "Off"
EndSection

Section "Files"
	ModulePath   "/usr/local/lib/xorg/modules"
	FontPath     "/usr/local/lib/X11/fonts/misc/"
	FontPath     "/usr/local/lib/X11/fonts/TTF/"
	FontPath     "/usr/local/lib/X11/fonts/OTF/"
	FontPath     "/usr/local/lib/X11/fonts/Type1/"
	FontPath     "/usr/local/lib/X11/fonts/100dpi/"
	FontPath     "/usr/local/lib/X11/fonts/75dpi/"
	FontPath     "/usr/local/lib/X11/fonts/webfonts/"
	FontPath     "/usr/local/lib/X11/fonts/dejavu/"
EndSection

Section "Module"
	Load  "extmod"
	Load  "record"
	Load  "dbe"
	Load  "glx"
	Load  "dri"
	Load  "dri2"
	Load  "freetype" # added manually
EndSection

Section "InputDevice"
	Identifier  "Keyboard0"
	Driver      "kbd"
EndSection

Section "InputDevice"
	Identifier  "Mouse0"
	Driver      "mouse"
	Option	    "Protocol" "auto"
	Option	    "Device" "/dev/sysmouse"
	Option	    "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
	Identifier   "Monitor0"
	VendorName   "Monitor Vendor"
	ModelName    "Monitor Model"
EndSection

Section "Monitor"
	Identifier   "Monitor1"
	VendorName   "Monitor Vendor"
	ModelName    "Monitor Model"
EndSection

Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
        ### <percent>: "<f>%"
        ### [arg]: arg optional
        #Option     "DRI"                	# [<bool>]
        #Option     "ColorKey"           	# <i>
        #Option     "VideoKey"           	# <i>
        #Option     "FallbackDebug"      	# [<bool>]
        #Option     "Tiling"             	# [<bool>]
        #Option     "LinearFramebuffer"  	# [<bool>]
        #Option     "Shadow"             	# [<bool>]
        #Option     "SwapbuffersWait"    	# [<bool>]
        #Option     "TripleBuffer"       	# [<bool>]
        #Option     "XvMC"               	# [<bool>]
        #Option     "XvPreferOverlay"    	# [<bool>]
        #Option     "DebugFlushBatches"  	# [<bool>]
        #Option     "DebugFlushCaches"   	# [<bool>]
        #Option     "DebugWait"          	# [<bool>]
        #Option     "HotPlug"            	# [<bool>]
        #Option     "RelaxedFencing"     	# [<bool>]
		#Option		"RegistryDwords"		"EnableBrightnessControl=1" # added manually
	Identifier  "Card0"
	Driver      "intel"
	BusID       "PCI:0:2:0"
EndSection

Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
        ### <percent>: "<f>%"
        ### [arg]: arg optional
        #Option     "ShadowFB"           	# [<bool>]
        #Option     "DefaultRefresh"     	# [<bool>]
        #Option     "ModeSetClearScreen" 	# [<bool>]
	Identifier  "Card1"
	Driver      "vesa"
	BusID       "PCI:0:2:0"
EndSection

Section "Screen"
	Identifier "Screen0"
	Device     "Card0"
	Monitor    "Monitor0"
	SubSection "Display"
		Viewport   0 0
		Depth     1
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     4
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     8
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     15
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     16
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     24
	EndSubSection
EndSection

Section "Screen"
	Identifier "Screen1"
	Device     "Card1"
	Monitor    "Monitor1"
	SubSection "Display"
		Viewport   0 0
		Depth     1
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     4
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     8
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     15
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     16
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     24
	EndSubSection
EndSection

I have a devfs.rules containing
Code:
[system=10]
add path 'usb/*' mode 0660 group operator
add path 'video*' mode 0666

# /etc/rc.d/moused restart doesn't help.
 
Yup, it is.

% ps -ax | grep moused
Code:
1262 ??  Ss    0:00.35 /usr/sbin/moused -A 2.0,2.0 -a 1.2 -V -p /dev/psm0 -t auto
 
The line
Code:
moused_enable="YES"
is in /etc/rc.conf.

When the mouse is working, I confirm that it's enabled from /etc/rc.conf by running # /etc/rc.d/moused stop and the mouse stops working. Running # /etc/rc.d/moused start and the mouse starts working again.
 
For USB mice, moused is started when a USB mouse is detected. But it's started with different parameters than if moused was run from rc.conf. Kill that moused and manually restart it, and you get the normal version again. So the behavior can vary. Enabling moused in rc.conf seems to be more consistent, and I've found on at least one notebook that it seemed to be required to allow both touchpad and external mouse to work.
 
I sometime have to unplug and replug the cord on my USB mouse to get it to start after running startx and had to do so today. It looks like they were fighting over who got to start it:

/var/log/Xorg.0.log

Code:
(II) config/hal: Adding input device Microsoft IntelliMouse Explorer
(II) LoadModule: "mouse"
(II) Loading /usr/local/lib/xorg/modules/input/mouse_drv.so
(II) Module mouse: vendor="X.Org Foundation"
	compiled for 1.7.7, module version = 1.7.1
	Module class: X.Org XInput Driver
	ABI class: X.Org XInput driver, version 7.0
(WW) Microsoft IntelliMouse Explorer: No Device specified, looking for one...
(II) Microsoft IntelliMouse Explorer: Setting Device option to "/dev/ums0"
(--) Microsoft IntelliMouse Explorer: Device: "/dev/ums0"
(==) Microsoft IntelliMouse Explorer: Protocol: "Auto"
(**) Microsoft IntelliMouse Explorer: always reports core events
(**) Option "Device" "/dev/ums0"
(EE) xf86OpenSerial: Cannot open device /dev/ums0
	Device busy.
(EE) Microsoft IntelliMouse Explorer: cannot open input device
(II) UnloadModule: "mouse"
(EE) PreInit returned NULL for "Microsoft IntelliMouse Explorer"
(EE) config/hal: NewInputDeviceRequest failed (8)

*unplug/plug in USB cord*

(II) config/hal: Adding input device Microsoft IntelliMouse Explorer
(WW) Microsoft IntelliMouse Explorer: No Device specified, looking for one...
(II) Microsoft IntelliMouse Explorer: Setting Device option to "/dev/sysmouse"
(--) Microsoft IntelliMouse Explorer: Device: "/dev/sysmouse"
(==) Microsoft IntelliMouse Explorer: Protocol: "Auto"
(**) Microsoft IntelliMouse Explorer: always reports core events
(**) Option "Device" "/dev/sysmouse"
(==) Microsoft IntelliMouse Explorer: Emulate3Buttons, Emulate3Timeout: 50
(**) Microsoft IntelliMouse Explorer: ZAxisMapping: buttons 4 and 5
(**) Microsoft IntelliMouse Explorer: Buttons: 9
(II) XINPUT: Adding extended input device "Microsoft IntelliMouse Explorer" (type: MOUSE)
(**) Microsoft IntelliMouse Explorer: (accel) keeping acceleration scheme 1
(**) Microsoft IntelliMouse Explorer: (accel) acceleration profile 0
(II) Microsoft IntelliMouse Explorer: SetupAuto: hw.iftype is 4, hw.model is 0
(II) Microsoft IntelliMouse Explorer: SetupAuto: protocol is SysMouse

/etc/rc.conf

Code:
hald_enable="YES"
dbus_enable="YES"
moused_type="auto"
moused_enable="YES"

/root/xorg.conf.new

Code:
Section "ServerLayout"
	Identifier     "X.org Configured"
	Screen      0  "Screen0" 0 0
	InputDevice    "Mouse0" "CorePointer"
	InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
	ModulePath   "/usr/local/lib/xorg/modules"
	FontPath     "/usr/local/lib/X11/fonts/misc/"
	FontPath     "/usr/local/lib/X11/fonts/TTF/"
	FontPath     "/usr/local/lib/X11/fonts/OTF"
	FontPath     "/usr/local/lib/X11/fonts/Type1/"
	FontPath     "/usr/local/lib/X11/fonts/100dpi/"
	FontPath     "/usr/local/lib/X11/fonts/75dpi/"
EndSection

Section "Module"
	Load  "extmod"
	Load  "record"
	Load  "dbe"
	Load  "glx"
	Load  "dri"
	Load  "dri2"
EndSection

Section "InputDevice"
	Identifier  "Keyboard0"
	Driver      "kbd"
EndSection

Section "InputDevice"
	Identifier  "Mouse0"
	Driver      "mouse"
	Option	    "Protocol" "auto"
	Option	    "Device" "/dev/sysmouse"
	Option	    "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
	#DisplaySize	  440   250	# mm
	Identifier   "Monitor0"
	VendorName   "ACR"
	ModelName    "S200HL"
	HorizSync    31.0 - 80.0
	VertRefresh  56.0 - 76.0
	Option	    "DPMS"
EndSection

Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz"
        ### [arg]: arg optional
        #Option     "SWcursor"           	# [<bool>]
        #Option     "HWcursor"           	# [<bool>]
        #Option     "NoAccel"            	# [<bool>]
        #Option     "ShadowFB"           	# [<bool>]
        #Option     "UseFBDev"           	# [<bool>]
        #Option     "Rotate"             	# [<str>]
        #Option     "VideoKey"           	# <i>
        #Option     "FlatPanel"          	# [<bool>]
        #Option     "FPDither"           	# [<bool>]
        #Option     "CrtcNumber"         	# <i>
        #Option     "FPScale"            	# [<bool>]
        #Option     "FPTweak"            	# <i>
        #Option     "DualHead"           	# [<bool>]
	Identifier  "Card0"
	Driver      "nvidia"
	VendorName  "NVIDIA Corporation"
	BoardName   "NV20 [GeForce3]"
	BusID       "PCI:1:0:0"
EndSection

Section "Screen"
	Identifier "Screen0"
	Device     "Card0"
	Monitor    "Monitor0"
	SubSection "Display"
		Viewport   0 0
		Depth     1
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     4
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     8
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     15
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     16
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     24
	EndSubSection
EndSection

It usually runs alright after that, but is about 10 years old so I replaced it today with a Razer. :)
 
Trihexagonal said:
I sometime have to unplug and replug the cord on my USB mouse to get it to start after running startx and had to do so today.

(...)

/etc/rc.conf

Code:
hald_enable="YES"
dbus_enable="YES"
moused_type="auto"
moused_enable="YES"

I repeat, disable hald in your /etc/rc.conf.
 
fmw said:
I've had the same problem for some 5 or so weeks now, but I can't pinpoint it because it's a sporadic error.

That's why I posted my logs.
 
Back
Top