Using haptic interfaces with GNU/Linux

iFeel and TouchSense Mice

There is a kernel module which supports the Logitech iFeel mouse. Its called ifeel, you can download it here: http://sourceforge.net/projects/tactile. ifeel does not work with all kernel versions. In fact, it often causes a kernel panic with kernels older than 2.4.22.

These worked:
These did not work:

To install the ifeel kernel module:

Supported Mice

Belkin nostromo n30 (F8GDPC001)
This isn't supported by the ifeel Linux kernel module yet, but it should be easy to do.
Logitech iFeel (M-UN58a/830604-0000)
It is dark grey with light grey buttons. Its kind of a crappy mouse, but it vibrates.
HP Force Feedback Web Mouse (H7011)
This isn't supported by the ifeel Linux kernel module yet, but it should be easy to do.
Saitek Touch Force Optical ()
This isn't supported by the ifeel Linux kernel module yet, but it should be easy to do.

I-Force and TouchSense Joysticks

I am using a Saitek Cyborg 3D Force joystick. To make it work, you need to make the minor change below. You need to use the libff patches to get this joystick to work.

These worked:
These did not work:

Supported Joysticks

There is a good discussion about this in the libff-kernel archives.

Saitek Cyborg 3D Force

Not all of this joystick's force effects work with Linux iforce, but some do. To make more of them work, you need to make a minor change to the kernel sources. In linux/drivers/char/joystick/iforce/iforce-main.c in the kernel sources, at about line 185, comment this out:

				  if (test_bit(FF_CORE_UPDATE, iforce->core_effects[effect->id].flags)) {
				          return -EAGAIN;
				  }
				
AVB Pegasus Force Joystick

Apparently, "the AVB pegasus works like a charm with iforce.o." But I haven't tried it.

Logitech Wingman Force Joystick

This is supposed to be well supported, but I don't have one, so I don't know. A lot of people had problems getting it to work.

Using the I-Force joystick together with the iFeel mouse

The I-Force joysticks only seem to work with kernels older than 2.4.23 and the iFeel mice only seem to work with kernels newer than 2.4.21. So obvioiusly, 2.4.22 is the only option. You'll need to compile the iforce-standalone modules or apply the iforce patch.

Instead of using input, evdev, and iforce from the kernel sources, the modules from iforce-standalone must be used. Another key aspect of getting everything working together is the order that the kernel modules are ordered. This is the only order that worked for me:

  1. input
  2. evdev
  3. iforce
  4. ifeel

None of the HID or Input Event kernel modules should be loaded before you load the above list. This includes:

This is my script for making sure everything is loaded in the proper order: ff.sh

# these are not used by I-Force and iFeel devices
rmmod keybdev
rmmod mousedev
rmmod usbkbd
rmmod usbmouse
rmmod joydev
rmmod hid

# these will be re-added in the correct order
rmmod ifeel
rmmod iforce
rmmod evdev
rmmod input

sleep 1

# required before ifeel/iforce
insmod /usr/src/iforce-standalone/input.o
insmod /usr/src/iforce-standalone/evdev.o
modprobe keybdev

# for both to work, iforce needs to be first
sleep 1
insmod /usr/src/iforce-standalone/iforce.o

sleep 1
insmod /usr/src/iFeel/ifeel.o
	 

Kernel Modules

To support iFeel and I-Force devices, special kernel modules are needed. Here is a survey of the options:

ff patch

includes iforce and hid patches

iforce patch

just the patches necessary for the iforce modules.

iforce-standalone

just the code necessary for the iforce modules, with seemingly cripppled versions of input and evdev.

Errors

When I compiled everything without commenting out the section mentioned above for the Saitek joystick, fftest gives me these errors:
Force feedback test program.
HOLD FIRMLY YOUR WHEEL OR JOYSTICK TO PREVENT DAMAGES
			 
Device /dev/input/event0 opened
Axes query: Axis X Axis Y
Effects: Constant
Number of simultaneous effects: 8
Upload effects[0]: Invalid argument
Upload effects[2]: Invalid argument
Upload effects[3]: Invalid argument
Upload effects[4]: Invalid argument
Upload effects[5]: Invalid argument
Enter effect number, -1 to exit
		  

This can be fixed by commenting out the chunk in iforce-main.c mentioned above.

Running evtest on the joystick device gives you a constant stream of data even though the joystick isn't moving. (The above error happens also).

This hid kernel module is installed and has claimed the joystick device. Remove the hid kernel module (rmmod hid) and it should work fine.

The best I have been able to do on my PowerBook G4 is this, it means that the I-Force aspect of the device was not recognized or claimed by any kernel module:
Force feedback test program.
HOLD FIRMLY YOUR WHEEL OR JOYSTICK TO PREVENT DAMAGES
 
Device /dev/input/event5 opened
Axes query:
Effects:
Number of simultaneous effects: 0
Upload effects[0]: Function not implemented
Upload effects[1]: Function not implemented
Upload effects[2]: Function not implemented
Upload effects[3]: Function not implemented
Upload effects[4]: Function not implemented
Upload effects[5]: Function not implemented
Enter effect number, -1 to exit
		  

Troubleshooting

This one worked. Its an Athlon K7 running 2.4.22 compiled from source.
usb.c: registered new driver ifeel
ifeel.c: v0.51:Logitech iFeel USB mouse driver
ehci_hcd 00:02.2: GetStatus port 1 status 001403 POWER sig=k  CSC CONNECT
hub.c: port 1, portstatus 501, change 1, 480 Mb/s
hub.c: port 1 connection change
hub.c: port 1, portstatus 501, change 1, 480 Mb/s
hub.c: port 1, portstatus 501, change 0, 480 Mb/s
hub.c: port 1, portstatus 501, change 0, 480 Mb/s
hub.c: port 1, portstatus 501, change 0, 480 Mb/s
hub.c: port 1, portstatus 501, change 0, 480 Mb/s
ehci_hcd 00:02.2: port 1 low speed --> companion
ehci_hcd 00:02.2: GetStatus port 1 status 003402 POWER OWNER sig=k  CSC
hub.c: port 1, portstatus 0, change 1, 12 Mb/s
ehci_hcd 00:02.2: free_config  devnum 0
hub.c: port 2, portstatus 100, change 0, 12 Mb/s
hub.c: port 3, portstatus 100, change 0, 12 Mb/s
hub.c: port 4, portstatus 100, change 0, 12 Mb/s
hub.c: port 5, portstatus 100, change 0, 12 Mb/s
hub.c: port 6, portstatus 100, change 0, 12 Mb/s
hub.c: port 1, portstatus 301, change 1, 1.5 Mb/s
hub.c: port 1 connection change
hub.c: port 1, portstatus 301, change 1, 1.5 Mb/s
hub.c: port 1, portstatus 301, change 0, 1.5 Mb/s
hub.c: port 1, portstatus 301, change 0, 1.5 Mb/s
hub.c: port 1, portstatus 301, change 0, 1.5 Mb/s
hub.c: port 1, portstatus 301, change 0, 1.5 Mb/s
hub.c: port 1, portstatus 303, change 10, 1.5 Mb/s
hub.c: new USB device 00:02.0-1, assigned address 6
usb.c: kmalloc IF c887ea00, numif 1
usb.c: skipped 1 class/vendor specific interface descriptors
usb.c: new device strings: Mfr=4, Product=32, SerialNumber=0
usb.c: USB device number 6 default language ID 0x409
Manufacturer: Logitech Inc.
Product: iFeel Mouse   
input: Logitech Inc. iFeel Mouse    on usb1:6.0
usb.c: ifeel driver claimed interface c887ea00
usb.c: kusbd: /sbin/hotplug add 6
hub.c: port 2, portstatus 100, change 0, 12 Mb/s
hub.c: port 3, portstatus 100, change 0, 12 Mb/s		 
		  
This is a transcript of usb logs of an iFeel attempt with linux-2.4.21-ff on a Pentium III. Notice that the device is claimed by the ifeel module. That's good. Notice also that the hid module kicks in after the ifeel module. That's also good, it means that ifeel claimed the device first. Unfortunately, sending data to the iFeel mouse still causes an instant kernel panic.
usb.c: registered new driver ifeel
ifeel.c: v0.51:Logitech iFeel USB mouse driver
hub.c: port 1, portstatus 301, change 1, 1.5 Mb/s
hub.c: port 1 connection change
hub.c: port 1, portstatus 301, change 1, 1.5 Mb/s
hub.c: port 1, portstatus 301, change 0, 1.5 Mb/s
hub.c: port 1, portstatus 301, change 0, 1.5 Mb/s
hub.c: port 1, portstatus 301, change 0, 1.5 Mb/s
hub.c: port 1, portstatus 301, change 0, 1.5 Mb/s
hub.c: port 1, portstatus 303, change 0, 1.5 Mb/s
hub.c: new USB device 00:14.2-1, assigned address 3
usb.c: kmalloc IF c98bfbc0, numif 1
usb.c: skipped 1 class/vendor specific interface descriptors
usb.c: new device strings: Mfr=4, Product=32, SerialNumber=0
usb.c: USB device number 3 default language ID 0x409
Manufacturer: Logitech Inc.
Product: iFeel Mouse   
input.c: calling /sbin/hotplug input [HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin ACTION=add PRODUCT=3/46d/c030/101 NAME=Logitech Inc. iFeel Mouse   ]
input: Logitech Inc. iFeel Mouse    on usb1:3.0
usb.c: ifeel driver claimed interface c98bfbc0
usb.c: kusbd: /sbin/hotplug add 3
hub.c: port 2, portstatus 100, change 0, 12 Mb/s
hub.c: port 1, portstatus 303, change 0, 1.5 Mb/s
hub.c: port 2, portstatus 100, change 0, 12 Mb/s
usb.c: registered new driver hiddev
usb.c: registered new driver hid
hid-core.c: v1.31:USB HID core driver
mice: PS/2 mouse device common for all mice
This is a transcript from an Athlon K7 based PC running linux-2.4.21-pre2-ff. The iFeel causes a kernel panic but doesn't bring the whole machine down like the above example.
usb.c: registered new driver ifeel
ifeel.c: v0.51:Logitech iFeel USB mouse driver
ehci-hub.c: GetStatus port 1 status 001403 POWER sig=k  CSC CONNECT
hub.c: port 1, portstatus 501, change 1, 480 Mb/s
hub.c: port 1 connection change
hub.c: port 1, portstatus 501, change 1, 480 Mb/s
hub.c: port 1, portstatus 501, change 0, 480 Mb/s
hub.c: port 1, portstatus 501, change 0, 480 Mb/s
hub.c: port 1, portstatus 501, change 0, 480 Mb/s
hub.c: port 1, portstatus 501, change 0, 480 Mb/s
ehci-hub.c: 00:02.2 port 1 low speed, give to companion
ehci-hub.c: GetStatus port 1 status 003402 POWER OWNER sig=k  CSC
hub.c: port 1, portstatus 0, change 1, 12 Mb/s
ehci-hcd.c: 00:02.2: free_config devnum 0
hub.c: port 2, portstatus 100, change 0, 12 Mb/s
hub.c: port 3, portstatus 100, change 0, 12 Mb/s
hub.c: port 4, portstatus 100, change 0, 12 Mb/s
hub.c: port 5, portstatus 100, change 0, 12 Mb/s
hub.c: port 6, portstatus 100, change 0, 12 Mb/s
hub.c: port 1, portstatus 301, change 1, 1.5 Mb/s
hub.c: port 1 connection change
hub.c: port 1, portstatus 301, change 1, 1.5 Mb/s
hub.c: port 1, portstatus 301, change 0, 1.5 Mb/s
hub.c: port 1, portstatus 301, change 0, 1.5 Mb/s
hub.c: port 1, portstatus 301, change 0, 1.5 Mb/s
hub.c: port 1, portstatus 301, change 0, 1.5 Mb/s
hub.c: port 1, portstatus 303, change 10, 1.5 Mb/s
hub.c: new USB device 00:02.0-1, assigned address 2
usb.c: kmalloc IF cf5f8c00, numif 1
usb.c: skipped 1 class/vendor specific interface descriptors
usb.c: new device strings: Mfr=4, Product=32, SerialNumber=0
usb.c: USB device number 2 default language ID 0x409
Manufacturer: Logitech Inc.
Product: iFeel Mouse   
Unable to handle kernel paging request at virtual address 4440834c
 printing eip:
c0207dbf
*pde = 00000000
Oops: 0000
CPU:    0
EIP:    0010:[<c0207dbf>]    Not tainted
EFLAGS: 00010202
eax: 44408280   ebx: ceb70dec   ecx: 00000000   edx: ce776eb4
esi: 00000000   edi: ceb70e0c   ebp: cfe9fe34   esp: cfe9fe28
ds: 0018   es: 0018   ss: 0018
Process khubd (pid: 8, stackpage=cfe9f000)
Stack: d28ce46d ce776eb4 d2857c4c ceb70dc0 d28543fc ce77688c d28579c0 ceb70dec 
       d2857fc0 ce77688c c2c1fec0 cfe9feec d2854c89 d2857fc0 ce77688c d2857e48 
       ce776800 44408280 d28ce785 ce77688c d28cecdd 00000000 00000800 00000282 
Call Trace:    [<d28ce46d>] [<d2857c4c>] [<d28543fc>] [<d28579c0>] [<d2857fc0>]
  [<d2854c89>] [<d2857fc0>] [<d2857e48>] [<d28ce785>] [<d28cecdd>] [<c01a6346>]
  [<c0145825>] [<d28cef80>] [<d28cef60>] [<c02078af>] [<c0207b9e>] [<c0209c2e>]
  [<c020b591>] [<c020b77d>] [<c020b915>] [<c01055b8>]

Code: 8b 80 cc 00 00 00 85 c0 74 17 8b 40 1c 85 c0 74 10 52 8b 40 
		  

$Id: linux.html,v 1.3 2006/02/03 06:59:34 hans Exp $