Instructions for 'js2mouse' step by step :

I/ Installation

II/ Quick explanations
1) How to launch 'js2mouse'
2) How to modify the XFree86 configuration :
3) How to modify the GPM configuration

III/ More details
1) Configurations for others programs
2) Js2mouse as a second pointer with XFree86 (Thanks to griz)
3) Js2mouse as a second pointer with GPM
4) Remapping keys
5) Js2mouse options

IV/ Advanced use
1) Integrate Js2mouse to Links-Hacked-030709
2) Integrate Js2mouse to Links-2.1pre11
3) Integrate Js2mouse to other programs
4) Integrate Js2mouse to the Linux-2.6 kernel

V/ Js2Mouse into the Linux kernel
1) Installation
2) Load the module
3) Parameters


I/ Installation :

 - Download the latest sources (js2mouse-YYMMDD.tar.gz) : http://www.freshmeat.net/projects/js2mouse/
 - Enter the following commands into a terminal :
     tar -xvzf js2mouse-YYMMDD.tar.gz
     cd js2mouse/js2mouse
     make
     su -c "make install" (enter root's password, if necessary)


II/ Quick explanations

1) How to launch 'js2mouse' :
 - Log as 'root' (not necessary, see section III/ 1))
 - Enter the following commands into a terminal :
     js2mouse &
     exit
   At this point, js2mouse is running into the background

2) How to modify the XFree86 configuration :
 - Log as 'root' (if necessary)
 - Replace these lines :
	Option "Protocol"    "_YOUR_MOUSE_PROTOCOL_"
	Option "Device"      "/dev/_YOUR_MOUSE_DEVICE_"
   by :
	Option "Protocol"    "_PROTO_"		#_PROTO_ is 'PS/2' or 'IMPS/2' or 'EXPS/2'
	Option "Device"      "/dev/j2m_fifo"
	
	Option "ZAxisMapping" "4 5"		#only if you use the 'IMPS/2' protocol
	
	Option "Buttons" "7"			#only if you use the 'EXPS/2' protocol
	Option "ZAxisMapping" "6 7"		#only if you use the 'EXPS/2' protocol
	
 - Restart server X (on the fly : CTRL+ALT+BACKSPACE)

3) How to modify the GPM configuration :
 - It depends on your Linux distribution, so this is the most independant explanation that I can give... Adapt your own configuration files
 - Log as 'root' (if necessary)
 - Enter the following commands into a terminal :
     gpm -k
     gpm -m /dev/j2m_fifo -t ps2


III/ More details

1) Configurations for others programs :
 - For the moment js2mouse emulate PS/2, IMPS/2, and EXPS/2 protocols, so adapt the configuration to this protocol...
 - You do not need to run js2mouse with root privileges if you specify to use a 'virtual mouse character device' (the fifo) on a directory where you've write-permissions.

2) Js2mouse as a second pointer with XFree86 (Thanks to griz) :
 - Add this section into the XFree86 configuration file :
	Section "InputDevice"
		Identifier  "Mouse2"
		Driver      "mouse"
		Option "Protocol"    "_PROTO_"		#_PROTO_ is 'PS/2' or 'IMPS/2' or 'EXPS/2'
		Option "Device"      "/dev/j2m_fifo"
	
		Option "ZAxisMapping" "4 5"		#only if you use the 'IMPS/2' protocol
	
		Option "Buttons" "7"			#only if you use the 'EXPS/2' protocol
		Option "ZAxisMapping" "6 7"		#only if you use the 'EXPS/2' protocol
	EndSection
 - Into the Section "ServerLayout", add :
	InputDevice "Mouse2" "SendCoreEvents"
 - Restart server X (on the fly : CTRL+ALT+BACKSPACE)

3) Js2mouse as a second pointer with GPM :
 - It depends on your Linux distribution, so this is the most independant explanation that I can give... Adapt your own configuration files
 - Log as 'root' (if necessary)
 - Enter the following commands into a terminal :
     gpm -k
     gpm -m /dev/_YOUR_REAL_MOUSE_DEV_ -t _ITS_PROTOCOL_ -M -t ps2 -m /dev/j2m_fifo

4) Remapping keys for 'js2mouse' :
 - I write this functionnality 'on the fly', so this is a beta code !!!
 - Edit /etc/j2m_map, format is :
    JOYSTICK_EVENT = MOUSE_EVENT
    /!\ it doesn't mind about separator, all symbols (even composed or none) are accepted...
    
    JOYSTICK_EVENT are :
	button_1
	button_2
	...
	button_NUMBER_OF_BUTTON
	axe_1
	axe_2
	...
	axe_NUMBER_OF_AXES
    
    MOUSE_EVENT are :
	click_left
	click_right
	click_middle
	click_extra1
	click_extra2
	wheel_up
	wheel_down
	move_horizontal
	move_vertical
    
    Default '/etc/j2m_map' (without -r argument):
	button_1 = click_left
	button_2 = click_right
	button_3 = click_middle
	button_4 = wheel_up
	button_5 = wheel_down
	button_6 = click_extra1
	button_7 = click_extra2
	axe_1 = move_horizontal
	axe_2 = move_vertical

5) Js2mouse options :
Usage : js2mouse  [OPTION]...
Convert joystick inputs into mouse inputs

        -h              show this help
        -d <dev>        use specified device    default : /dev/input/js0
        -f <fifo>       use specified fifo      default : /dev/j2m_fifo
        -v <n>          verbose level, 0 to 3   default : 3
        -t <n>          poll timeout in ms      default : 20
        -r              active remapping keys   default : disable
        -p              use specified mouse protocol    default : ps2


IV/ Advanced use

1) Integrate Js2mouse to Links-Hacked-030709
 - Download the Links-Hacked-030709 sources (js2mouse is directly implemented in next version) : http://xray.sai.msu.ru/~karpov/links-hacked/downloads/links-hacked-030709.tgz and  http://xray.sai.msu.ru/~karpov/links-hacked/downloads/links-fonts-new.tgz
 - Enter the following commands into a terminal :
     tar -xvzf js2mouse-YYMMDD.tar.gz
     cd js2mouse/contrib/links-hacked-030709
     cp links-hacked-030709-joyfb.diff /_WHERE_ARE_LNKS-HACKED_SOURCES_/
     cd /_WHERE_ARE_LINUX_SOURCES_/
     patch -p0 <links-hacked-030709-joyfb.diff
     #compile Links-hacked-030709

2) Integrate Js2mouse to Links-2.1pre (ONLY WITH js2mouse-030919)
 - Download the Links-2.1pre11 sources (other versions are not tested) : http://atrey.karlin.mff.cuni.cz/~clock/twibright/links/download/links-2.1pre11.tar.gz
 - Unpack Links-2.1pre11 sources
 - Do './configure --enable-graphics [OPTIONS]'
 - Download the latest sources (js2mouse-YYMMDD-TIME.taz) : http://www.freshmeat.net/projects/js2mouse/
 - Unpack Js2mouse sources into the root directory of Links-2.1pre11
 - Replace framebuffer.c by js2mouse/contrib/links-2.1pre11/framebuffer.c
 - Go into js2mouse/src and enter 'make -f Makefile.linksfb'
 - Add 'js2mouse/src/*.o' into Makefile of Links-2.1pre11, to the variable 'links_OBJECTS'
 - Do 'make', 'make install'

3) Integrate Js2mouse to other programs
 - Take a look at the previous source code integration...
 - Just do it ;D


V/ Js2Mouse into the Linux kernel :

1) Installation:

 - Download the latest sources (js2mouse-YYMMDD.tar.gz) : http://www.freshmeat.net/projects/js2mouse/
 - Enter the following commands into a terminal :
     tar -xvzf js2mouse-YYMMDD.tar.gz
     cd js2mouse/j2mdev
     cp j2mdev-linux-2.6.1.patch /_WHERE_ARE_LINUX_SOURCES_/
     cd /_WHERE_ARE_LINUX_SOURCES_/
     patch -p0 <j2mdev-linux-2.6.1.patch
     cd linux
     make menuconfig
     # say Y or M to [Device Driver]->[Input Device Support]->[Joystick->mouse converter interface]
     # recompile the kernel or modules

2) Load the module :
 - Log as 'root'.
 - Load your joystick driver, for example :
     modprobe gamecon gc=0,7
 - Load j2mdev :
     modprobe j2mdev
 - Create (if necessary) related character device :
     mknod /dev/input/j2m0 c 13 200
     mknod /dev/input/j2m1 c 13 201
     mknod /dev/input/j2m2 c 13 202
     mknod /dev/input/j2m3 c 13 203


3) Parameters :
 - At the loading time, you can specify the buttons map (2 to 5 arguments) :
     btn=_left_,_right_,_middle_,_extra1_,_extra2_
 - You can specify the axes map (2 arguments) :
     abs=_horizontal_,_vertical_
 - You can specify the refresh time between two reads :
     refresh=_time_
 - For example :
     modprobe j2mdev refresh=10 btn=305,307,308
 - To know which value represents your buttons/axes, take a look at kernel log :
     dmesg
     j2mdev: axes unknown=2
     j2mdev: button unknown=306
     j2mdev: button unknown=306
     j2mdev: button unknown=310
     j2mdev: button unknown=310
