I searched Google for this, and I never saw anything that gave a step-by-step instruction on setting up a wheel mouse to work in X under FreeBSD. So, hopefully this will be useful to someone else!

I'm running FreeBSD 4.9, which has X version 4.3.0. I'm pretty sure that it will work on other versions. I've also used this with FreeBSD 4.8 and 4.6.2. I've got a $4 US optical wheel mouse that runs on the PS/2 port.

First, you have to configure moused, the console mouse daemon, equivalent to gpm under Linux. For my PS/2 mouse, the FreeBSD installer added these lines to my /etc/rc.conf:

Code:
moused_enable="YES"
moused_flags=""
moused_port="/dev/psm0"
moused_type="auto"
That sets up [b]moused[b] to use a PS/2 mouse, but it doesn't enable the wheel. This setup is fine if all you'd want to do is cut and paste in the console, or you didn't need wheel functionality in X. But, we need wheels!

To make moused recognize the wheel, we simply add a flag to moused:

Code:
moused_enable="YES"
moused_flags="-z 4"
moused_port="/dev/psm0"
moused_type="auto"
adding the -z 4 flag makes moused recognize the wheel, allowing you to use it in X, or for whatever else you'd need to use the wheel for.

Now, you'd just need to configure X to use the sysmouse device as the InputDevice in X. The InputDevice of your XF86Config file should look like this:

Code:
Section "InputDevice"
        Identifier  "Mouse0"
        Driver      "mouse"
        Option      "Protocol" "auto"
        Option      "Device" "/dev/sysmouse"
        Option      "Buttons" "5"
EndSection
/dev/sysmouse is akin to /dev/gpmdata. It works just like gpm's device would work in X under Linux.

Reboot, and you'll be ready to scroll in X!