Logiciels Libres et Systèmes Embarqués


3. More details

3.1. Configurations for others programs

For the moment Js2mouse emulates PS/2 and IMPS/2 protocols, so adapt the configuration for these protocols...

3.2. Js2mouse without root privileges

You do not need to run Js2mouse with root privileges if you specify to use a "virtual mouse character device" (the fifo) into a directory where you've got write-permissions :

js2mouse -f $HOME/j2m_fifo

3.3. Js2mouse as a second pointer with X

  1. add this section into the X configuration file :
    Section "InputDevice"
    	Identifier "Mouse2"
    	Driver "mouse"
    	Option "Protocol" "_PROTO_" #_PROTO_ is PS/2 or IMPS/2
    	Option "Device" "/dev/j2m_fifo"
    	Option "ZAxisMapping" "4 5" #only if you use IMPS/2 protocol
    EndSection
  2. into the Section "ServerLayout", add :
    InputDevice "Mouse2" "SendCoreEvents"
  3. restart X (on the fly : Ctrl-Alt-BackSpace)

3.4. 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 :

  1. log as root (if necessary)
  2. 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

3.5. Keys remapping for Js2mouse

I wrote this functionality on the fly, so this is experimental...

  1. edit /etc/j2m_map, format is :
    JOYSTICK_EVENT = MOUSE_EVENT
  2. JOYSTICK_EVENTs are :
    button_1
    button_2
    ...
    button_NUMBER_OF_BUTTON
    axe_1
    axe_2
    ...
    axe_NUMBER_OF_AXES
  3. MOUSE_EVENTs are :
    click_left
    click_right
    click_middle
    click_extra1
    click_extra2
    wheel_up
    wheel_down
    move_horizontal
    move_vertical
    		

Default keys mapping (i.e. without -r argument) is:

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
		

3.6. Js2mouse options

-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 keys remapping, default : disable
-p use specified mouse protocol, default : ps2