Articles February 11, 2007 at 4:56 pm

Setting a specific resolution at the login window, or an alternative to CScreen

I’ve been dealing with a rack-mount KVM that refuses to sync properly with any generation of Xserve on reboot. While reboots aren’t a common occurrence, I had a request to from The Powers That Be to “fix this”.

Since a regular display will sync correctly every time, I do blame the KVM. To me this is a complete non-issue: simply set the KVM to another unit, wait til the Xserve has finished booting, login via ARD and set the desired resolution. However, I still had a request to do something about it.

Read on for how I solved this…

I did know about CScreen, but that’s PPC-only and the author wishes to be left alone at this time. There’s no code for it available that I know of, and I don’t much want Rosetta running on an Intel Xserve. Thankfully, we have SetDisplay, available at macosxlabs.org.

I’ve provided an installer package that will install the (Universal Binary) binary “SetDisplay” in /usr/local/bin , add a launchd item for it in /Library/LaunchDaemons, and add a short (10 second) delay to the loginwindow (required for this to work correctly) – which means that 10.4.3 or higher is required. The supplied installer has been fully tested but is supplied as is, use at your own risk. However, it’s easy enough to pull it apart and see what’s going on if you choose to.

Download SetDisplay from http://archive.macosxlabs.org/tools_and_scripts/script_archive/scripts/miscellaneous/university_of_utah/SetDisplay.html

Be sure to read the the terms of use at the beginning of the provided code. Then take that actual code and drop it into a file, for example, SetDisplay.c and save. If you don’t have the developer tools installed, you’ll need to. I used the latest available XCode from developer.apple.com. My compile instructions will give you a Universal Binary, binary.

cd to the location of SetDisplay.c, and be sure to comment out the info at the beginning of the file.
Compile it with:

<code>
CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386" \\
LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386" \\
cc -g -o SetDisplay -arch ppc -arch i386 -Wall -framework ApplicationServices \\
-F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/ApplicationServices.framework \\
SetDisplay.c
</code>

Put SetBinary in a location of your choice, for example /usr/local/bin and verify the permissions on it.
Note that if you don’t pass an argument to SetDisplay, it will default to 1024 Height x 768 , 32 BitsPerPixel, Refresh rate: 75.

If you desire a different resolution, you’ll need to customize your launchd item for it. If you go that route of course you assume all risks, be sure you choose a resolution that your kvm (or display) supports.

If you don’t have Lingon, find it here:http://lingon.sourceforge.net/

Make a launchd item for SetDisplay. I went with a UserDaemon, with program argument: /usr/local/bin/SetDisplay and rebooted. After the initial trickery of the 10.4 startup “progress” bar, the screen resolution reset to the SetDisplay default, and the login window appeared. However, for this to work right, I found you need to insert a delay in the loginwindow prefs, support for which was added in 10.4.3.

Note that if your kvm keels over immediately after you reboot your Xserve (as is the case for me), you’ll still need to switch away from the unit in question immediately after reboot. Still, all of this allows the kvm to sync (vs. not at all) when switching back to the unit.

Hope you find this helpful.

— David Haines.

No Comments

  • I use a KVM (Dr. Bott) on my xServe (as well as other machines). What I have noticed is that in order for the KVM to work properly, I need to have the xServe selected on the KVM during reboot. If I select the xServe and reboot, all is good, if I don’t, I can’t even get video at all until I reboot. I know it is not a solution, but have you tried this to see if it helps?

    • Please (re-)read my text at the very end. With the KVM in use in this case, a Tripp-Lite rack-mount (kvm & FP monitor), when rebooting the KVM dies & has to be rebooted.
      So, no: having the unit in question selected when rebooting in fact is problematic in my situation.
      Other KVMs work fine with Apple-supplied video cards, but many don’t.

      The reason I decided to ask to have this published is that in my own searches I did come across quite a few people asking how to set a screen resolution via “command-line” and recomendations to use CScreen. Again, PPC only and so not particularly desirable for Intel Xserves. If nothing else, this may be useful to others for other uses.

  • This is fantastic! A great help. That out-of-sync with my Aten KVM for my two xserves was driving me nuts at times. Works great.

  • I have a brand new xserve that will not display on my KVM. If I boot it to an external monitor and then switch plugs to the kvm it displays fine. I installed the setdisplay pkg and it still doesn’t work. Any idea for a next step?

    Thanks,
    Adam

  • The SetDisplay.c file can be found in the SetDisplay.zip archive on this site: http://x86dev.org/forum/index.php?topic=15.0

Leave a reply

You must be logged in to post a comment.