Search This Blog


Dual Video, Dual Monitor Project (satire)

Disclaimer: Everything discussed in this article is presented as-is as a treat for fellow computer hobbyists. By publishing it, I make no endorsement of any code contained or Linux application working on your specific Linux computer system. Nor do I advocate adding a second monitor and video card or more without carefully thinking through everything before preceding.

Note to anyone wishing to take up computers as a hobby: this article is an exposé of the past two day the project as entitled in the header above. I would rate it as overly complex, considering that I did not include full files. However, there is a picture below to show the result of what I started almost ten days ago.

After posting this blog entry to GooglePlus, it may be subject to editing to remove any spelling mistakes or syntax errors. YMMV

Update: 20150202.0055H PST

Here are the promises pictures of my completed Dual Monitor Project:

Since January 23, 2015, I have put together a dual monitor computer system.

Here are the specifications on the PC: It's a HP dc5000 SFF(PB480A) with Intel(R) Pentium(R) 4 CPU 2.00GHz, 4 GB of RAM and 250 GB HDD.

For video it uses a 82865G as display controller integrated with the motherboard. What this means is that the 82465G provides a VGA output from the motherboard to hook up to a Samsung LCD monitor. I also added a second video card with VGA output, which is a 3D Rage IIC PCI [Mach64 GT IIC]. It also hooks up to an IBM LCD monitor.

After adding the IBM 1024x768 monitor and the Mach64 video card by putting the video card in the appropriate slot and screwing it in, I configured a new xorg.conf, following the instructions in the manual found by executing the following command:

$ man xorg

It led me to this command:

$ xorg -configure

When you run xorg with the -configure option, it creates the xorg configuration file, xorg.conf.

Next I edited the file until I got it to run both cards.

Here are some excerpts from xorg.conf:

Section "ServerLayout"
Identifier " Configured"
Screen 0 "Screen0" 0 0
Screen 1 "Screen1" RightOf "Screen0"
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"


Section "Monitor"
Identifier "Monitor1"
VendorName "Monitor Vendor IBM"
ModelName "Monitor Model L150"

Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor Samsung"
ModelName "Monitor Model SyncMaster740N"

Section "Device"
Identifier "Card1"
Driver "mach64"
BusID "PCI:5:4:0"

Section "Device"
Identifier "Card0"
Driver "intel"
BusID "PCI:0:2:0"


The file xorg.conf is moved to the folder /etc/ using the sudo command to give me temporary super-user powers:

$ sudo mv xorg.conf /etc/xorg.conf

Afterwards, any corrections to it need super-user powers.

Since the Samsung monitor has the dimensions of 1280x1024 and the IBM monitor, 1024x768, they got set up after a reboot as Screen0 (Monitor0) and Screen1 (Monitor1). Card0 (the onboard Intel video controller) is attached to Monitor0 and Card1 (the Mach64 VGA PCI card), to Monitor1.

Respectively the output to Monitor0 is called Screen0 and the output to Monitor1, Screen1.

Overall, here are the dimensions of the master Screen0 and its slave Screen1:
$ xrandr --screen 0
Screen 0: minimum 320 x 200, current 1280 x 1024, maximum 2048 x 2048
VGA1 connected 1280x1024+0+0 (normal left inverted right x axis y axis) 338mm x 270mm
1280x1024 60.02 + 75.02*
1280x960 60.00
1152x864 75.00
1024x768 75.08 70.07 60.00
832x624 74.55
800x600 72.19 75.00 60.32 56.25
640x480 75.00 72.81 66.67 60.00
720x400 70.08

$ xrandr --screen 1
Screen 1: minimum 1024 x 768, current 1024 x 768, maximum 1024 x 768

Originally, Screen1 would not work.

Specifically after boot up, the enable flag contains a 0. I figured that the enable flag need to be toggled from 0 to 1.

So I created a file called enable-video to fix the problem:

$ cat bin/enable-video
#!/bin/sh -e
# enable second video card
echo "1" > /sys/bus/pci/devices/0000\:05\:04.0/enable

The above command puts a 1 into the enable flag, turning on the device.

As you will note, the BusID "PCI:5:4:0" corresponds the device on the pci bus known as "0000:05:04.0".

This solution worked, but it eventually would get time consuming to boot up Linux, wait until Screen0 came up, run enable-video in a command-line window, and pkill X in super-user mode.

So after a couple days of searching, I decided on placing it in /etc/rc.local. In order to implement this decision, I copied the enable-video file to the folder /usr/local/sbin which is where all user-created system files go.

Then the following two lines went into /etc/rc.local, a line above the 'exit 0'.

# enable screen1

This worked for a little while, but I now ran into the blank screen problem. The system would boot up but halfway through, the system would get confused and only enabled Screen1, all 1024x768 of it as Screen 0.

So, before the enable-video command, I placed the following command to remove the framebuffer:

# remove framebuffer
setpci -s 00:02.0 F4.B=00

No change occurred. Screen1 lights up. No Screen0.

So I researched this problem with the help of Google Search, and came across the suggestion to update the file grub.cfg
in the folder /boot/grub.

All this meant was changing the file's contents for the first image of Linux to boot until thing worked. Then the next thing to do was to implement the change using /etc/default/grub.

/etc/default$ cat grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'

GRUB_DISTRIBUTOR=`echo CrunchBang`
*GRUB_CMDLINE_LINUX_DEFAULT="quiet i915.modeset=1"*

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)

# Uncomment to disable graphical terminal (grub-pc only)

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux

# Uncomment to disable generation of recovery mode menu entries

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

That is it: set the mode to 1 for i915.

Then I ran update-grub in super-user mode.

At this point all the hard stuff is finish, and it took about two days to get to this point.

Since partially upgrading to Debian Jessie, a favorite highly configurable system monitor called conky broke. This means the usual startup sequence got changed because conky is not an essential part of Linux.

So as a workaround, it's placed at the end of the file .profile in my user account home directory at "~".

# Since upgrading to Debian Jessie, conky is broken and does not
# run after logging into the system. So run the appropriate tool.

# Detect Screen 1 and redirect to display to it
scrn=$(xrandr --screen 1|cut -d " " -f 1)
if [ "$scrn"=="Screen" ]; then

Just to work in a dual monitor system like mine, I put in the four lines of BASH code to check if Screen1 is enabled, and temporarily create DISPLAY so conkywonky runs for Screen1. The command DISPLAY=":0.1" helps redirect video data to Screen1. "0.1" is Xwindows speak for Screen1.

Unfortunately, it may be harder to run HTOP, an application used to monitor all processes on my computer in real time on Screen1 due to the fact that it is an Xserver savvy app.

No comments: