Linux debian 2 монитора

Dual Monitor Dual X Server One Input

This HOWTO describes setting up a single computer which has two monitors on two separate video cards but only one keyboard and mouse such that there is a separate X server running for each display with a separate login session for each.

1.1 System

  • Two video cards
  • Two monitors
  • One keyboard, One mouse
  • Running Debian Lenny (5.0)
  • Two user accounts, one for the primary display and one for the secondary
  • A shared group for the two accounts (it doesn’t need to either user’s primary group)
  • gdm (GNOME Display Manager) as the display manager
  • sudo installed (gdm pulls it in debian)
  • X.Org
  • void input driver for X.Org (package xserver-xorg-input-void)
  • Package x2x

2. Overview

  1. Create configuration for the X servers (xorg.conf and xorg.conf.1)
  2. Modify gdm (GNOME Display Manager) configuration to start both servers
  3. Configure login to primary display so that we obtain authorization for the secondary display
    1. Create script to copy secondary display authorization to our primary display
    2. Put an entry in /etc/sudoers so that we can execute the command as root (required)
    3. Add a line to $HOME/.xsessionrc (for users who will use both displays) to execute that command on login

    3. The Configuration

    3.1. Create configuration for the X servers

    3.1.1. For Primary Display

    Section "InputDevice" Identifier "Generic Keyboard" Driver "kbd" Option "XkbRules" "xorg" Option "XkbModel" "pc104" Option "XkbLayout" "us" EndSection Section "InputDevice" Identifier "Configured Mouse" Driver "mouse" EndSection Section "Device" Identifier "Configured Video Device" BusID "PCI:01:00:00" Driver "radeon" Option "Int10" "false" EndSection Section "Monitor" Identifier "Configured Monitor" Option "DPMS" Option "PreferredMode" "1600x1200" EndSection Section "Screen" Identifier "Default Screen" Device "Configured Video Device" Monitor "Configured Monitor" Option "NoInt10" "true" EndSection Section "ServerLayout" Identifier "Primary Display" Screen "Default Screen" InputDevice "Generic Keyboard" "CoreKeyboard" InputDevice "Configured Mouse" "CorePointer" Option "IsolateDevice" "1:0:0" EndSection

    The most important settings above are:

    BusID "PCI:01:00:00" Option "IsolateDevice" "1:0:0"

    If you’re having trouble with displays hanging during initialization the following settings (from above) are also important:

    Option "Int10" "false" Option "NoInt10" "true"

    The BusID and ?IsolateDevice settings take the PCI id information in decimal. lspci lists the devices with PCI id information in hexadecimal (base 16), so you will have to convert the numbers to decimal to use the in xorg.conf.

    Note the BusID for the configuration for the secondary display (below)

    It is associated with the lspci line

    02:0e.0 VGA compatible controller: ATI Technologies Inc 3D Rage II+ 215GTB [Mach64 GTB] (rev 9a)
    00:00.0 Host bridge: Intel Corporation 82845 845 [Brookdale] Chipset Host Bridge (rev 04) 00:01.0 PCI bridge: Intel Corporation 82845 845 [Brookdale] Chipset AGP Bridge (rev 04) 00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 05) 00:1f.0 ISA bridge: Intel Corporation 82801BA ISA Bridge (LPC) (rev 05) 00:1f.1 IDE interface: Intel Corporation 82801BA IDE U100 Controller (rev 05) 00:1f.2 USB Controller: Intel Corporation 82801BA/BAM USB Controller #1 (rev 05) 00:1f.3 SMBus: Intel Corporation 82801BA/BAM SMBus Controller (rev 05) 00:1f.4 USB Controller: Intel Corporation 82801BA/BAM USB Controller #1 (rev 05) 01:00.0 VGA compatible controller: ATI Technologies Inc Radeon RV200 QW [Radeon 7500] 02:09.0 SCSI storage controller: LSI Logic / Symbios Logic 53c875 (rev 04) 02:0a.0 PCI bridge: Digital Equipment Corporation DECchip 21154 (rev 05) 02:0b.0 Multimedia audio controller: Creative Labs SB Audigy (rev 04) 02:0b.2 FireWire (IEEE 1394): Creative Labs SB Audigy FireWire Port (rev 04) 02:0c.0 Ethernet controller: 3Com Corporation 3c905 100BaseTX [Boomerang] 02:0d.0 Serial controller: 3Com Corp, Modem Division 56K FaxModem Model 5610 (rev 01) 02:0e.0 VGA compatible controller: ATI Technologies Inc 3D Rage II+ 215GTB [Mach64 GTB] (rev 9a) 03:00.0 PCI bridge: Digital Equipment Corporation DECchip 21154 (rev 05)

    3.1.2. For Secondary Display

    Section "InputDevice" Identifier "Generic Keyboard" Driver "void" Option "CoreKeyboard" EndSection Section "InputDevice" Identifier "Configured Mouse" Driver "void" Option "CorePointer" EndSection Section "Device" Identifier "Configured Video Device" BusID "PCI:2:14:0" Driver "mach64" EndSection Section "Monitor" Identifier "Configured Monitor" EndSection Section "Screen" Identifier "Secondary Screen" Device "Configured Video Device" Monitor "Configured Monitor" DefaultDepth 16 EndSection Section "ServerLayout" Identifier "Secondary Display" Screen "Secondary Screen" InputDevice "Generic Keyboard" "CoreKeyboard" InputDevice "Configured Mouse" "CorePointer" EndSection

    Notice the following setting:

    This requires the package xserver-xorg-input-void be installed (on Debian; other distributions will make the void driver available in other ways). Setting the mouse and keyboard driver to void and using

    InputDevice "Generic Keyboard" "CoreKeyboard" InputDevice "Configured Mouse" "CorePointer"

    means that the server associated with this configuration has not access to input devices on the server (until we use x2x) and must therefore be controlled through software.

    3.2. Configure GDM to start both servers

    Here is an example /etc/gdm/gdm.conf

    [daemon] [security] [xdmcp] [gui] [greeter] [chooser] [debug] [servers] 0=Primary 1=Secondary [server-Primary] name=Primary Display command=/usr/X11R6/bin/X -audit 0 -isolateDevice PCI:1:0:0 vt7 flexible=true [server-Secondary] name=Secondary Display command=/usr/X11R6/bin/X -audit 0 -config /etc/X11/xorg.conf.1 -isolateDevice PCI:2:14:0 -sharevts flexible=true

    The import parts are the server* sections. Note the -isolateDevice parameter (which is the same as the BusID) and for the secondary display -config /etc/X11/xorg.conf.1

    3.3. On primary login, obtain authorization to use secondary display

    3.3.1. Script to copy secondary display authorization

    #!/bin/sh xauth -f "$1" merge /var/lib/gdm/:1.Xauth chown user:group "$1" /bin/chmod g+r "$1"

    If you call this script merge-gdm-auth, it would used as:

    if you want to get the authorization for the secondary display into the user who just logged in.

    * user is the user name of the primary user * group is the shared group of the primary user and secondary user

    3.3.2. Allow primary user to run the script as root

    Modify /etc/sudoers with a line such as:

    daniel ALL=(root) NOPASSWD: /usr/local/bin/merge-gdm-auth

    3.3.3. Execute the command on login

    Add a line such as the following to $HOME/.xsessionrc (for users who will use both displays)

    sudo /usr/local/bin/merge-gdm-auth "$XAUTHORITY"

    3.4. Share the mouse and keyboard with secondary display

    3.4.1. Before login on secondary display

    Make sure the command x2x is present on your system (package x2x on Debian) and add the following line to $HOME/.xsessionrc:

    That gets us a mouse and keyboard we can use to move over to the secondary monitor (on the right)

    3.4.2. After login on secondary display

    We first need to make sure that the secondary user is able to obtain the authorization to use the primary display (for x2x)

    3.4.2.1a. Method One
    1. Make sure the primary and secondary user share the same primary group
    2. Make the primary user’s home directory group-readable and group-executable
    3. On login as the primary user, create a symlink to the $XAUTHORITY file (authorization for the primary display; will not be the default $HOME/.Xauthority if we use this method because GNOME doesn’t like those perms)
    4. On login as the secondary merge in the primary user’s authorization (via the link)
    5. Launch x2x to use the mouse and keyboard from the primary user

    3.4.2.1a.4. Merge in primary user’s authorization

    In secondary user’s $HOME/.xsessionrc

    xauth -f "$XAUTHORITY" merge /home/daniel/.Xauthority-link

    In secondary user’s $HOME/.xsessionrc

    3.4.2.1b. Another method (untested)

    Use sudo to let secondary user launch x2x as the primary user on the primary display (with primary user’s home directory)

    In secondary user’s $HOME/.xsessionrc

    DISPLAY=:0 sudo -u primaryuser -to :1 -east
    Defaults>primaryuser always_set_home Defaults:secondaryuser env_keep = "DISPLAY XAUTHORITY" secondaryuser ALL=(primaryuser) NOPASSWD: /usr/bin/x2x

    4. Gotchas

    • xscreensaver doesn’t blank the screen on the primary display unless you have the mouse on the primary display before leaving things idle
    • If you switch to a virtual terminal the secondary display will go blank and won’t come back when you switch back
    • Copyright: Copyright 2009 Daniel F. Dickinson and any new contributors This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this file, if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

    Источник

    Шпоры

    Хорошо, если у нас есть ноутбук с Debian wheezy. А что если у нас есть второй монитор и мы хотим его подсоединить к нашему ноутбуку? В моем случае второй монитор подсоединился автоматически, но при этом не только на нем вывод был с плохой разрешающей способностью, но и на экране самого ноутбука качество изображения изменилось не вbлучшую сторону. Вобщем встал вопрос: как «правильно» подсоединить второй монитор к нашему ноутбуку? Выполним программу xandr:

    Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 8192 x 8192 LVDS1 connected (normal left inverted right x axis y axis) 1366x768 60.0 + 1360x768 59.8 60.0 1024x768 60.0 800x600 60.3 56.2 640x480 59.9 VGA1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 509mm x 286mm 1920x1080 60.0*+ 1280x1024 75.0 60.0 1152x864 75.0 1024x768 75.1 60.0 800x600 75.0 60.3 640x480 75.0 60.0 720x400 70.1 HDMI1 disconnected (normal left inverted right x axis y axis) DP1 disconnected (normal left inverted right x axis y axis)

    Достаточно прозрачный вывод. Если выполнить программу xrandr со следующими параметрами (их значения выбираем из вывода предыдущей команды):

    то вывод будет выполняться только на экран ноутбука. Общая идея понятна. Теперь мы хотим следующее. При включении компьютера, если подсоединен второй монитор, нам надо, чтобы включался только этот второй моитор. Если второго монитора нет, то пусть включается только (а что ж еще?) монито ноутбука. Дя этого создаем файл /etc/X11/Xsession.d/45custom_xrandr со следующим содержанием (он запускается при запуске иксов):

    xrandr | grep VGA1 | grep " connected " if [$? -eq 0]; then # Внешний монитор отключен # Если мы хотим два показывающих монитора # xrandr --output VGA1 --mode 1920x1080 --pos 0x0 --output LVDS1 --mode 1366x768 --pos 0x0 # Если мы хотим включенный только внешний монитор xrandr --output VGA1 --mode 1920x1080 --output LVDS1 --off if [$? -ne 0]; then # Если что-то не так xrandr --output LVDS1 --mode auto --output VGA1 --off fi else # Внешний монитор не подключен xrandr --output LVDS1 --mode 1366x768 --output VGA --off fi

    Источник

    Читайте также:  Dead process in linux
Оцените статью
Adblock
detector