Logitech Marble Mouse on FreeBSD 12.1

Here are my notes for using a Marble Mouse with FreeBSD 12. I describe two methods: one using moused, and another using Xorg.

With moused

This method has the benefit of working "out of the box", and one will have a cursor available on their console. However, horizontal scrolling is not available and middle-button emulation is only possible by simultaneously pressing the left and right buttons.

/etc/rc.conf

moused_enable="YES"
moused_port="/dev/ums0" # This is the USB mouse
moused_type="auto"
moused_flags="-w 4 -V -H"

With Xorg

This method provides better features, at the cost of being more complicated. It also does not allow for new devices (keyboards or mice) to hotplug. This is the method I personally use with my workstation because moused doesn't play well with my Wacom tablet. It requires xmodmap as the user to remap the small button to middle-click. If you can't get this to work, be absolutely sure moused isn't running.

/etc/rc.conf

moused_enable="NO"

/etc/X11/xorg.conf

Section "ServerFlags"
	Option "AutoAddDevices" "false"
EndSection

Section "InputDevice"
	Identifier "Mouse0"
	Driver "mouse"
	Option "Protocol" "Auto"
	Option "Device" "/dev/ums0"  # This is the USB mouse
	Option "Buttons" "9"
	Option "ZAxisMapping" "4 5"
	Option "XAxisMapping" "6 7"
	Option "EmulateWheel" "true"
	Option "EmulateWheelButton" "8"
	Option "Resolution" "500"
	Option "HorizontalScrolling" "true"
EndSection

~/.xmodmap

pointer = 1 8 3 4 5 6 7 2 9
Go home