Search this site





USB Mouse support in newmoused, working.

I've got my usb mouse working with the new moused. Most of the code in the module is ripped from usbhidctl(1). Now that I *actually* know how things work, I found that the read() wasn't actually one with side effects. Good.

You'll need the new moused framework for this module.

Basic instructions:

  1. Download my moused framework (newpsm project on this site)
  2. Recompile your kernel without "device ums"
  3. Build moused, build the usbmouse module.
  4. Run moused: ./moused -m usbmouse -d /dev/uhid0
If it doesn't work, let me know.


Future plans:

  • Rewrite ugly bits
  • Port ums(4) hacks for broken mice
  • Test with more mice
  • Write uhid joypad support

USB Mouse support in-progress for newmoused/newpsm

I started working on usb (usbhid) mouse support for my newpsm/newmoused project. So far so good, I can probe /dev/uhidX devices and figure out if it's a mouse or not. Thankfully, usb hid is very easy. Unfortunately, FreeBSD (NetBSD's) implementation is somewhat crazy with the voodoo.

To see what I mean, look at: src/usr.sbin/usbhidct/usbhid.c.

Look near line 230 (the only read() call in the file). Notice the read() call, but 'dbuf' is NEVER used meaningfully. More specifically, the read is mostly ignored and a loop is done over the 'hids' list. Looks like read()s on usbhid devices pushes data to special places in memory which can be found by using hid_start_parse(). A read() shouldn't be doing this. This is the job for an ioctl() or something. read(), to me, says "give me data so I can use it" - not "update some magic places in memory, thanks"


FreeBSD 6.1 sparc64 as a desktop

I have an ultra10 here that was, until today, running Solaris 10 and was my desktop. Now, I have opted to install FreeBSD on it to see how it runs. I now have X running happily. Documentation on the specific pieces of information I wanted was sparse, so here's what I know now:

  • If your sparc64 is old and lacks USB, the mouse will show up as a serial device. The mouse device is the uart device immediately following the keyboard one:
    uart0:  on puc0
    uart0: CTS oflow
    uart1:  on puc0
    uart1: CTS oflow
    uart2: <16550 or compatible> addr 0x14003083f8-0x14003083ff irq 41 on ebus0
    uart2: keyboard (1200,n,8,1)
    uart3: <16550 or compatible> addr 0x14003062f8-0x14003062ff irq 42 on ebus0
    Here, uart3 is my mouse.
    This means that /dev/cuau3 is my mouse. So I add this in rc.conf:
    Run /etc/rc.d/moused start, and the mouse works.
  • X needs to be told what keyboard map you are using. I used X -configure to generate my xorg.conf. A few changes are necessary:

    I have a Sun type5 keyboard, so, in my xorg.conf:

    Section "InputDevice"
       Identifier  "Keyboard0"
       Driver      "kbd"
       Option  "AutoRepeat" "400 30"
       Option "XkbRules" "sun"
       Option "XkbModel" "type5"
       Option "XkbLayout" "us"
       Option "XkbKeycodes" "sun(type5)"
  • X needs to be told about the monitor and what proper resolution:
    Section "Monitor"
            Identifier   "Monitor0"
            VendorName   "Monitor Vendor"
            ModelName    "Monitor Model"
            HorizSync 31.5-110
            VertRefresh 75
    Section "Screen"
            Identifier "Screen0"
            Device     "Card0"
            Monitor    "Monitor0"
            DefaultDepth 16
            SubSection "Display"
                    Depth     16
                    Modes "1024x768"

Firefox horizontal scrolling fix

Firefox, by default, seems to be very braindead about horizontal scrolling. It goes back/foreward by default. I want it to scroll. To do this, you need to make two changes to your configuration.

Go to 'about:config' in your URL bar in Firefox. If you've never done this before, literally type 'about:config' in the URL bar and hit enter. This will bring up a list of user settings. In the search bar, type 'mouse' and change the following values:

mousewheel.horizscroll.withnokey.action - Set this to '1'
mousewheel.horizscroll.withnokey.numlines - Set this to '1'
The action defaults to 2, which means go forward/back. Annoying.

The numlines defaults to -1, which scrolls left when you use the mouse to attempt scrolling right. Setting it to 1 will make it scroll left when you scroll left, as it should.

Voila! Horizontal scrolling should now work properly.

newpsm/newmoused update - merge into -CURRENT preparation

Lots of hours were spent today preparing the new moused and psm code for import into the FreeBSD source tree. I don't have a commit bit to CVS, so I'll have to wait on having it committed. This wait time will probably be spent fixing bugs, writing a decent rc script, and improving configuration options.

This update is only known to work for -CURRENT. The patch can be found on the newpsm project page. I had a friend test the patch against 6.0-RELEASE, and it seemed to apply cleanly with the exception that patch(1) got confused about sys/sys/mouse.h. Tell patch to not attempt to reverse-apply the patch, then tell it yes for trying the patch anyway. No guarantees if it doesn't build.

You can find almost all the information you need on the newpsm project page. If you find bugs, are interested in helping test, or have questions or comments, please contact me :)

Configuration file support added to moused and its modules

With the simple api that is getcap(3), moused and it's device modules will soon be able to be configurable from config files. The code is still in perforce to do this, however, and not on this site (at time of writing). A simple config file could be something like this:
This would modify options ONLY for the synaptics driver and enable "virtual scrolling" and disable the touchpad. Currently, only 'notouchpad' is supported (again, at time of writing).

I really want to add lots of options, mostly for synaptics support, but this would allow for some serious flexibility in mouse configuration. You can specify any kind of mouse you want and whatever config you please. Personally, I'd love to see an option to disable movement on the touchpad, and only allow the touchpad to be used for scrolling. Furthermore, allow me to decrease the sensitivity of the touchpad so that near-finger touches and palm touches don't trigger scrolling.

Wee! I love programming for fun. Makes me glad I'm not going to ever be a software developer. I like to code for myself and for my own goals.