Mouse behavior: middle button behavior


#1

Hi all –

I’d like to enable my middle mouse button’s copy/paste feature and others, too:

  1. copy/paste (e.g. select text and click w/middle mouse button to paste)
  2. I’m accustomed to middle click to open links, etc

Unfortunately, I cannot recall the last time I had to enable any of these in vanilla FreeBSD, so I’m a bit perplexed. I’m using a Thinkpad (T470s), if that helps at all. rc-status shows that moused and moused.psm0 are both started.

Any thoughts or suggestions would be most welcome.
Best

Edit: I just plugged a USB mouse into the laptop and it behaves as I would expect:

  • middle mouse click on a browser link opens in a new tab
  • hilite text in a terminal, middle click in another terminal (w/active cursor) and copy/paste works
  • middle click on an OpenBox desktop shows all of the windows on all virtual desktops

What’s the difference? I’m not sure :slight_smile:


Discourse Question: editing post titles?
#2

Use xinput. Check properties.


#3

Hey @bsdtester - thanks, I’ll check that out. Appreciate the response!


#4

Again, I appreciate the response… unfortunately, xinput is basically telling me that there aren’t really any differences between the two systems I have access to right now.

# workstation
> xinput --list-props sysmouse
Device 'sysmouse':
	Device Enabled (152):	1
	Coordinate Transformation Matrix (153):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
	Device Accel Profile (265):	0
	Device Accel Constant Deceleration (266):	1.000000
	Device Accel Adaptive Deceleration (267):	1.000000
	Device Accel Velocity Scaling (268):	10.000000
	Device Node (269):	"/dev/sysmouse"
	Button Labels (270):	"Button Left" (155), "Button Middle" (156), "Button Right" (157), "Button Wheel Up" (158), "Button Wheel Down" (159)
	Mouse Middle Button Emulation (271):	1
	Mouse Middle Button Timeout (272):	50

and

# laptop
% xinput --list-props sysmouse
Device 'sysmouse':
        Device Enabled (137):   1
        Coordinate Transformation Matrix (138): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
        Device Accel Profile (251):     0
        Device Accel Constant Deceleration (252):       1.000000
        Device Accel Adaptive Deceleration (253):       1.000000
        Device Accel Velocity Scaling (254):    10.000000
        Device Node (255):      "/dev/sysmouse"
        Button Labels (256):    "Button Left" (140), "Button Middle" (141), "Button Right" (142), "Button Wheel Up" (143), "Button Wheel Down" (144)
        Mouse Middle Button Emulation (257):    1
        Mouse Middle Button Timeout (258):      50

#5

Use xev. Test, wether middle button is recognized, and as what button it is recognized: Number and name.


#6

With TrueOS the middle mouse button (or middle physical mouse button) isn’t recognized at all by xev - there’s no output to the terminal.

I have a Parted Magick USB and booted that and the middle mouse button is picked up by xev. I can post screenshots of the xev output, but maybe it’s sufficient to report that:

button 1 = left button 
button 2 = middle button
button 3 = right button

Looking through the Parted Magick /etc/X11/ is, uh, … different :slight_smile: and I’m not seeing anything overly obvious about the mouse configuration.

I’ll try adding the middle button w/xkb, or whatever the default utility is for TrueOS (if there is one) and report back.


#7

By default, TrueOS should set X to use the sysmouse driver, so you may need to tweak sysmouse config.

man sysmouse


#8

Thanks @mer - I’ll take a look there.


#9

@mer - hey thanks. Your suggestion got me on the right track.

In /etc/conf.d/moused there was an -3 flag being passed to moused. -3 seems to forcibly emulate a 3 button mouse on a 2 button mouse; i.e. assuming you have a two button mouse and you want copy/paste, the -3 flag lets you hilight text and then click left/right simultaneously to get middle button behavior.

Removing that flag seems to have done the trick. Thanks again to you and @bsdtester.


#10

The Honour belongs to ‘mer’. I give my part of Your thanks to him.


#11

No problem. Gald we got it figured out.


#12

HI all,
arrived here after 4 days of continues wrestling with the exactly same problem on fresh new vanilla installed trueos stable on hp g2 zbook17:

[dusan@second2none] /etc% xinput --list-props sysmouse
Device ‘sysmouse’:
Device Enabled (150): 1
Coordinate Transformation Matrix (151): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Accel Profile (263): 0
Device Accel Constant Deceleration (264): 1.000000
Device Accel Adaptive Deceleration (265): 1.000000
Device Accel Velocity Scaling (266): 10.000000
Device Node (267): “/dev/sysmouse”
Button Labels (268): “Button Left” (153), “Button Middle” (154), “Button Right” (155), “Button Wheel Up” (156), “Button Wheel Down” (157)
Mouse Middle Button Emulation (269): 1
Mouse Middle Button Timeout (270): 50

the headscratcher for me is where does the moused gets its -3 flag passed from now?

[dusan@second2none] /etc% ls -all /etc/conf.d/
total 6
drwxr-xr-x 2 root wheel 2 Mar 25 21:28 .
drwxr-xr-x 31 root wheel 126 May 20 23:51 …

as one can see above there is no “moused” there and i was not able to locate where does it come from on my rather extensive fishing trip in the surrounding areas…i see two instances of moused started in services GUI but where does it come from? in another words: who do these moused deamons work for? nothing in

[dusan@second2none] /etc% more rc.conf

ifconfig_em0=“ALL”
hostname=“second2none”
zfs_enable=“YES”
wlans_iwm0=“wlan0”
ifconfig_wlan0=“WPA DHCP”
kldload_nvidia=“nvidia-modeset nvidia”

nothing anywhere that i can see.

any help greatly appreciated

many thanks

dusan


#13

hi @dusan -

I have 3 different mouseds in /etc:

# find /etc -type f -name 'moused'
/etc/rc.d/moused
/etc/conf.d/moused
/etc/init.d/moused

If you don’t have one in /etc/conf.d you could try adding one; here’s mine:
moused_args_psm0="-A 1.5 -a 1 -r medium-low -V -H"

AFAICT on my system, the moused executables in rc.d and init.d don’t hold any flags.

HTH!


#14

HI, many thanks,

likewise, the executables hold no obvious flags, upon creating the one you kindly provided the console scrolling via synaptics came back, alas the output of :
[dusan@second2none] ~% xinput --list-props sysmouse
Device ‘sysmouse’:
Device Enabled (150): 1
Coordinate Transformation Matrix (151): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Accel Profile (263): 0
Device Accel Constant Deceleration (264): 1.000000
Device Accel Adaptive Deceleration (265): 1.000000
Device Accel Velocity Scaling (266): 10.000000
Device Node (267): “/dev/sysmouse”
Button Labels (268): “Button Left” (153), “Button Middle” (154), “Button Right” (155), “Button Wheel Up” (156), “Button Wheel Down” (157)
Mouse Middle Button Emulation (269): 1
Mouse Middle Button Timeout (270): 50

and action of the middle button remain unchanged = dormant = bypassed by 3 button emulation.

i will think about it while gardening a bit and in the meantime if anybody will have set of arguments that bypasses the emulation pls pls share it.

thanks

dusan


#15

There is an option to configure it through Lumina UI “Control Panel”->“Mouse settings”. Then you prob. can track the change to a specific config-file.


#16

i played with GUI first, and that maps exactly the string provided : moused_args_psm0="-A 1.5 -a 1 -r medium-low -V -H", it was behaving like that even before i created /etc/conf.d/moused, the only change after that was console scrolling coming alive and appearance of check mark at VIrtual Srcolling in the GUI

A 1.5 is the acceleration
a 1 is the linear
-r is the right handed
medium-low refers to the DPI
-V is virtual scrolling
-H Enable “Horizontal Virtual Scrolling”

my Lumina gui Mouse Settings does NOT display check at the Emulate Button 3 at all yet the system is set for that as can be easily proven by xinput and xev.

it must be coming from higher up in the system, i am looking through the boot process right now if i find any hints there.

interesting moment is when i check on the gui at the emulation line and click apply the whole mouse system crashes entirely . actually entire computer froze within 4 minutes and had to be hard rebooted via power button.

second bizarro thing is that the prior to click there was no “-3” in the /etc/conf.d/moused string yet the mouse behaved like it was present, after the GUI click “-3” appeared there and it just froze the whole thing. captain, i think we have a situation here.

i am absolutely convinced that the moused preset of -3 is coming somewhere from the boot process i just cannot find where from, but i am keeping at it at my spare time. :wink:

sorry for weird capitalization but i am on half functioning desktop right now after the hard reboot…

d


#17

[ 21.077] (II) LoadModule: “kbd”
[ 21.077] (II) Loading /usr/local/lib/xorg/modules/input/kbd_drv.so
[ 21.077] (II) Module kbd: vendor=“X_Org Foundation”
[ 21.077] compiled for 1.18.4, module version = 1.9.0
[ 21.077] Module class: X_Org XInput Driver
[ 21.077] ABI class: X_Org XInput driver, version 22.1
[ 21.077] (II) Using input driver ‘kbd’ for ‘kbdmux’
[ 21.077] () kbdmux: always reports core events
[ 21.077] (
) kbdmux: always reports core events
[ 21.077] () Option “Protocol” “standard”
[ 21.077] (
) Option “XkbRules” “base”
[ 21.077] () Option “XkbModel” “pc105”
[ 21.077] (
) Option “XkbLayout” “us”
[ 21.077] () Option “config_info” “devd:kbdmux”
[ 21.078] (II) XINPUT: Adding extended input device “kbdmux” (type: KEYBOARD, id 6)
[ 21.094] (II) config/devd: kbdmux is enabled, ignoring device atkbd0
[ 21.094] (II) config/devd: adding input device (null) (/dev/sysmouse)
[ 21.094] (II) LoadModule: “mouse”
[ 21.094] (II) Loading /usr/local/lib/xorg/modules/input/mouse_drv.so
[ 21.095] (II) Module mouse: vendor=“X_Org Foundation”
[ 21.095] compiled for 1.18.4, module version = 1.9.2
[ 21.095] Module class: X_Org XInput Driver
[ 21.095] ABI class: X_Org XInput driver, version 22.1
[ 21.095] (II) Using input driver ‘mouse’ for ‘sysmouse’
[ 21.095] (
) sysmouse: always reports core events
[ 21.095] () Option “Device” “/dev/sysmouse”
[ 21.095] (==) sysmouse: Protocol: “Auto”
[ 21.095] (
) sysmouse: always reports core events
[ 21.095] (==) sysmouse: Emulate3Buttons, Emulate3Timeout: 50
[ 21.095] () sysmouse: ZAxisMapping: buttons 4 and 5
[ 21.095] (
) sysmouse: Buttons: 5
[ 21.095] () Option “config_info” “devd:sysmouse”
[ 21.095] (II) XINPUT: Adding extended input device “sysmouse” (type: MOUSE, id 7)
[ 21.095] (
) sysmouse: (accel) keeping acceleration scheme 1
[ 21.095] () sysmouse: (accel) acceleration profile 0
[ 21.095] (
) sysmouse: (accel) acceleration factor: 2.000
[ 21.095] (**) sysmouse: (accel) acceleration threshold: 4
[ 21.095] (II) sysmouse: SetupAuto: hw.iftype is 4, hw.model is 0
[ 21.095] (II) sysmouse: SetupAuto: protocol is SysMouse
[ 21.095] (II) config/devd: device /dev/psm0 already opened

i suspect it is coming via devd somewhere but where from dear deity is the question that i have no answer for :

find: devd.rc: No such file or directory

even though /etc/devd.conf refers to it

p.s. for obvious reason of being a new user i modified all the x dot org in the log to x underscore org since the discourse deity tells me the new user cannot put more than two links in the post…


#18

In /etc/X11/xorg.conf or in one of the /usr/local/etc/X11/xorg.conf.d, sometimes ppl used to configure the InpuDevice section, like the following:

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

You might want to double check there is no conflicting settings there.

I’m not sure where did you find any reference to devd.rc. I couldn’t.

Anyway, looking at the /etc/init.d/moused source code, I see that config parameters are read through either moused_args_{moused_device_name} or moused_flags variable:

        local args=
        eval args=\$moused_args_${moused_device##*/}
        [ -z "$args" ] && args=$moused_flags

        start-stop-daemon --start --exec /usr/sbin/moused \
                --pidfile "$pidfile" \
                -- $args -p "$moused_device" -I "$pidfile"
        local retval=$?

which can be configured via /etc/rc.conf, /etc/rc.conf.local or /etc/conf.d/servicename, with the defaults defined in the /etc/defaults/rc.conf.

If you accidentally configured your mouse in multiple places, I’m not sure which one takes precedence.
Is there a chance you mistyped the device name in the moused_args_?


#19

This is fresh newly installed computer, i put in another harddrive and put xubuntu on it to verify the hardware is fully functional, it is uefi install of trueos on the entire dedicated harddrive. there is nothing else on the computer. i haven’t change anything in the xorg at all. There was no reason, it worked with the correct native resolution right after downloading nvidia driver and installing it via the login screen utility. before that it was on vesa driver and there was no point trying to do something with that.

mouse behaved exactly like this when I first logged in -. with middle mouse button set to be emulated by buttons 1 and 3. and physical button 2 not generating any event. i am trying to get normal behavior of the mouse back.

this is how it looked exactly after the installation and upon first login:
[dusan@second2none] ~% xinput --list-props sysmouse
Device ‘sysmouse’:
Device Enabled (150): 1
Coordinate Transformation Matrix (151): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Accel Profile (263): 0
Device Accel Constant Deceleration (264): 1.000000
Device Accel Adaptive Deceleration (265): 1.000000
Device Accel Velocity Scaling (266): 10.000000
Device Node (267): “/dev/sysmouse”
Button Labels (268): “Button Left” (153), “Button Middle” (154), “Button Right” (155), “Button Wheel Up” (156), “Button Wheel Down” (157)
Mouse Middle Button Emulation (269): 1
Mouse Middle Button Timeout (270): 50
[dusan@second2none] ~% more /etc/rc.conf
ifconfig_em0=“ALL”
hostname=“second2none”
zfs_enable=“YES”
wlans_iwm0=“wlan0”
ifconfig_wlan0=“WPA DHCP”
kldload_nvidia=“nvidia-modeset nvidia”
[dusan@second2none] ~% more /etc/rc.conf.local
/etc/rc.conf.local: No such file or directory
[dusan@second2none] ~% cd /etc/conf.d/
[dusan@second2none] /etc/conf.d% ls
[dusan@second2none] /etc/conf.d% ls -all
total 6
drwxr-xr-x 2 root wheel 2 May 21 20:28 .
drwxr-xr-x 31 root wheel 126 May 20 23:51 …
[dusan@second2none]

/etc/defaultts/rc.conf pertinent part for system console looks like this :
moused_nondefault_enable=“YES” # Treat non-default mice as enabled unless
# specifically overriden in rc.conf(5).
moused_enable=“NO” # Run the mouse daemon.
moused_type=“auto” # See man page for rc.conf(5) for available settings.
moused_port="/dev/psm0" # Set to your mouse port.
moused_flags="-A 1.5 -T 4" # Any additional flags to moused.
mousechar_start=“NO” # if 0xd0-0xd3 default range is occupied in your
# language code table, specify alternative range
# start like mousechar_start=3, see vidcontrol(1)

gui tool for services tells me there are indeed two moused
started for console moused and moused.psm0

there must be something somewhere that is passing that " -3 " argument to the ps/2 3 button mouse in front of me right above the synaptic touchpad or it would behave like 3 button mouse. but i cannot find it no matter where i look. that is where in the moment of absolute desperation i found part of devd.conf which says :

notify 100 {
match “system” “DEVFS”;
match “subsystem” “CDEV”;
match “type” “CREATE”;
match “cdev” “atp[0-9]+”;
action “/etc/rc.devd moused.$cdev start”;
};

notify 100 {
match “system” “DEVFS”;
match “subsystem” “CDEV”;
match “type” “CREATE”;
match “cdev” “ums[0-9]+”;
action “/etc/rc.devd moused.$cdev start”;
};

notify 100 {
match “system” “DEVFS”;
match “subsystem” “CDEV”;
match “type” “CREATE”;
match “cdev” “wsp[0-9]+”;
action “/etc/rc.devd moused.$cdev start”;
};

notify 100 {
match “system” “DEVFS”;
match “subsystem” “CDEV”;
match “type” “DESTROY”;
match “cdev” “ums[0-9]+”;
action “/etc/rc.devd moused.$cdev start”;
} ;
i have no idea if it has anything to do with my problem it was complete shot in the dark when i saw devd in my xorg.log

any help greatly appreciated.
my question is where does/would ps/2 moused have its rc or conf file stored? it must be coming from somewhere but i swear i didn’t set it that way. it was set that way during the installation
d


#20

[dusan@second2none] /var/log% cat /var/log/Xorg.0.log | grep -i mouse
[ 20.919] (==) NVIDIA(0): Silken mouse enabled
[ 20.999] (II) config/devd: adding input device (null) (/dev/sysmouse)
[ 20.999] (II) LoadModule: “mouse”
[ 20.999] (II) Loading /usr/local/lib/xorg/modules/input/mouse_drv.so
[ 21.002] (II) Module mouse: vendor=“X.Org Foundation”
[ 21.002] (II) Using input driver ‘mouse’ for ‘sysmouse’
[ 21.002] () sysmouse: always reports core events
[ 21.002] (
) Option “Device” “/dev/sysmouse”
[ 21.002] (==) sysmouse: Protocol: “Auto”
[ 21.002] () sysmouse: always reports core events
[ 21.002] (==) sysmouse: Emulate3Buttons, Emulate3Timeout: 50
[ 21.002] (
) sysmouse: ZAxisMapping: buttons 4 and 5
[ 21.002] () sysmouse: Buttons: 5
[ 21.002] (
) Option “config_info” “devd:sysmouse”
[ 21.002] (II) XINPUT: Adding extended input device “sysmouse” (type: MOUSE, id 7)
[ 21.002] () sysmouse: (accel) keeping acceleration scheme 1
[ 21.002] (
) sysmouse: (accel) acceleration profile 0
[ 21.002] () sysmouse: (accel) acceleration factor: 2.000
[ 21.002] (
) sysmouse: (accel) acceleration threshold: 4
[ 21.002] (II) sysmouse: SetupAuto: hw.iftype is 4, hw.model is 0
[ 21.002] (II) sysmouse: SetupAuto: protocol is SysMouse
[dusan@second2none] /var/log%

something is forcing the emulation and i just spent entire evening on it with 0 result beside my very sore behind.