You are not logged in.
Pages: 1
Hi,
I have Lenovo T500 laptop with hybrid switching video cards (ATI Mobility Radeon 3650 w/ 256MB or Intel X4500 integrated). I can select the card of choice in the BIOS, but when I boot Xorg will fail because of driver issues. So everytime I switch video cards I have to change xorg.conf manually.
Is any way to autodetect the video card during boot-up?
I usually use the ATI video card, but when a long battery-life is needed the Intel card is much more efficient.
Best regards,
siggiae
Offline
A simple bash script might do. Does lspci return only the card that is enabled in the bios? If yes, you could read the output of lspci and then patch xorg.conf accordingly.
Offline
Yeah, it's a simple se operation, i think so too.
Offline
Thank you guys. I thought somehow there was a more straightforward way to do this. But I have now written a simple bash script that takes care of all of this. Here is what I did:
Under /etc/X11/ I wrote an xorg.conf template (which I call xorg.template) where both video cards are defined
-------------------------------------------------------
Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen0" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection
Section "Files"
ModulePath "/usr/lib/xorg/modules"
FontPath "/usr/share/fonts/misc"
FontPath "/usr/share/fonts/100dpi:unscaled"
FontPath "/usr/share/fonts/75dpi:unscaled"
FontPath "/usr/share/fonts/TTF"
FontPath "/usr/share/fonts/Type1"
EndSection
Section "Module"
Load "glx"
Load "dbe"
Load "extmod"
Load "record"
Load "dri2"
Load "dri"
EndSection
Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
EndSection
Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/input/mice"
Option "ZAxisMapping" "4 5 6 7"
EndSection
Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
EndSection
Section "Device"
### Available Driver options are:-
### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
### <string>: "String", <freq>: "<f> Hz/kHz/MHz"
### [arg]: arg optional
#Option "NoAccel" # [<bool>]
#Option "AccelMethod" # [<str>]
#Option "offscreensize" # [<str>]
#Option "SWcursor" # [<bool>]
#Option "ignoreconnector" # [<str>]
#Option "forcereduced" # [<bool>]
#Option "forcedpi" # <i>
#Option "useconfiguredmonitor" # [<bool>]
#Option "HPD" # <str>
#Option "NoRandr" # [<bool>]
#Option "RROutputOrder" # [<str>]
#Option "DRI" # [<bool>]
#Option "TVMode" # [<str>]
#Option "ScaleType" # [<str>]
#Option "UseAtomBIOS" # [<bool>]
#Option "AtomBIOS" # [<str>]
#Option "UnverifiedFeatures" # [<bool>]
#Option "Audio" # [<bool>]
#Option "HDMI" # [<str>]
#Option "COHERENT" # [<str>]
Identifier "Card0"
Driver "radeonhd"
VendorName "ATI Technologies Inc"
BoardName "Mobility Radeon HD 3650"
BusID "PCI:1:0:0"
EndSection
Section "Device"
### Available Driver options are:-
### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
### <string>: "String", <freq>: "<f> Hz/kHz/MHz"
### [arg]: arg optional
#Option "NoAccel" # [<bool>]
#Option "SWcursor" # [<bool>]
#Option "ColorKey" # <i>
#Option "CacheLines" # <i>
#Option "Dac6Bit" # [<bool>]
#Option "DRI" # [<bool>]
#Option "NoDDC" # [<bool>]
#Option "ShowCache" # [<bool>]
#Option "XvMCSurfaces" # <i>
#Option "PageFlip" # [<bool>]
Identifier "Card1"
Driver "intel"
VendorName "Intel Corporation"
BoardName "Mobile 4 Series Chipset Integrated Graphics Controller"
BusID "PCI:0:2:0"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Card1"
Monitor "Monitor0"
SubSection "Display"
Viewport 0 0
Depth 1
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 4
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 8
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 15
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 16
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 24
EndSubSection
EndSection
-------------------------------------------------------
Then I wrote a bash script I call VideoCard.sh and placed it in /etc/. At startup it checks which video card is active and writes out an xorg.conf using the correct video card (by changing the Device line under the screen section).
-------------------------------------------------------
DIR=/etc/X11
if (lspci | grep -q 'VGA compatible controller: ATI Technologies Inc Mobility Radeon HD 3650'); then
cat $DIR/xorg.template | awk '
BEGIN { n=0 }
/Section \"Screen\"/ { n=1; print $0; next; }
/Device/ {
if(n) { print "\tDevice \"Card0\"" ; n=0 ; next ; }
else { print $0; next ; }
}
{ print $0 ; }
' > $DIR/dummy
mv $DIR/dummy $DIR/xorg.conf
else
cat $DIR/xorg.template | awk '
BEGIN { n=0 }
/Section \"Screen\"/ { n=1; print $0; next; }
/Device/ {
if(n) { print "\tDevice \"Card1\"" ; n=0 ; next ; }
else { print $0; next ; }
}
{ print $0 ; }
' > $DIR/dummy
mv $DIR/dummy $DIR/xorg.conf
fi
-------------------------------------------------------
then I made VideoCard.sh executable and added this line to /etc/rc.local
---------------
/etc/VideoCard.sh
---------------
This way the bash script overwrites the Xorg.conf file at startup with respect to the active video card.
I have only tried this using the two open source drivers. In the next days I will try to install the fglrx driver and use it instead of the radeonhd driver, which could become problematic because of ATI's own libGL.so file.
Offline
Pages: 1