Much ado about scripting, Linux & Eclipse: card subject to change

Showing posts with label xorg. Show all posts
Showing posts with label xorg. Show all posts

2011-11-09

HOWTO: Make KDE remember dual-monitor randr settings

Every time I boot up, KDE appears to forget that I want my monitors to be positioned left-to-right and instead defaults to mirrored config. But, after a lot of cursing and a little googling, I found an answer so it'll no so much keep your settings, but reset its broken config to your settings.

1. Hit ALT-F2, then enter "display" to run the Display Settings app.

2. Configure your settings as you'd like. Note that if the Apply button isn't active after your changes, you can change/revert something like a Position: button to make it active.

3. On restart, KDE may forget your dual-monitor settings. So, to prevent this, go look in your ~/.kde/share/config/krandrrc file:

[Display]
ApplyOnStartup=true
StartupCommands=xrandr --output "DVI-I-1" --pos 1920x0 --mode 1920x1200 --refresh 59.9502\nxrandr --output "HDMI-1" --pos 0x130 --mode 1920x1080 --refresh 60\nxrandr --noprimary

4. Copy the configuration into a new file, and replace \n with newlines. I like to put scripts like this in /etc/X11 because they relate to screen res and positioning.

# from ~/.kde/share/config/krandrrc
xrandr --output "DVI-I-1" --pos 1920x0 --mode 1920x1200 --refresh 59.9502 
xrandr --output "HDMI-1" --pos 0x130 --mode 1920x1080 --refresh 60 
xrandr --noprimary

5. Ensure the script is readable/executable for all users:

chmod 755 /etc/X11/1920x2.sh

6. Hit ALT-F2, then enter "autostart" to run the Autostart config tool.

7. Click Add script... and browse for the script you created above.

8. Reboot and watch the magic unfold.

2011-06-06

HOWTO: get xorg.conf to work w/ 1600x1200 res and an old Intel card

  1. Check your hardware spec, and determine how much memory your card has[1]:
    # lspci -vv | grep "Intel" -A7 | grep "VGA controller" -A7 | egrep "controller|Region"
    00:02.0 VGA compatible controller: Intel Corporation 82852/855GM Integrated Graphics Device (rev 02) (prog-if 00 [VGA controller])
     Region 0: Memory at e0000000 (32-bit, prefetchable) [size=128M]
     Region 1: Memory at d0000000 (32-bit, non-prefetchable) [size=512K]
  2. Use the above values to configure your /etc/X11/xorg.conf file - I suspect much of this is not needed, but here's what I have:
    Section "Device"
     Identifier "Intel"
     Option "AccelMethod" "UXA"
     VideoRam 130560
     #Driver      "intel"
     Driver      "vesa"
     VendorName  "Intel Corporation"
     BoardName   "82852/855GM Integrated Graphics Device"
     BusID       "PCI:0:2:0"
    EndSection
    
    Section "Monitor"
     Identifier "VGA"
     ModelName    "Sceptre 24"
            HorizSync    31 - 80
            VertRefresh  55 - 76
            Option      "DPMS" "true"
    EndSection
    
    Section "Screen"
     Identifier "Default Screen"
     Device "Intel"
     Monitor "VGA"
     DefaultDepth 16
            SubSection "Display"
                   Depth           16
                   Modes           "1920x1440_60" "1920x1200_60" "1920x1080_60" "1680x1050_59.883" "1360x768_59.8" "1600x1200_60" "1280x1024_60" "1024x768_60"
                   #Modes           "1920x1440" "1600x1200" "1280x1024" "1280x768"
            EndSubSection
    EndSection 
    
    Section "DRI"
            Mode         0666
    EndSection
    
    Section "Extensions"
            Option      "Composite" "Enable"
    EndSection
    
    Section "Module"
            Load  "dri"
    EndSection
  3. In /boot/grub/menu.lst, add the correct vga mode for 1600x1200 (vga=8). If you enter what you think is the correct mode based on this table, you'll be told it's wrong and can manually correct it, boot up, then fix the file & reboot.
    default=0
    timeout=5
    splashimage=(hd0,0)/grub/splash.xpm.gz
    
    
    title Fedora (2.6.34.7-56.fc13.i686)
     root (hd0,0)
     kernel /vmlinuz-2.6.34.7-56.fc13.i686 ro root=/dev/mapper/vg_xlappy-lv_root rd_LVM_LV=vg_xlappy/lv_root rd_LVM_LV=vg_xlappy/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet vga=8
     initrd /initramfs-2.6.34.7-56.fc13.i686.img
    
    title Fedora (2.6.34.7-56.fc13.i686) cmdline only, vga=8 = 1600x1200x16
     root (hd0,0)
     kernel /vmlinuz-2.6.34.7-56.fc13.i686 ro root=/dev/mapper/vg_xlappy-lv_root rd_LVM_LV=vg_xlappy/lv_root rd_LVM_LV=vg_xlappy/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us init=3 init 3 vga=8
     initrd /initramfs-2.6.34.7-56.fc13.i686.img

See also:

2010-01-18

Monitor fail

Well, that's a week of my life I'll never have again. Spent most of last week playing with WinXP, LinuxMint 8, and Fedora 11 & 12 (both 32- and 64-bit) trying to find a solution to my external display issues.

Turns out that it's a software issue: the latest xorg intel driver has a bug.

Humorous Pictures

2010-01-05

Switching monitors with xrandr

Sure, there are applets and other GUI tools to do this, but nothing beats the purity of going commando, er, commandline. :) Thanks to this article for the inspiration.

# reset 
xrandr --auto

# turn off laptop screen
xrandr --output LVDS --off

# 24" 16x12 on
xrandr --output VGA --mode 1600x1200

# reset 
xrandr --auto

# turn off external screen
xrandr --output VGA --off

# laptop screen on
xrandr --output LVDS --mode 1280x800

UPDATE, 2010/01/05:

To enable both screens and force the larger one to include the taskbar:

# reset 
xrandr --auto

# laptop screen on
xrandr --output LVDS1 --mode 1280x800 --noprimary --pos 1600x0

# 24" 16x12 on
xrandr --output VGA1 --mode 1600x1200 --primary --pos 0x0

# echo current status
xrandr --current

2008-11-06

xorg.conf: Fedora edition

After installing a Fedora 10 preview spin on my new Thinkpad X200 last week, I got to learn yet another way to generate and test an /etc/X11/xorg.conf file. Every time I upgrade my OS, my xorg.conf file gets simpler. I expect one day I won't need one at all!

Where in the past for *ubuntu I've used dpkg-reconfigure -phigh xserver-xorg, with Fedora I needed to discover a new way. Here's what I did.

  1. First, run man startx to see a sample /root/.xinitrc file
  2. Next, create a /root/.xinitrc file
     #!/bin/bash
     xrdb -load $HOME/.Xresources
     xsetroot -solid gray &
     xclock -g 50x50-0+0 -bw 0 &
     xload -g 50x50-50+0 -bw 0 &
     xterm -g 80x24+0-0 &
     screenruler &
     twm
  3. To generate a new config file, you can run:
     startx -- :2 -configure
  4. To test a given config file (other than the default, /etc/X11/xorg.conf):
     startx -- :2 -config /root/xorg.conf.new

The above steps let you be booted graphically @ default resolution, then switch to another vt (CTRL-ALT-F2, for example), log in, and try a new xorg.conf on a different video port without affecting your running instance. To kill a trial X, use CTRL-ALT-BkSp. To switch from vt2 to the existing graphical instance, use CTRL-ALT-F1 or CTRL-ALT-F7 (it should be on vt1 or vt7).

Once I was statisfied that the xorg.conf file worked, I rebooted. On restart, using xfce or gnome, I can now graphically switch from laptop @ 1280x800 to 24" external monitor @ 1600x1200, or run both screens at 1024x768, eg., for presentations.

2008-09-19

915resolution + xorg.conf = Intel 82852/855GM @ 1600x1200x60Hz

Last week I ordered a new Sceptre 24" monitor from Tigerdirect.ca, and this week it arrived, only a few days later. Zero dead pixels, works perfectly -- and the current website price is 22% more! Timing is everything, apparently.

Of course setting up my laptops to play nice with it was another story, but for my Thinkpad T60p, I've managed to get a single display using aticonfig:

aticonfig --initial=dual-head -f
aticonfig --dtop=horizontal --overlay-on=1 --mode2=1920x1200 \
 --resolution=0,1920x1200,1600x1200,1400x1050,1280x1024,1024x768 \
 --resolution=1,1920x1200,1600x1200,1400x1050,1280x1024,1024x768

Granted, I don't have both the laptop and monitor enabled at the moment, but that's probably because I'm trying to push the laptop screen to a res it can't support (1600x1200). I could probably get them to both go to 1400x1050, but so far I'm happy w/ the single screen.

Anyway, the harder project was getting my wife's old R51 to connect to the Sceptre X24, for two reasons: one, its screen is all but dead (still works, but it's as if it's set to a brightness level of 2%); and two, the automatic configuration in Xubuntu kinda sucks for xorg.conf creation.

After a number of searches, attempts, and failures, I finally found a way to push the Intel 82852/855GM (rev 02) card to 1600x1200 at 60Hz. Here's how:

First, install 915resolution 0.5.3-1ubuntu1 from the ubuntu universe repositories. I tried downloading drivers from Intel, but I couldn't compile anything -- xf86-video-intel-2.4.2.tar.bz2, i915Graphics.tar.gz, drm.tar.gz or mesa.tar.gz -- missing dependencies, apparently.

Next, read the README that comes with 915resolution, /usr/share/doc/915resolution/README.Debian. It explains exactly how to use this tool. Here's what I put in my /etc/default/915resolution file:

MODE=3c
XRESO=1920
YRESO=1440
BIT=8

Next, in your xorg.conf, set the Driver to "i810", set the BusID to the value shown by lspci | grep VGA, set HorizSync & VertRefresh to values that will work for your monitor, and then add Display subsections for all the resolutions you want to try to use.

Section "Device"
       Identifier      "Intel Corporation Mobile Integrated Graphics Controller"
       Driver          "i810"
       BusID           "PCI:0:2:0"
       Option "DevicePresence" "true"
       Option "DRI"      "true"
EndSection

Section "Monitor"
 Identifier "Configured Monitor"
 ModelName    "Sceptre X24"
        HorizSync    31 - 80
        VertRefresh  55 - 76
        Option      "DPMS" "true"
EndSection

Section "Screen"
       Identifier      "Default Screen"
       Device          "Intel Corporation Mobile Integrated Graphics Controller"
       Monitor         "Configured Monitor"
       DefaultDepth    16
       SubSection "Display"
               Depth           16
               Modes           "1920x1440_60" "1920x1200_60" "1920x1080_60" "1680x1050_59.883" "1360x768_59.8" "1600x1200_60" 
       EndSubSection
       SubSection "Display"
               Depth           24
               Modes           "1920x1440_60" "1920x1200_60" "1920x1080_60" "1680x1050_59.883" "1360x768_59.8" "1600x1200_60" 
       EndSubSection
EndSection

Note that the most useful thing I managed to find was how to explicitly set display frequencies: for 1600x1200 at 60Hz, use "1600x1200_60". (This was required because xubuntu by default was trying to run at 59Hz and was creating terrible ghosting effects.)

To test out the above configuration, I wrote this little script (based on ideas here):

#!/bin/bash
# start a new X session on head :5, fire an xterm, and 
# launch kruler to measure screen res
# switch between vt sessions with CTRL-ALT-Fx, 
# eg., for vt2, CTRL-ALT-F2.
# I found this new vt with CTRL-ALT-F9
X -novtswitch :5 & xterm -display :5 & kruler -display :5 &

Now, granted, I still can't get 1920x1200x60Hz (the monitor's native resolution), but I may have found a solution: Tritton TRIUV200 See2 Xtreme USB 2.0 to DVI/VGA adapter.

Anyway, using a Kinamax KVM-USB4 USB 4 Port KVM Switch, I've got two laptops sharing the 24" 1600x1200 screen, with room to add up to two more systems. Minimal desktop clutter, maximum productivity.

Now, if I can just figure out a solution to my wife's workspace clutter...

2008-02-13

Dual-Monitor X.Org Configuration In Under 10 Minutes

If the above title shocks you, you're not alone. I'm still reeling from the fact that I was able to get a dual-monitor xorg.conf with almost no effort. Here's the steps:

  1. Check your ATI hardware specs.
    lspci | grep VGA
    01:00.0 VGA compatible controller: ATI Technologies Inc M56GL [Mobility FireGL V5200]
  2. Download the latest proprietary ATI Radeon driver from ati.amd.com.
  3. Quickly scan the documentation.
  4. Install the driver.
    chmod +x ati-driver-installer-8-01-x86.x86_64.run
    ./ati-driver-installer-8-01-x86.x86_64.run
  5. Configure X.Org. In my case, I have my external 1600x1200 monitor to the right of my 1400x1050 Thinkpad T60p. Of course, in "stretch" mode, both screens must be at the same resolution.
    aticonfig --dtop=horizontal --overlay-on=1 --mode2=1600x1200 \
        --resolution=0,1600x1200,1400x1050,1280x1024,1024x768 \
        --resolution=1,1600x1200,1400x1050,1280x1024,1024x768
  6. Restart X (I just hit CTRL-ALT-BkSp). If that breaks things, there's always CTRL-ALT-F1 to get back to a console.
  7. Change wallpaper from Centered to Tiled Maxpect so it's not stretched across both screens.
  8. Note the new K Menu entry for ATI Catalyst Control Center.
Thank you, AMD!