Bug 171433 - x11/xorg: xorg + hal: mouse input devices psm0 and usm0 not correctly recognized ("No Device specified, looking for one")
Summary: x11/xorg: xorg + hal: mouse input devices psm0 and usm0 not correctly recogni...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-x11 (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-08 07:50 UTC by Martin Birgmeier
Modified: 2012-11-07 08:41 UTC (History)
0 users

See Also:


Attachments
patch-mouse-option (338 bytes, application/octet-stream)
2012-10-17 07:55 UTC, Henry Hu
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Birgmeier 2012-09-08 07:50:08 UTC
I have a laptop to which a Microsoft Nano Transceiver v2.0 is connected (via USB), which in turn has a Microsoft Wireless Mobile Mouse 4000 connected to it. This results in two mouse devices, /dev/psm0 and /dev/ums0. hal-device reports these correctly:

[... snip ...]
43: udi = '/org/freedesktop/Hal/devices/usb_device_45e_745_noserial_if1'
  freebsd.driver = 'ums'  (string)
  freebsd.unit = 0  (0x0)  (int)
  info.vendor = 'Microsoft'  (string)
  freebsd.device_file = '/dev/ums0'  (string)
  info.capabilities = { 'input', 'input.mouse' } (string list)
  info.category = 'input'  (string)
  input.device = '/dev/ums0'  (string)
  input.x11_driver = 'mouse'  (string)
  info.udi = '/org/freedesktop/Hal/devices/usb_device_45e_745_noserial_if1'  (string)
  info.subsystem = 'usb'  (string)
  info.product = 'Microsoft Nano Transceiver v2.0'  (string)
  info.bus = 'usb'  (string)
  usb.interface.number = 1  (0x1)  (int)
  usb.configuration_value = 1  (0x1)  (int)
  usb.num_configurations = 1  (0x1)  (int)
  usb.device_class = 0  (0x0)  (int)
  usb.device_subclass = 0  (0x0)  (int)
  usb.device_protocol = 0  (0x0)  (int)
  usb.is_self_powered = false  (bool)
  usb.can_wake_up = true  (bool)
  usb.max_power = 100  (0x64)  (int)
  usb.num_interfaces = 3  (0x3)  (int)
  usb.num_ports = 0  (0x0)  (int)
  usb.speed = 12  (double)
  usb.speed_bcd = 4608  (0x1200)  (int)
  usb.version = 2  (double)
  usb.product_id = 1861  (0x745)  (int)
  usb.vendor_id = 1118  (0x45e)  (int)
  usb.device_revision_bcd = 1588  (0x634)  (int)
  usb.serial = ''  (string)
  usb.product = 'Microsoft Nano Transceiver v2.0'  (string)
  usb.vendor = 'Microsoft'  (string)
  usb.bus_number = 0  (0x0)  (int)
  usb.level_number = 1  (0x1)  (int)
  usb.port_number = 3  (0x3)  (int)
  usb.configuration = ''  (string)
  usb.interface.class = 3  (0x3)  (int)
  usb.interface.subclass = 1  (0x1)  (int)
  usb.interface.protocol = 2  (0x2)  (int)
  usb.interface.description = ''  (string)
  usb.freebsd.devname = 'ums0'  (string)
  info.parent = '/org/freedesktop/Hal/devices/usb_device_45e_745_noserial'  (string)
  info.addons = { 'hald-addon-mouse-sysmouse' } (string list)
[... snip ...]
77: udi = '/org/freedesktop/Hal/devices/psm_0'
  platform.id = 'psm.0'  (string)
  freebsd.device_file = '/dev/psm0'  (string)
  info.capabilities = { 'input', 'input.mouse' } (string list)
  info.category = 'input'  (string)
  input.device = '/dev/psm0'  (string)
  input.x11_driver = 'mouse'  (string)
  info.addons = { 'hald-addon-mouse-sysmouse' } (string list)
  info.udi = '/org/freedesktop/Hal/devices/psm_0'  (string)
  info.subsystem = 'platform'  (string)
  info.product = 'PS/2 Mouse'  (string)
  info.parent = '/org/freedesktop/Hal/devices/atkbdc_0'  (string)
  freebsd.driver = 'psm'  (string)
  freebsd.unit = 0  (0x0)  (int)
[... snip ...]

However, since quite some time, the X server does not know about the pathnames to these devices and seems to go looking for it by itself, for each mouse device in turn always trying /dev/psm0 first - which is then already open for the second one, and the device is rejected.

Here is the relevant portion of the log file; the interesting line is where it says "(WW) PS/2 Mouse: No Device specified, looking for one..." - I believe the X server should have got this from hald?

[... snip ...]
X.Org X Server 1.7.7
Release Date: 2010-05-04
X Protocol Version 11, Revision 0
Build Operating System: FreeBSD 9.0-RELEASE amd64 
Current Operating System: FreeBSD mizar.xyzzy 9.0-RELEASE FreeBSD 9.0-RELEASE #2: Sun Apr  1 19:48:11 CEST 2012     root@mizar.xyzzy:/usr/obj/.../hal/z/SRC/FreeBSD/release/9.0.0/sys/XYZZY_SMP amd64
Build Date: 31 August 2012  07:47:24PM
[... snip ...]
(II) config/hal: Adding input device PS/2 Mouse
(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) PS/2 Mouse: No Device specified, looking for one...
(II) PS/2 Mouse: Setting Device option to "/dev/psm0"
(--) PS/2 Mouse: Device: "/dev/psm0"
(==) PS/2 Mouse: Protocol: "Auto"
(**) PS/2 Mouse: always reports core events
(**) Option "Device" "/dev/psm0"
(==) PS/2 Mouse: Emulate3Buttons, Emulate3Timeout: 50
(**) PS/2 Mouse: ZAxisMapping: buttons 4 and 5
(**) PS/2 Mouse: Buttons: 9
(II) XINPUT: Adding extended input device "PS/2 Mouse" (type: MOUSE)
(**) PS/2 Mouse: (accel) keeping acceleration scheme 1
(**) PS/2 Mouse: (accel) acceleration profile 0
(II) PS/2 Mouse: SetupAuto: hw.iftype is 3, hw.model is 0
(II) PS/2 Mouse: SetupAuto: protocol is PS/2
(II) PS/2 Mouse: ps2EnableDataReporting: succeeded
(II) config/hal: Adding input device Microsoft Nano Transceiver v2.0
(WW) Microsoft Nano Transceiver v2.0: No Device specified, looking for one...
(II) Microsoft Nano Transceiver v2.0: Setting Device option to "/dev/psm0"
(--) Microsoft Nano Transceiver v2.0: Device: "/dev/psm0"
(==) Microsoft Nano Transceiver v2.0: Protocol: "Auto"
(**) Microsoft Nano Transceiver v2.0: always reports core events
(**) Option "Device" "/dev/psm0"
(EE) xf86OpenSerial: Cannot open device /dev/psm0
        Device busy.
(EE) Microsoft Nano Transceiver v2.0: cannot open input device
(II) UnloadModule: "mouse"
(EE) PreInit returned NULL for "Microsoft Nano Transceiver v2.0"
(EE) config/hal: NewInputDeviceRequest failed (8)
(II) config/hal: Adding input device Microsoft Nano Transceiver v2.0
[... snip ...]

Now, I have dug out an old log file from January. Back then, everything was working correctly, as can be seen from the lines specifying the devices found (e.g., "(**) Microsoft Nano Transceiver v2.0: Device: "/dev/ums0""):

[... snip ...]
X.Org X Server 1.7.7
Release Date: 2010-05-04
X Protocol Version 11, Revision 0
Build Operating System: FreeBSD 9.0-RELEASE amd64 
Current Operating System: FreeBSD mizar.xyzzy 9.0-RELEASE FreeBSD 9.0-RELEASE #0 r229389M: Tue Jan  3 18:57:18 CET 2012  
   root@hal.xyzzy:/z/OBJ/FreeBSD/amd64/release/9.0.0/sys/XYZZY_SMP amd64
Build Date: 04 January 2012  08:07:14PM
[... snip ...]
(II) config/hal: Adding input device Microsoft Nano Transceiver v2.0
(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.6.0
        Module class: X.Org XInput Driver
        ABI class: X.Org XInput driver, version 7.0
(**) Microsoft Nano Transceiver v2.0: Device: "/dev/ums0"
(==) Microsoft Nano Transceiver v2.0: Protocol: "Auto"
(**) Microsoft Nano Transceiver v2.0: always reports core events
(**) Option "Device" "/dev/ums0"
(==) Microsoft Nano Transceiver v2.0: Emulate3Buttons, Emulate3Timeout: 50
(**) Microsoft Nano Transceiver v2.0: ZAxisMapping: buttons 4 and 5
(**) Microsoft Nano Transceiver v2.0: Buttons: 9
(**) Microsoft Nano Transceiver v2.0: Sensitivity: 1
(II) XINPUT: Adding extended input device "Microsoft Nano Transceiver v2.0" (type: MOUSE)
(**) Microsoft Nano Transceiver v2.0: (accel) keeping acceleration scheme 1
(**) Microsoft Nano Transceiver v2.0: (accel) acceleration profile 0
(II) Microsoft Nano Transceiver v2.0: SetupAuto: hw.iftype is 5, hw.model is 0
(II) Microsoft Nano Transceiver v2.0: SetupAuto: protocol is SysMouse
(WW) fcntl(28, F_SETOWN): Inappropriate ioctl for device
[... snip ...]
(II) config/hal: Adding input device PS/2 Mouse
(**) PS/2 Mouse: Device: "/dev/psm0"
(==) PS/2 Mouse: Protocol: "Auto"
(**) PS/2 Mouse: always reports core events
(**) Option "Device" "/dev/psm0"
(==) PS/2 Mouse: Emulate3Buttons, Emulate3Timeout: 50
(**) PS/2 Mouse: ZAxisMapping: buttons 4 and 5
(**) PS/2 Mouse: Buttons: 9
(**) PS/2 Mouse: Sensitivity: 1
(II) XINPUT: Adding extended input device "PS/2 Mouse" (type: MOUSE)
(**) PS/2 Mouse: (accel) keeping acceleration scheme 1
(**) PS/2 Mouse: (accel) acceleration profile 0
(II) PS/2 Mouse: SetupAuto: hw.iftype is 3, hw.model is 0
(II) PS/2 Mouse: SetupAuto: protocol is PS/2
(II) PS/2 Mouse: ps2EnableDataReporting: succeeded
(II) 3rd Button detected: disabling emulate3Button
(II) 3rd Button detected: disabling emulate3Button
[... snip ...]

I have not changed the xorg.conf since then, so I assume something has changed in the X server or hal.

The machine is running the latest ports, and I also recently recompiled all ports to make sure no spurious problems persisted.

How-To-Repeat: See the problem description.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2012-09-10 02:50:22 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-x11

reclassify and assign.
Comment 2 Boris Samorodov 2012-09-10 07:28:27 UTC
The same here with the latest ports tree.

I use xdm and the first session is almost always success. But if
a user closes the session, while next session a USB mouse may
fail to be detected. And at both diskless stations booting from
this server mouses stopped working also.

I had to add 'Option "AutoAddDevices" "Off"' and define input devices
at xorg.conf to get mouses back.

HTH
-- 
WBR, Boris Samorodov (bsam)
FreeBSD Committer, http://www.FreeBSD.org The Power To Serve
Comment 3 jb.1234abcd 2012-10-11 08:58:25 UTC
I have Lenovo ThinkPad with built-in PS/2 mouse (stick) and also plug
in external USB mouse.

$ lshal |egrep 'psm0|ums0'
  freebsd.device_file = '/dev/psm0'  (string)
  input.device = '/dev/psm0'  (string)
  freebsd.device_file = '/dev/ums0'  (string)
  usb.freebsd.devname = 'ums0'  (string)

$ ps auxwww |grep mouse
root       10274   0.5  0.1   9608   1532 ??  Ss   12:35AM    0:10.88
/usr/sbin/moused -p /dev/ums0 -t auto -I /var/run/moused.ums0.pid
root       10153   0.0  0.2  12248   3496 ??  I    12:34AM    0:00.28
hald-addon-mouse-sysmouse: /dev/psm0 (hald-addon-mouse-sy)
root       10293   0.0  0.2  12248   3488 ??  I    12:35AM    0:00.01
hald-addon-mouse-sysmouse: /dev/ums0 (hald-addon-mouse-sy)

Case 1:
both mouses: PS/2, USB plugged in

$ startx

PS/2 mouse becomes disabled, USB mouse seems to work (movable), but there is
a problem with responses to mouse clicks and commands in xterm (delay
in appearance of
typed input chars, missing output from commands).

$ cat /var/log/Xorg.0.log
X.Org X Server 1.7.7
Release Date: 2010-05-04
X Protocol Version 11, Revision 0
Build Operating System: FreeBSD 9.1-RC1 i386
Current Operating System: FreeBSD localhost.localdomain 9.1-RC2 FreeBSD 9.1-RC2
#0 r241133: Tue Oct  2 17:11:45 UTC 2012     root@obrian.cse.buffalo.edu:/usr/ob
j/usr/src/sys/GENERIC i386
Build Date: 03 October 2012  10:23:17PM
...
(WW) AllowEmptyInput is on, devices using drivers 'kbd', 'mouse' or
'vmmouse' will be disabled.
(WW) Disabling Mouse0
(WW) Disabling Keyboard0
...
(WW) PS/2 Mouse: No Device specified, looking for one...
(II) PS/2 Mouse: Setting Device option to "/dev/sysmouse"
(--) PS/2 Mouse: Device: "/dev/sysmouse"
(==) PS/2 Mouse: Protocol: "Auto"
(**) PS/2 Mouse: always reports core events
(**) Option "Device" "/dev/sysmouse"
(==) PS/2 Mouse: Emulate3Buttons, Emulate3Timeout: 50
(**) PS/2 Mouse: ZAxisMapping: buttons 4 and 5
(**) PS/2 Mouse: Buttons: 9
(II) XINPUT: Adding extended input device "PS/2 Mouse" (type: MOUSE)
(**) PS/2 Mouse: (accel) keeping acceleration scheme 1
(**) PS/2 Mouse: (accel) acceleration profile 0
(II) PS/2 Mouse: SetupAuto: hw.iftype is 4, hw.model is 0
(II) PS/2 Mouse: SetupAuto: protocol is SysMouse
(II) config/hal: Adding input device Optical Mouse
(WW) Optical Mouse: No Device specified, looking for one...
(II) Optical Mouse: Setting Device option to "/dev/sysmouse"
(--) Optical Mouse: Device: "/dev/sysmouse"
(==) Optical Mouse: Protocol: "Auto"
(**) Optical Mouse: always reports core events
(**) Option "Device" "/dev/sysmouse"
(==) Optical Mouse: Emulate3Buttons, Emulate3Timeout: 50
(**) Optical Mouse: ZAxisMapping: buttons 4 and 5
(**) Optical Mouse: Buttons: 9
(II) XINPUT: Adding extended input device "Optical Mouse" (type: MOUSE)
(**) Optical Mouse: (accel) keeping acceleration scheme 1
(**) Optical Mouse: (accel) acceleration profile 0
(II) Optical Mouse: SetupAuto: hw.iftype is 4, hw.model is 0
(II) Optical Mouse: SetupAuto: protocol is SysMouse
(II) config/hal: Adding input device AT Keyboard
...

Case 2:
mouses: PS/2 only (note: USB mouse will be plugged in after startx).

$ startx

PS/2 mouse works.

$ cat /var/log/Xorg.0.log
...
(WW) PS/2 Mouse: No Device specified, looking for one...
(II) PS/2 Mouse: Setting Device option to "/dev/psm0"
(--) PS/2 Mouse: Device: "/dev/psm0"
(==) PS/2 Mouse: Protocol: "Auto"
(**) PS/2 Mouse: always reports core events
(**) Option "Device" "/dev/psm0"
(==) PS/2 Mouse: Emulate3Buttons, Emulate3Timeout: 50
(**) PS/2 Mouse: ZAxisMapping: buttons 4 and 5
(**) PS/2 Mouse: Buttons: 9
(II) XINPUT: Adding extended input device "PS/2 Mouse" (type: MOUSE)
(**) PS/2 Mouse: (accel) keeping acceleration scheme 1
(**) PS/2 Mouse: (accel) acceleration profile 0
(II) PS/2 Mouse: SetupAuto: hw.iftype is 3, hw.model is 0
(II) PS/2 Mouse: SetupAuto: protocol is PS/2
(II) PS/2 Mouse: ps2EnableDataReporting: succeeded
(II) config/hal: Adding input device AT Keyboard
...
$

USB mouse plugged in.

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

Both mouses work.
Comment 4 Henry Hu 2012-10-17 07:55:13 UTC
I've made a patch and it seems to solve this problem.
This patch goes to x11-drivers/xf86-input-mouse. It changes
src/mouse.c. I've attached the patch.

It seems like that the hal configuration module correctly added the
"Device" option, in config/hal.c in xorg-server.
The xorg-server copied it into the IDevRec struct's commonOptions
field, in NewInputDeviceRequest() in hw/xfree86/common/xf86Xinput.c
Later, this struct is passed into xf86NewInputDevice(), and then
passed into mouse driver's MousePreInit().
However, there is a problem here. If the ABI version is old,
MousePreInit() calls NewMousePreInit(), and copied some info from
IDevPtr into InputInfoPtr, which is passed into NewMousePreInit().
But it does not copy the commonOptions field. So the options,
including the "Device" option, is lost.
This patch just copies IDevPtr.commonOptions into
InputInfoPtr.options, and then it works.



-- 
Cheers,
Henry
Comment 5 Henry Hu 2012-10-17 08:05:10 UTC
Seems like this is fixed in xf86-input-mouse 1.7.2:
http://cgit.freedesktop.org/xorg/driver/xf86-input-mouse/commit/?id=b65651974ee5620086b484086ea12d78c92fa369

We can just apply this commit and wait for the new version...

-- 
Cheers,
Henry
Comment 6 Martin Birgmeier 2012-10-18 19:27:22 UTC
That was it indeed. I applied the patch from the git repo, and now both
mice work normally.

Thank you for your help.

Regards,

Martin
Comment 7 Boris Samorodov 2012-10-18 21:00:10 UTC
Just a me too here. Both diskless stations and the server work with
the patch.

-- 
WBR, Boris Samorodov (bsam)
FreeBSD Committer, http://www.FreeBSD.org The Power To Serve
Comment 8 Boris Samorodov freebsd_committer freebsd_triage 2012-11-07 08:40:35 UTC
State Changed
From-To: open->closed

The patch from upstream was committed. Thanks for the report!