SUSE Support

Here When You Need Us

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

SUSE Linux Enterprise Desktop 10
 

Situation

Notebook or Laptop system with docking station.

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

Technical Information Document  3268142 explains how to use profiles to save and select the appropriate configuration on startup of the system but if you would like to make the configuration change automatic you can try using a startup script to identify if you are docked or not and make the change to the xorg.conf file appropriately.

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

As shown in the two examples, a value must be identified that is different when docked and undocked.  The hwinfo command (must be run as the root user) is a handy tool for this one.  A great deal of information is returned by hwinfo.  To break down the information into smaller groupings a specific hardware item to probe for can be specified.  In these examples"--monitor" and "--bios" have been used.  Here is a list of items from the "hwinfo --help" command:

 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

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

tick icon

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

tick icon

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.