Automate configuration of notebook display when docked or undocked
This document (7001151) is provided subject to the disclaimer at the end of this document.
Environment
Situation
Notebook system is configured correctly for the internal display but when docked the external display uses a different resolution and does not display correctly.
Resolution
This suggested solution is not supported by SUSE. Implementation, modification, and troubleshooting of this script is the sole responsibility of the user.
With Linux there are always a number of creative solutions for the same issue. This is just one suggested method of working around this issue.
First step is to configure the system so it is working correctly while undocked (using the internal display). If you are having trouble getting the display (internal or external) configured correctly, Technical Information Document 3564938 may be of some help. When satisfied with the display settings make a backup copy of the /etc/X11/xorg.conf. In my example I will assume that the internal display uses a resolution of 1440x900. Here's the command to make a backup copy of the file with a new name that identifies the resolution:
cp /etc/X11/xorg.conf /etc/X11/xorg.1440x900
With the "undocked" display configuration saved the next step is to dock the system and configure the system for the external display. When satisfied with the settings make a backup copy of the now modified xorg.conf file again. For this example let's assume the external display resolution is 1280x1024. Here's the command to make the backup copy:
cp /etc/X11/xorg.conf /etc/X11/xorg.1280x1024
With the two backup configuration files in place a script can be added to the file /etc/init.d/boot.local that will search for specific information returned from the "hwinfo" command to determine if the system is docked or not and then copy the appropriate xorg.??? backup file to xorg.conf.
For Dell systems the bios information returned by "hwinfo --bios" will include the string "Docking Station" when the system is docked. Here are the lines to add to the /etc/init.d/boot.local (create it if it does not exist and make the first line "#!/bin/bash"):
# Check to see if system is docked and copy appropriate xorg.conf file.
#
DOCKED="`hwinfo --bios | grep "Docking Station" | wc -l`"
# The following line can be uncommented for debugging.
# echo $DOCKED > /root/docked-state.txt
if [[ $DOCKED -gt "0"]]
then
cp /etc/X11/xorg.1280x1024 /etc/X11/xorg.conf
else
cp /etc/X11/xorg.1440x900 /etc/X11/xorg.conf
fi
# End of setup for docked vs. undocked.
Here's another example, written by one of the other engineers, for testing the docked status of an IBM or HP notebook system. The value "LTN121XJ" was found as the unique value when the system is docked and the command "hwinfo --monitor" is run. Notice that he has used a little different logic in his example. If the value of "LAPTOPMON" is "0" (meaning it is not using the internal display) then copy the xorg.conf that is for the external monitor:
# Check to see if system is docked and copy appropriate xorg.conf file.
LAPTOPMON="`hwinfo --monitor | grep "LTN121XJ" | wc -l`"
echo $LAPTOPMON > /root/laptopmon.txt
if [[ $LAPTOPMON = "0"]]
then
cp /etc/X11/xorg.1280x1024 /etc/X11/xorg.conf
else
cp /etc/X11/xorg.1440x900 /etc/X11/xorg.conf
fi
# End of setup for docked vs. undocked.
Additional Information
hw_item is one of:
all, bios, block, bluetooth, braille, bridge, camera, cdrom, chipcard, cpu,
disk, dsl, dvb, floppy, framebuffer, gfxcard, hub, ide, isapnp, isdn,
joystick, keyboard, memory, modem, monitor, mouse, netcard, network,
partition, pci, pcmcia, pcmcia-ctrl, pppoe, printer, scanner, scsi, smp,
sound, storage-ctrl, sys, tape, tv, usb, usb-ctrl, vbe, wlan, zip
Disclaimer
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.
- Document ID:7001151
- Creation Date: 14-Aug-2008
- Modified Date:16-Mar-2021
-
- SUSE Linux Enterprise Desktop
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com