Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Control LED lights on your Dell XPS Laptop

0.00/5 (No votes)
12 May 2008 1  
Utilze Dell's XPS LightFX API to create your own LED effects.

Introduction

I recently came across an article from 2006 by Scott Quibell about changing the LEDs on an XPS Notebook. I own an XPS M1710, and decided I would set out to discover how to control the LEDs myself.

I started by downloading QuickSet from Dell, which is an application that allows you to control a lot of items on your laptop. It even has some built in effects for your LEDs, but none of them were impressive enough. The 0.5 minimum wait time made the effects seem too jumpy for my taste, so I began a search to see how Dell was controlling the LEDs from an application.

Dell QuickSet Application

I found my answer to controlling the LEDs with Dell XPS LightFX - a prebuilt C++ library that controls the LEDs. I wanted to use this with .NET applications, so my only choice was to take the GamingSDK.dll shipped in XPS Light FX and write a .NET wrapper around it. I called this library LightFX.

Requirements

To utilize XPS LightFX you need the following:

  • An XPS Notebook. (Note that the LightFX site says it is for M1710 notebooks. This is not entirely accurate as I have found that other models, such as the M170, also support XPS Light FX. Also, it appears that there is support for XPS Desktops.)
  • QuickSet for testing to see if XPS LightFX works on your computer.
  • XPS LightFX

LightFX

LightFX is a simple .NET wrapper around XPS LightFX. I designed this library using the code from Björn Carlsson as a template. My code is very similar to his, but has been simplified and modified to match my own coding standards.

The files included in LightFX:

  • Capability.cs
  • An enumeration of capabilities (notebook, desktop, none).

  • Color.cs
  • An enumeration of the possible LED colors.

  • GamingSDK.dll
  • The C++ DLL added as content and "copy always" to pass along to any project using LightFX.

  • Intensity.cs
  • An enumeration of the levels of LED brightness or intensity.

  • Led.cs
  • The exposed class managing the LED control workflows.

  • NativeSettings.cs
  • A struct for storing LED settings in memory to pass to the C++ code.

  • Setting.cs
  • The .NET struct with alterations to the names for the LED settings.

  • Touchpad.cs
  • An enum containing the only two settings for the touchpad: On and Off.

  • XPSLightFX.cs
  • The wrapper around the C++ code.

LightFX Usage

Usage has been simplified greatly. The LightFX.Led class handles the logic between initializing the SDK and releasing it. There are two methods of controlling the LEDs. The first is by using an XML script file with SetEffectFile.

<Effect>
  <Sequence Zone1="5" Zone2="5" Zone3="5" Zone4="0" Intensity="7" Time="6000" />
  <Sequence Zone1="2" Zone2="2" Zone3="2" Zone4="0" Intensity="7" Time="4000" />
  <Sequence Zone1="1" Zone2="1" Zone3="1" Zone4="1" Intensity="7" Time="250" />
  <Sequence Zone1="1" Zone2="1" Zone3="1" Zone4="0" Intensity="2" Time="250" />
  <Sequence Zone1="1" Zone2="1" Zone3="1" Zone4="1" Intensity="7" Time="250" />
  <Sequence Zone1="1" Zone2="1" Zone3="1" Zone4="0" Intensity="2" Time="250" />
  <Sequence Zone1="1" Zone2="1" Zone3="1" Zone4="1" Intensity="7" Time="250" />
  <Sequence Zone1="1" Zone2="1" Zone3="1" Zone4="0" Intensity="2" Time="250" />
  <Sequence Zone1="1" Zone2="1" Zone3="1" Zone4="1" Intensity="7" Time="250" />
  <Sequence Zone1="1" Zone2="1" Zone3="1" Zone4="0" Intensity="2" Time="250" />
  <Sequence Zone1="1" Zone2="1" Zone3="1" Zone4="1" Intensity="7" Time="250" />
  <Sequence Zone1="1" Zone2="1" Zone3="1" Zone4="0" Intensity="2" Time="250" />
  <Sequence Zone1="1" Zone2="1" Zone3="1" Zone4="1" Intensity="7" Time="250" />
  <Sequence Zone1="1" Zone2="1" Zone3="1" Zone4="0" Intensity="2" Time="250" />
</Effect>
  • Zone 1 = Fans
  • Zone 2 = Speakers
  • Zone 3 = Lid
  • Zone 4 = Touch Pad

The script contains color definitions for the first three zones (0-16), the touchpad for zone 4 (0 or 1), the intensity (0-7), and the time in milliseconds. This script must be passed in as an XML file.

The other way to set the LED colors and brightness is to use the LightFX.Setting struct in SetLed.

Led led = new Led();
Setting settings = led.GetLedSettings();

settings.Fans = LightFX.Color.Ruby;
settings.Speakers = LightFX.Color.Ruby;
settings.Lid = LightFX.Color.Ruby;
setting.Intensity = LightFX.Intensity.Brightest;
setting.TouchPad = TouchPad.On;

led.SetLed(settings);

The above code will set all zones to Ruby at the highest intensity with the touchpad on. The zones can be altered by color independently of one another; however, the intensity applies to all zones, including the touchpad.

Current Deficiencies

While the code I offer has much of the functionality, there may be methods I am missing. The included methods are only known thanks to Björn Carlsson's work. One particular missing feature is the ability to retrieve the current "Power On" settings. If you would like to delve further into the API and extract any more methods, please post the DLL Import declaration in the comments and I will add your additions to the article (and give credit).

I have not tested this code on a desktop, but according to the documentation, Setting (and NativeSetting) cannot be used for anything other than a laptop. If you have an XPS desktop, play around with the code and see what you can get it to do. If you write an article on how to use XPS LightFX on a desktop, let me know and I will link to it from this article.

Conclusion

You could create a hook into online games (such as World of Warcraft) to make your lights change depending on the status of your character. You could make your computer perform lightshows on specific events, such as new e-mail, or just one effect all the time. The QuickSet application even has plug-ins for Media Player and WinAmp to change the colors based on the music you are listening to. With the ability to change the LED colors and intensity, the opportunities are endless. If you are looking for a great idea in a professional environment, check out this article by Mike Swanson on Automated Continuous Integration and the Ambient Orb™. Using visual aids to augment the build lifecycle can be a very useful tool.

Updates

May 15, 2008

Altered the project by removing unnecessary references.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here