LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Blogs > serafean
User Name
Password

Notices

Rate this Entry

X dual head, one graphic card

Posted 10-25-2010 at 10:48 AM by serafean
Updated 11-04-2010 at 04:20 PM by serafean

X configuration

Goal : 2 separate X screens working as dual-head(like 2 mice, 2 keyboards), powered by one graphic card(nvidia ion, 1st gen).

features used :
  • X multiple screens (Zaphod mode?)
  • MPX (multiple input X)

First configure the X server through xorg.conf :
Code:
Section "ServerLayout"
    Identifier     "Monitor"
    Screen      0  "Screen0" 1500 0
    Screen      1  "Screen1" 0 0  #LeftOf "Screen0"
    InputDevice    "Mouse0" "CorePointer"
    InputDevice    "Keyboard0" "CoreKeyboard"
    Option         "Xinerama" "0"
EndSection
Screen 0 is placed X coordinates 1500 to prevent the pointer from going from one screen to the other (Screen 1 X size is 1360).
Xinerama disabled... this should be self explanatory.

For each screen, there has to be a relevant screen section, monitor section, and device section (yes, 2 device sections, even for just
one physical device). the whole xorg.conf is attached. I do admit, that most of this xorg.conf was generated by nvidia-settings.

Now X is running, 2 separate screens. one with KDE running, to run anything, it needs to be run from console with the DISPLAY variable set to :0.1 .

Now to set up MPX : first create a new master pointer device (in this case named enna) and get its ID :
Code:
$xinput create-master enna
$xinput list
Ž Virtual core pointer                    	id=2	[master pointer  (3)]
Žœ   † Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
Žœ   † Logitech Optical USB Mouse              	id=6	[slave  pointer  (2)]
Žœ   † iMON Remote (15c2:0039)                 	id=7	[slave  pointer  (2)]
Ž Virtual core keyboard                   	id=3	[master keyboard (2)]
    † Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    † Logitech USB Receiver                   	id=8	[slave  keyboard (3)]
    † Logitech USB Receiver                   	id=9	[slave  keyboard (3)]
    † Power Button                            	id=10	[slave  keyboard (3)]
    † Power Button                            	id=11	[slave  keyboard (3)]
Ž enna pointer                            	id=12	[master pointer  (13)]
Žœ   † enna XTEST pointer                      	id=14	[slave  pointer  (12)]
Ž enna keyboard                           	id=13	[master keyboard (12)]
    † enna XTEST keyboard                     	id=15	[slave  keyboard (13)]
$xinput reattach 7 12
the last command attaches input from the imon IR receiver to the "enna" pointer. (sory for the weird symbols, I have an encoding problem that is yet to be solved)
Now we have to move the "enna" pointer from screen 0 to screen 1. I havent yet found a nice way to do this, so I hacked together a piece of C code to do just that :
Code:
#include <X11/extensions/XInput2.h>

int main(){
  Display *XSession = XOpenDisplay(NULL);
  int OriginScreen = 0;
  int pID = 12;
  int opcode,event,error;
  if (!XQueryExtension(XSession,"XInputExtension", &opcode, &event,&error)){
    printf("X Input extension not available");
    return -1;
}

  XIWarpPointer(XSession, pID, None, RootWindow(XSession,
1), 0,0,0,0,0,0);

  XCloseDisplay(XSession);
}
Compile using `gcc -lXi -o movepointer`

an voil, pointer focus from the iMon is on the second screen, which acts as a second head. For now all this is done through a script run by kdm when it starts. I'll attach it later (after I make it find the device ID, not having everything statically), along with cleaner C code.

TODO : still haven't found a way to stop kdm/kde from resetting the X server (thus killing the media center on the second screen) upon logout.

Credit for the C code goes to mostly to David Mohr who's code I copied, and kept stripping till it did exactly what I wanted.
Attached Files
File Type: txt xorg.conf.txt (2.9 KB, 8 views)
Views 1284 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 11:34 PM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration