LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices

Reply
 
Search this Thread
Old 01-22-2005, 08:55 PM   #1
clausawits
Member
 
Registered: Jun 2001
Posts: 128

Rep: Reputation: 16
USB Steering Wheel?


Hello all, anyone able to get a usb steering wheel (this one's force feedback, but even if I can't get that, I'll be ok..) working in Fedora Core 2 or 3? What steps need to be taken?

My FC2 computer doesn't seem to like it, and dmesg shows nothing when I plug it in..

Thanks for any help!
 
Old 01-23-2005, 12:29 AM   #2
Mega Man X
Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 63
I don't have experiences with that, but I believe it should work on the same way as a gamepad... Try loading the module:

modprobe joydev

To test if it's working, type cat /dev/js0. Now, when pressing any button on the wheel, you should get some weird chars at the terminal. It that works, then the wheel is working . If it does not, you may need to load further modules, as usb-uhci, hid and adi

Good luck!
 
Old 01-23-2005, 06:23 AM   #3
Mr Marmmalade
Member
 
Registered: Oct 2002
Location: Scotland
Distribution: Debian
Posts: 181

Rep: Reputation: 16
hi clausawits, i don't use fedora but i have spent some time messing with ffb wheel and i'm working on a how-to. it's pretty much fine & works for me. i've pasted it below. one difference for fedora would probably be the /etc/rc.d/rc.modules would be something like /etc/modules.conf. somebody who knows fedora should be able to confirm/correct what file i mean.

what wheel are you using?

let me know how you get on or if there's any mistakes in the how-to. i've still to do some work regarding my last comments on the readme.

Regards,

MrMarmalade.

*******************************

my wheel howto.txt.

NOTES:

i started from a clean system; fresh slackware 10 installation, default 2.4.26 kernel. i dont know how easily this will work with other linux distributions. if you have a 2.6.x kernel, much of this is probably unnecessary, you can probably just do steps 9 onwards.

i have a thrustmanster force feedback racing wheel (USB). this wheel uses an 'iforce' system, check if yours is first before attempting this, if not maybe there's some other module you could use in place of the 'iforce' one.



*** *** *** *** *** *** *** *** *** ***

***1. download these two files:
http://user.it.uu.se/~johannd/projec...dalone.tar.bz2
http://user.it.uu.se/~johannd/projec...-utils.tar.bz2

***2. extract them.
$ tar jxvf iforce-standalone.tar.bz2
$ tar jxvf ffutils.tar.bz2
i extracted each into the main user home directory (~), which created two new directories: ~/iforce-standalone/ & ~/ff-utils/.

***3. navigate into the modules directory.
$ cd ~/iforce-standalone/
and then do;
$ ./configure
$ make

***4. run lsmod and have a look at the output for any mentions of modules; input, evdev, iforce.
$ lsmod

***5. if any of the three modules appear on the list, remove them by typing;
$ rmmod module
where 'module' is whichever of input/evdev/iforce was shown from lsmod. i managed to do this even to the input module (just to experiment), and my keyboard & mouse kept working fine (but mine are both PS/2, not sure if USB ones would manage this. advised by Johann that USB should probably be fine too). if none of the three modules appeared then skip this step (i did).

***6. backup & gzip the three new modules;
$ cp input.o new_input.o
$ cp evdev.o new_evdev.o
$ cp iforce.o new_iforce.o
then gzip them;
$ gzip input.o
$ gzip evdev.o
$ gzip iforce.o

***7. move the original three kernel modules into a backup folder (don't just rename them in their original folder, this doesn't seem to work);
$ mkdir ~/iforce-standalone/old_modules/
$ cd ~/iforce-standalone/old_modules/
$ su
NOTE: stay in 'su' (super-user) mode until end of step 10. log out of 'su' with 'exit'.
$ mv /lib/modules/2.4.26/kernel/drivers/input/input.o.gz .
$ mv /lib/modules/2.4.26/kernel/drivers/input/evdev.o.gz .
$ mv /lib/modules/2.4.26/kernel/drivers/char/joystick/iforce.o.gz .
$ cd ..

***8. replace the old modules with the new ones;
$ cp input.o.gz /lib/modules/2.4.26/kernel/drivers/input/
$ cp evdev.o.gz /lib/modules/2.4.26/kernel/drivers/input/
$ cp iforce.o.gz /lib/modules/2.4.26/kernel/drivers/char/joystick/


***9. enable the three modules in /etc/rc.d/rc.modules by uncommenting or creating the following lines;
/sbin/modprobe joydev
/sbin/modprobe input
/sbin/modprobe evdev
/sbin/modprobe iforce
the first line isn't needed to get purely force feedback going, but i needed it to actually use the wheel later.

NOTE: i also use a joystick which needs the lines;
/sbin/modporbe joydev
/sbin/modprobe analog
/sbin/modprobe emu10k1-gp
but these conflict with the wheel drivers, so i make sure to only have one set loaded at a time. i do it via editing the rc.modules for whichever module set, then save & reboot.

***10. reboot or manaully type the lines in step 9.

***11. now we make /dev/input/eventX writable to a user group (i.e. 'games', which my main user belongs to). where 'X' must be replaced by the right number, '0' zero in my case (you may have to try, starting from 0 until you get the right one, i.e your wheel, not the keyboard or the mouse or another input device).:
$ su
$ chgrp games /dev/input/eventX
$ chmod g+w /dev/input/eventX
$ exit

NOTE: you will now need to log out as the main user and back in for this to work, or just quickly test it by double-logging-in; '$ su username' (it worked for me).

***12. test the force playback using the ff-utils:
$ cd ~/ff-utils/
$ ./fftest /dev/input/eventX
once into the program, try 0,1,2,3 (4 & 5 are gamepad rumble effects, not for steering wheels). i liked to test each separately, i.e. close (-1) and restart the program after each run.

*** *** *** *** *** *** *** *** *** ***

that's it. force feedback works. i installed wine(20050111) and installed Live for Speed S1, and the wheel worked... but only as non-force feedback. this issue is a wine and/or LFS issue, which i'll let Johann sum up;

"Yes, what now? That's how far I can get you. For applications actually making use of FF, you have to ask their developers. I don't know if any linux application available out there makes use of the driver. I have received several mails from people doing their own in-house software, but I don't know of any publicly available usable game taking advantage of force-feedback. I would be glad to hear about them if you know any."

i got great help from Johann Deneux via the e-mailing list (http://lists.sourceforge.net/lists/l...o/libff-kernel & libff-kernel@lists.sourceforge.net).

*** *** *** *** *** *** *** *** *** ***

understanding that no games (that i know of) use force feedback yet, i wanted to at least enable the spring and damping conditions when using it. to do this i played around with the utils in;

http://user.it.uu.se/~johannd/projec...-utils.tar.bz2

using fftest.c as my starting point i tried various ideas:

1. a background program that runs in a periodic loop to repeatedly run the spring & damping functions so that even if the controller is 'reset' by the program when it starts each race or exiting/entering pits or messing around with the in-game controls menu, the spring & damper function kick in again within a few seconds.

2. a program which runs once, maybe give it a shortcut keyset to run from within whatever game I'm playing, to enable the spring & damper for infinity timescale (effects[x].replay.length = 0.

i think option 1 is the ideal, and i maybe managed it at one stage, but i lost the code :O(. I couldn't figure out how to make shortcut keys in KDE so gave up on program 2. skipping to another terminal via CTRL+ALT+F2 (get back to game with CTRL+ALT+F7) and running program 2 worked. i then found that the racing game i play only resets the controller during startup & if i mess around in the controller menu. what i ended up with is having a program run with a 15 second delay to activation, which is enough time for me to get into the game, and learnt not to mess around in the controls menu. crude, but it worked. here's how i do it:

***1. after extracting ff-utils.tar.bz2 go into its directory and backup the fftest.c file, thus:
$ cp fftest.c original_fftest.c

***2. open fftest.c with a text editor, and delete its contents and put in the following code (which i just edited from Johanns original fftest.c anyway):

Code:
// Quick fix for #define mess
#define uint16_t unsigned short
#define uint32_t unsigned short

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <sys/ioctl.h>
#include <linux/input.h>

#define BITS_PER_LONG (sizeof(long) * 8)
#define OFF(x)  ((x)%BITS_PER_LONG)
#define BIT(x)  (1UL<<OFF(x))
#define LONG(x) ((x)/BITS_PER_LONG)
#define test_bit(bit, array)    ((array[LONG(bit)] >> OFF(bit)) & 1)

#define N_EFFECTS 6

char* effect_names[] = {
	"Spring Condition",
	"Damping Condition"
};

int main(int argc, char** argv)
{
	struct ff_effect effects[N_EFFECTS];
	struct input_event play, stop;
	int fd;
	char device_file_name[64];
	unsigned long features[4];
	int n_effects;	/* Number of effects the device can play at the same time */
	int i;
	
	printf("\nProgram: enable spring & damper after 15 second delay.\n");	
	printf("NOTE: DO NOT POWER CYCLE WHEEL ON/OFF WHILST PROGRAM RUNNING.\n");
	printf("Delay value: 15 seconds.\n");
	printf("Load game now...\n\n");
	
	strncpy(device_file_name, "/dev/input/event0", 64);

	for (i=1; i<argc; ++i) {
		if (strncmp(argv[i], "--help", 64) == 0) {
			printf("Usage: %s /dev/input/eventXX\n", argv[0]);
			printf("Tests the force feedback driver\n");
			exit(1);
		}
		else {
			strncpy(device_file_name, argv[i], 64);
		}
	}

	system("sleep 15");
	
	/* Open device */
	fd = open(device_file_name, O_RDWR);
	if (fd == -1) {
		perror("Open device file");
		exit(1);
	}
	printf("Device %s opened\n", device_file_name);

	/* Query device */
	if (ioctl(fd, EVIOCGBIT(EV_FF, sizeof(unsigned long) * 4), features) == -1) {
		perror("Ioctl query");
		exit(1);
	}

	printf("Axes query: ");

	if (test_bit(ABS_X, features)) printf("Axis X ");
	if (test_bit(ABS_Y, features)) printf("Axis Y ");
	if (test_bit(ABS_WHEEL, features)) printf("Wheel ");

	printf("\nEffects: ");

	if (test_bit(FF_SPRING, features)) printf("Spring ");
	if (test_bit(FF_DAMPER, features)) printf("Damper ");

	printf("\nNumber of simultaneous effects: ");

	if (ioctl(fd, EVIOCGEFFECTS, &n_effects) == -1) {
		perror("Ioctl number of effects");
	}

	printf("%d\n\n", n_effects);


	/* download an condition spring effect */
	effects[0].type = FF_SPRING;
	effects[0].id = -1;
	effects[0].u.condition[0].right_saturation = 0x7fff;
	effects[0].u.condition[0].left_saturation = 0x7fff;
	effects[0].u.condition[0].right_coeff = 0x2000;
	effects[0].u.condition[0].left_coeff = 0x2000;
	effects[0].u.condition[0].deadband = 0x0;
	effects[0].u.condition[0].center = 0x0;
	effects[0].u.condition[1] = effects[0].u.condition[0];
	effects[0].trigger.button = 0;
	effects[0].trigger.interval = 0;
	effects[0].replay.length = 0;  /* infinite seconds */
	effects[0].replay.delay = 5000;

	if (ioctl(fd, EVIOCSFF, &effects[0]) == -1) {
		perror("Upload effects[0]");
	}

	/* download an condition damper effect */
	effects[1].type = FF_DAMPER;
	effects[1].id = -1;
	effects[1].u.condition[0].right_saturation = 0x7fff;
	effects[1].u.condition[0].left_saturation = 0x7fff;
	effects[1].u.condition[0].right_coeff = 0x2000;
	effects[1].u.condition[0].left_coeff = 0x2000;
	effects[1].u.condition[0].deadband = 0x0;
	effects[1].u.condition[0].center = 0x0;
	effects[1].u.condition[1] = effects[1].u.condition[0];
	effects[1].trigger.button = 0;
	effects[1].trigger.interval = 0;
	effects[1].replay.length = 0;  /* infinite seconds */
	effects[1].replay.delay = 5000;

	if (ioctl(fd, EVIOCSFF, &effects[1]) == -1) {
		perror("Upload effects[1]");
	}




	/* Ask user what effects to play */
	do {
	
	
	play.type = EV_FF;
			play.code = effects[0].id;
			play.value = 1;

			if (write(fd, (const void*) &play, sizeof(play)) == -1) {
				perror("Play effect");
				exit(1);
			}
	
			printf("Now Playing: %s\n", effect_names[0]);
				
			

	play.type = EV_FF;
			play.code = effects[1].id;
			play.value = 1;

			if (write(fd, (const void*) &play, sizeof(play)) == -1) {
				perror("Play effect");
				exit(1);
			}	
			
			printf("Now Playing: %s\n", effect_names[1]);
				
			
	
		printf("Enter -1 to exit\n");
		scanf("%d", &i);
		if (i >= 0 && i < N_EFFECTS) {
			

			printf("Now Playing: %s\n", effect_names[i]);
		}

		else {
			printf("Program Exiting.\n\n");
		}
	} while (i>=0);

	/* Stop the effects */
	for (i=0; i<N_EFFECTS; ++i) {
		stop.type = EV_FF;
		stop.code =  effects[i].id;
		stop.value = 0;
        
		if (write(fd, (const void*) &stop, sizeof(stop)) == -1) {
			perror("Stop effect");
			exit(1);
		}
	}
	

	exit(0);
}
***3. exit & save the new fftest.c.

***4. need to compile/make it now:
$ make
it gives some errors, but they dont seem to stop if from working. oh, i can't program by the way. i've done a bit of pascal, but noting as complicated as whats in this file. but it seems to work. ;O)

***5. run it (see also step 11 above):
$ ./fftest

***6. run whatever racing game you like. the fftest program is on a 15 seconds delay you should notice it kick in. if this isn't enough time for your game or computer, just edit the line "system("sleep 15");" in the above source code and 'make' it again.

I'd like to make the centering force a bit stronger, but haven't got round to looking into that yet. also there's bit of a deadzone in the middle of my wheel; either the wheel is knackered or the spring force value needs to be greater. i'll probably try and do more with this once LFS S2 comes out.

the above method worked for me, i just wanted to pass it on.

THE END.

Last edited by Mr Marmmalade; 01-23-2005 at 06:26 AM.
 
Old 01-28-2005, 01:46 PM   #4
clausawits
Member
 
Registered: Jun 2001
Posts: 128

Original Poster
Rep: Reputation: 16
Mr Marmmalade: Which wheel am I using? - No wheel: since it's not working, I can't use it! ugh.. okay, smart-assery out of the way.. I have the Logitech Driving Force Pro, in addition to an old Logitech Wingman Formula Force GP. Neither work yet (nothing happens in /dev/js0 when pressing buttons, etc.). Both cause boot-up to take forever and a day if they are plugged in..

Since I've been playing with trying to get them working lately, and paying attention to the USB system more, I've been seeing this error message showing up in the /var/log/messages a lot:
Quote:
drivers/usb/input/hid-core.c: input irq status -84 received
By googling around and experimenting, I've found it's associated with whether my USB mouse (which works fine) is plugged in or not.. (if it's plugged in, I get the messages, if not, silence.) It's really sinking my confidence in Linux's USB support.. :/

When I plug in the DFP wheel into the USB slot, /var/log/messages reports:
Quote:
Jan 28 14:24:37 localhost kernel: usb 1-2.1: new low speed USB device using uhci_hcd and address 8
Jan 28 14:24:48 localhost kernel: drivers/usb/input/hid-core.c: timeout initializing reports
Jan 28 14:24:48 localhost kernel:
Jan 28 14:24:48 localhost kernel: input: USB HID v1.00 Joystick [Logitech Logitech Driving Force] on usb-0000:00:07.2-2.1
When I plug in the WFFGP wheel, I get:
Quote:
Jan 28 14:40:40 localhost kernel: usb 1-2.2: new low speed USB device using uhci_hcd and address 11
Jan 28 14:40:51 localhost kernel: drivers/usb/input/hid-core.c: timeout initializing reports
Jan 28 14:40:51 localhost kernel:
Jan 28 14:40:51 localhost kernel: input: USB HID v1.00 Joystick [Logitech Inc. WingMan Formula Force GP] on usb-0000:00:07.2-2.2
but when I do a tail -f /dev/js0 I get bupkiss when pressing buttons, etc. Should I be looking somewhere else?

Having a working wheel is my first goal.. worrying about force feedback comes later for me. Thanks for the work on the HowTo!
 
Old 01-28-2005, 03:39 PM   #5
Mr Marmmalade
Member
 
Registered: Oct 2002
Location: Scotland
Distribution: Debian
Posts: 181

Rep: Reputation: 16
clausawits, it looks like your LWFF-GP is iForce* like mine, so you need to look into the modules i loaded and do the same on your computer. going on what is said in here:

http://atrey.karlin.mff.cuni.cz/~voj.../hardware.html

*iForce is a ffb wheel standard or system that quite a few wheels were designed to a while back.

those bits of info you gave; maybe the hid-core module is looking for another module i.e. iforce to talk to. note that i have to load 4 modules to make mine work: joydev,input,evdev,iforce (the order of these might be important).

seeing as i think your WFF is iforce, you should sign up to the mailing list i mentioned, johann is the man behind the iforce driver.

i dont know about the Logitech DFP though. it may be like my bros Logitech MOMO wheel. maybe i'll try & get it working at some point.

EDIT: there's also another util within ff-utils which shows input/output values once you run it and start pressing buttons and stuff. i just think its a different way to see if the wheel is working.


Last edited by Mr Marmmalade; 01-29-2005 at 04:59 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
usb steering wheel, please help! Mr Marmmalade Slackware 11 12-17-2004 06:09 PM
force feedback wheel usb Mr Marmmalade Linux - Hardware 2 10-03-2004 01:34 PM
MS USB Optical Mouse Wheel NA nocturnal Linux - Hardware 1 11-20-2003 07:47 PM
usb optical wheel mouse loran Slackware 3 03-13-2003 11:53 AM
Logitech Mouseman wheel USB qwaurck Linux - General 4 01-22-2002 10:53 AM


All times are GMT -5. The time now is 09:30 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration