[LWN Logo]
[LWN.net]
From:	 Adam Goode <adam@evdebs.org>
To:	 linux-usb-devel@lists.sourceforge.net
Subject: [linux-usb-devel] Writing a force feedback mouse driver
Date:	 Thu, 26 Jul 2001 23:03:18 -0400

Greetings,

I am working on writing a driver + userspace library to support the
tactile features of the Logitech iFeel mouse.

If you're not familiar with the device, the iFeel mouse has a small
motor embedded within. As you move the mouse over icons and menus in
Windows, you feel like you're running over little bumps and
ridges. Dragging windows around creates a unique sensation of pulling
something over a rough surface. The effects are customizable through
themes, and the strength of the feedback is adjustable. Games, notibly
Black and White, support these features to good effect. To me, the
mouse provides a wonderful experience (currently missing on Linux).

I need some help figuring out the best way to support it under Linux.

Normally, the mouse works as a standard HID device, which is handled
perfectly fine by the standard HID driver. The motor in the mouse is
controlled by a control packet to the interface (requesttype 0x21)
containing a 7-byte data packet. This packet tells the mouse to
vibrate at a certain speed, at a certain strength, for a certain
amount of time. The protocol was nearly trivial to observe and figure
out.

I'm thinking of various ways to export this to userspace, almost certainly
through an ioctl (is there another good way?). I have a few questions:

 1. Should I create a new device, like /dev/usb/tactile[0..n], or try
    modifying the existing mouse devices (probably not a good idea)?
    Since each mouse can be controlled seperately, does it make sense
    to have multiple dev nodes per physical device?
    (Like /dev/input/mouse0 <--> /dev/usb/tactile0 ?)

 2. To avoid re-implementing the entire HID system, is there a way to
    just "subclass" the functionality of the HID, while just adding
    a few extra device-specific features? I want to avoid duplication
    and also want to keep the HID driver's functionality. (There are
    at least two forms of this mouse, with different numbers of
    buttons, etc., and the HID driver handles these cases automatically.)
    It makes sense to me that you might be able to have the class driver
    handle most things in the mouse, while my driver handles just the
    feedback. Can two drivers claim the same interface?


That's about it for now. I'm just sending this to linux-usb-devel,
because I think it's a fairly specialized set of questions. If anyone
would like to forward this to the lkml, you have my permission.

I have started a SourceForge project. If anyone is interested,
you can view it at http://sf.net/projects/tactile/ . There's not
much there now at all, but I'll slowly add stuff as I work on it.
If anyone wants to join the project, please let me know.

Eventually, I hope to write a userspace library, and get support
integrated into GTK+ and Qt (if those guys are interested). If anyone
here is involved with those projects, please let me know what you think!



For the curious, a few random links to reviews:
http://www.techtv.com/freshgear/firstlook/story/0,23008,3001440,00.html
http://pc.ign.com/hardware/283.html



Adam

_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
http://lists.sourceforge.net/lists/listinfo/linux-usb-devel