On newer Linuxes (since around 2.4.x), there are different character devices in /dev/input
for every user input source:
/dev/input/by-id:
total 0
drwxr-xr-x 2 root root 120 Jul 18 09:55 .
drwxr-xr-x 4 root root 280 Jul 18 09:55 ..
lrwxrwxrwx 1 root root 9 Jul 18 09:55 usb-VMware_VMware_Virtual_USB_Mouse-event-mouse -> ../event3
lrwxrwxrwx 1 root root 9 Jul 18 09:55 usb-VMware_VMware_Virtual_USB_Mouse-if01-event-mouse -> ../event4
lrwxrwxrwx 1 root root 9 Jul 18 09:55 usb-VMware_VMware_Virtual_USB_Mouse-if01-mouse -> ../mouse2
lrwxrwxrwx 1 root root 6 Jul 18 09:55 usb-VMware_VMware_Virtual_USB_Mouse-mouse -> ../js0
/dev/input/by-path:
total 0
drwxr-xr-x 2 root root 180 Jul 18 09:55 .
drwxr-xr-x 4 root root 280 Jul 18 09:55 ..
lrwxrwxrwx 1 root root 9 Jul 18 09:55 pci-0000:02:02.0-usb-0:1:1.0-event-mouse -> ../event3
lrwxrwxrwx 1 root root 6 Jul 18 09:55 pci-0000:02:02.0-usb-0:1:1.0-mouse -> ../js0
lrwxrwxrwx 1 root root 9 Jul 18 09:55 pci-0000:02:02.0-usb-0:1:1.1-event-mouse -> ../event4
lrwxrwxrwx 1 root root 9 Jul 18 09:55 pci-0000:02:02.0-usb-0:1:1.1-mouse -> ../mouse2
lrwxrwxrwx 1 root root 9 Jul 18 09:55 platform-i8042-serio-0-event-kbd -> ../event1
lrwxrwxrwx 1 root root 9 Jul 18 09:55 platform-i8042-serio-1-event-mouse -> ../event2
lrwxrwxrwx 1 root root 9 Jul 18 09:55 platform-i8042-serio-1-mouse -> ../mouse0
In case of the X, you can easily set up in Xorg.conf
, which device do you want to use for your different X instances:
Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/input/mice"
Option "ZAxisMapping" "4 5 6 7"
EndSection
Unfortunately, it requires manual editing of the X config files, but it works perfectly. Maybe there is some software/tool to automatize this task.
And a last thing. You will have to construct two different xorg.conf
files for the task. So, you will have to run two different X servers, running independently.
But it is not a problem, because your X instances are normally started/stopped by a display manager. And they can do that. For example, in the case of the ubuntu-default lightdm, you will have to edit them into /etc/lightdm
.