5.4. Using the "Phys" descriptor and USB devices

Using the "Phys" descriptor of input devices simplifies a lot the configuration of input devices in XFree, especially when a bigger number of displays are used.

As USB devices are connecting in a tree form, you can really easy specify the way keyboard and mice devices are bound to a specified X display. You have to use one USB hub with number of ports equal(or bigger) to the number of the X displays, to this hub are connected smaller (2-4 port) hubs (or keyboards with integrated hub). To the first port of the smaller (integrated) hub are connected the keyboards, to the second the mice (in case there are free ports you can connect usb-audio devices to them :) ). This results in the following layout of the usb-id's in case the primary USB hub is the first USB device :

NoteNote
 

In the following explanations and examples I use for first device on the secondary(integrated) hub keyboard device because my keyboard is internally connected to the 1st port of the integrated hub. I assume this will apply for most of the keyboards with integrated hub, but in case the one you own uses different port you will have to make small adjustments.

Based on this we can bind all devices connected to a specified USB port to a given X server.

5.4.1. ... with Input Agent

An example for a 4-user system using the "Phys" descriptor with Input Agent and USB input devices.

NoteNote
 

Here the PCI function of the USB controller is masked by *.* so it should work both under Backstreet Ruby and Ruby-2.6 . If you use more then one USB controller you'll have to use different mask ( for example "usb-0*:xx.x-...") or specify the full PHYS_ID's : .

For Backstreet Ruby you should have PHYS_ID "usb-00:xx.x-..."

For Ruby-2.6 you should have PHYS_ID "usb-0000:00:xx.x-...."

We'll use the "vt[n]" parameter when starting X and the following configuration file for the keyboards(/etc/hotplug/kbd.conf ):


#
# keyboard configuration
#
# vt_name device_physicaly_location

VT0	usb-*.*-1.1.1/input0
VT1	usb-*.*-1.2.1/input0
VT2	usb-*.*-1.3.1/input0
VT3	usb-*.*-1.4.1/input0
      

For mouse devices the configuration file (/etc/hotplug/mouse.conf) will look like this:


#
# mouse device configuration
#
# sym_link device_physicaly_location
mouse0br	usb-*.*-1.1.2/input0
mouse1br	usb-*.*-1.2.2/input0
mouse2br	usb-*.*-1.3.2/input0
mouse3br	usb-*.*-1.4.2/input0
        

and we have to adjust the XFree configuration files, so XFree uses the symbolic links instead of the actual devices. If you already configured independent mice you have only to append "br" to each of the mouse devices.

Change each "/dev/input/mouse[n]" to "/dev/input/mouse[n]br".

For the first display:


......
# **********************************************************************
# Pointer section
# **********************************************************************

Section "InputDevice"

    Identifier  "Mouse1"
    Driver      "mouse"
    Option "Protocol"    "IMPS/2"
    Option "Device"      "/dev/input/mouse0br"
    Option "ZAxisMapping" "4 5"

# ChordMiddle is an option for some 3-button Logitech mice
    Option "Emulate3Buttons"
#    Option "ChordMiddle"

EndSection
......
      

For the second display:


......
# **********************************************************************
# Pointer section
# **********************************************************************

Section "InputDevice"

    Identifier  "Mouse1"
    Driver      "mouse"
    Option "Protocol"    "IMPS/2"
    Option "Device"      "/dev/input/mouse1br"
    Option "ZAxisMapping" "4 5"

# ChordMiddle is an option for some 3-button Logitech mice
    Option "Emulate3Buttons"
#    Option "ChordMiddle"

EndSection
......
      

and so on.

Or in case a single XFree configuration file is used:


......
# **********************************************************************
# Pointer section
# **********************************************************************

Section "InputDevice"

    Identifier  "Mouse1"
    Driver      "mouse"
    Option "Protocol"    "IMPS/2"
    Option "Device"      "/dev/input/mouse0br"
    Option "ZAxisMapping" "4 5"

# ChordMiddle is an option for some 3-button Logitech mice
    Option "Emulate3Buttons"
#    Option "ChordMiddle"

EndSection
Section "InputDevice"

    Identifier  "Mouse2"
    Driver      "mouse"
    Option "Protocol"    "IMPS/2"
    Option "Device"      "/dev/input/mouse1br"
    Option "ZAxisMapping" "4 5"

# ChordMiddle is an option for some 3-button Logitech mice
    Option "Emulate3Buttons"
#    Option "ChordMiddle"

EndSection
......
      

5.4.2. ... with XFree with event interface support

Using the "Dev Phys" option of XFree with event device support and USB input devices enables us to use almost identical configuration of the input devices for all X servers. The only difference will be in the part of the usb-id, which reflects the port of the primary USB hub.

NoteNote
 

The examples below are for multiple XFree configuration files, if you use a single XFree configuration file you have to adjust the identifiers.

The configuration for the input devices for the 1st display would look something like this:


Section "InputDevice"
    Identifier  "Keyboard1"
    Driver      "kbd"
    Option      "Protocol"      "evdev"
    Option      "Dev Phys"      "usb-*-1.1.1/input0"
    Option      "AutoRepeat"    "250 30"
    Option      "XkbRules"      "xfree86"
    Option      "XkbModel"      "pc101"
    Option      "XkbLayout"     "dvorak"
EndSection
Section "InputDevice"
    Identifier  "Mouse1"
    Driver      "mouse"
    Option      "Protocol"      "evdev"
    Option      "Dev Phys"      "usb-*-1.1.2/input0"
    Option      "ZAxisMapping"  "4 5"
EndSection

For the 2nd display something like this:


Section "InputDevice"
    Identifier  "Keyboard1"
    Driver      "kbd"
    Option      "Protocol"      "evdev"
    Option      "Dev Phys"      "usb-*-1.2.1/input0"
    Option      "AutoRepeat"    "250 30"
    Option      "XkbRules"      "xfree86"
    Option      "XkbModel"      "pc101"
    Option      "XkbLayout"     "dvorak"
EndSection
Section "InputDevice"
    Identifier  "Mouse1"
    Driver      "mouse"
    Option      "Protocol"      "evdev"
    Option      "Dev Phys"      "usb-*-1.2.2/input0"
    Option      "ZAxisMapping"  "4 5"
EndSection

For the 3rd display something like this:


Section "InputDevice"
    Identifier  "Keyboard1"
    Driver      "kbd"
    Option      "Protocol"      "evdev"
    Option      "Dev Phys"      "usb-*-1.3.1/input0"
    Option      "AutoRepeat"    "250 30"
    Option      "XkbRules"      "xfree86"
    Option      "XkbModel"      "pc101"
    Option      "XkbLayout"     "dvorak"
EndSection
Section "InputDevice"
    Identifier  "Mouse1"
    Driver      "mouse"
    Option      "Protocol"      "evdev"
    Option      "Dev Phys"      "usb-*-1.3.2/input0"
    Option      "ZAxisMapping"  "4 5"
EndSection

and so on.

You could also use the "?", so wherever you plug the primary hub, all displays will still have the desired configuration.


Section "InputDevice"
    Identifier  "Keyboard1"
    Driver      "kbd"
    Option      "Protocol"      "evdev"
    Option      "Dev Phys"      "usb-*-?.1.1/input0"
    Option      "AutoRepeat"    "250 30"
    Option      "XkbRules"      "xfree86"
    Option      "XkbModel"      "pc101"
    Option      "XkbLayout"     "dvorak"
EndSection
Section "InputDevice"
    Identifier  "Mouse1"
    Driver      "mouse"
    Option      "Protocol"      "evdev"
    Option      "Dev Phys"      "usb-*-?.1.2/input0"
    Option      "ZAxisMapping"  "4 5"
EndSection

mirror server hosted at Truenetwork, Russian Federation.