5.2. Using hotplug with input.agent and input.rc

Using the input.agent will allow you to manage input devices based on their PHYS ID.

The input.rc script will run the input.agent with appropriate arguments for drivers that are built in the kernel or are loaded before hotplug is available.

5.2.1. input.agent

The input agent uses 3 configuration files:

NoteNote
 

The explanations here are using Backstreet Ruby ( usb devices have PHYS_ID "usb-00:xx.x-..."), if you are running Ruby-2.6 for usb devices you should have PHYS_ID "usb-0000:00:xx.x-...." , but you should be able to use the same configuration files both under Backstreet Ruby and Ruby-2.6 by specifying "usb-0*:xx.x-..." .

To configure the keyboards you have to adjust /etc/hotplug/kbd.conf

If I wanted to use the PS2 keyboard for the primary Display and for the VGA console, I would have:


#
# keyboard configuration
#
# vt_name device_physicaly_location

VT0	isa0060/serio0/input0
VT1	usb-00:10.1-1.1/input0
        

Or, if I want to use the USB keyboard for the primary Display and for the VGA console:


#
# keyboard configuration
#
# vt_name device_physicaly_location

VT0	usb-00:10.1-1.1/input0
VT1	isa0060/serio0/input0
        

you could also use "*.*" instead of the pci function of the USB controller:


#
# keyboard configuration
#
# vt_name device_physicaly_location

VT0	usb-*.*-1.1/input0
VT1	isa0060/serio0/input0
      

For mouse devices you have to edit /etc/hotplug/mouse.conf


#
# mouse device configuration
#
# sym_link device_physicaly_location
mouse0br	usb-00:10.1-1.2/input0
mouse1br	usb-*.*-2.7.*/input0
mouse2br	isa0060/serio1/*
        

and adjust the XFree configuration file.

For the first mouse change


......
    Option "Protocol"    "IMPS/2"
    Option "Device"      "/dev/input/mouse0"
    Option "ZAxisMapping" "4 5"
......
      

to :


......
    Option "Protocol"    "IMPS/2"
    Option "Device"      "/dev/input/mouse0br"
    Option "ZAxisMapping" "4 5"
......
      

For the second mouse change


......
    Option "Protocol"    "IMPS/2"
    Option "Device"      "/dev/input/mouse1"
    Option "ZAxisMapping" "4 5"
......
      

to :


......
    Option "Protocol"    "IMPS/2"
    Option "Device"      "/dev/input/mouse1br"
    Option "ZAxisMapping" "4 5"
......
      

and so on.

For Event devices edit /etc/hotplug/event.conf


#
# input event device config file
#
# symbolic_link device_physicaly_location
event0br	isa0060/serio0/*
event1br	isa0060/serio1/input0
event2br	usb-*.*-3/input0
      

and configure the applications which use them to use the symbolic links instead of the real devices

5.2.2. input.rc

If you are using input drivers built into the kernel please ensure that the input.rc script is started/executed at system start. In case the script is not executed you will find that hotplug could not configure these input devices.

NoteNote
 

This area requires user feedback. Currently I have information only about Mandrake, where hotplug is not run as service.

If your distribution runs hotplug as service this will be done automatically.

If your distribution does not run hotplug as service you will have to modify your init scripts to run input.rc for you before XFree is started.

You may add this at the end of your /etc/rc.d/rc.sysinit
if [[ -f /proc/bus/console -o -n tmp=`uname -r | sed -n 's:ruby::p'` ]]; then
   if [ -x /etc/hotplug/input.rc ]; then	
      /etc/hotplug/input.rc start
      if [ $? = 0 ]; then
      	action "Configuring cold plugged input devices" /bin/true
      else
	action "Configuring cold plugged input devices" /bin/false
      fi
   else if [ -f /etc/hotplug/input.rc ]; then
     	   action "Input: input.rc installed, but not executable. Please check the file permissions." /bin/false
	else 
	   action "Input: Failed to configure cold plugged devices - input.rc missing"  /bin/false
        fi
   fi
fi