Click here to Skip to main content
15,882,055 members
Articles / Desktop Programming / Windows Forms

Control LED lights on your Dell XPS Laptop

Rate me:
Please Sign up or sign in to vote.
4.25/5 (5 votes)
12 May 2008CPOL4 min read 70.5K   878   16   9
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.

XML
<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.

C#
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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Other
United States United States
I have been a Techincal Consultant in Omaha, NE specializing in .NET technology since 2007. My latest projects include hyperspectral imaging, Learning Management Systems, Content Management Systems, Online StoreFronts, medical web applications, and other websites. Before becoming a consultant I spent 2 years developing ASP.NET websites for a large market research company. My favorite programming language is C#.

In my free time I enjoy studying the Japanese culture and language, practicing a Japanese sword art called Shinkendo, and spending time with my family.

Comments and Discussions

 
QuestionFinally took my XPS 1710 upgraded it to Windows 10. Pin
Jonathan Golfo18-Feb-16 0:32
Jonathan Golfo18-Feb-16 0:32 
QuestionUpdate? Pin
i0012-May-13 6:48
i0012-May-13 6:48 
QuestionLed controlls Pin
martels5718@hotmail.com31-Dec-08 4:26
martels5718@hotmail.com31-Dec-08 4:26 
Generalcsproj no workey Pin
RRRRRyan14-May-08 4:29
RRRRRyan14-May-08 4:29 
needs $(MSBuildBinPath) in place of ToolsPath that you have in yours. I was able to open the project but it doesn't compile, a bunch of references that my system does not have, this is too much trouble. I'm just gonna leave the dumb lights off. Geesh.

I want to make a simple console app that accepts the xml file as a parameter, executes it, and exits. Seems more useful than anything I've been able to find. So I can schedule lighting events by the time of day. Like, side lights when it's dark. .. gosh Dell, just make something useful please.
GeneralRe: csproj no workey Pin
Broken Bokken15-May-08 4:40
Broken Bokken15-May-08 4:40 
GeneralRe: csproj no workey Pin
RRRRRyan15-May-08 5:43
RRRRRyan15-May-08 5:43 
GeneralRe: csproj no workey Pin
Broken Bokken16-May-08 3:12
Broken Bokken16-May-08 3:12 
GeneralNeeds a bunch of work... Pin
Dave Kreskowiak12-May-08 6:29
mveDave Kreskowiak12-May-08 6:29 
GeneralRe: Needs a bunch of work... Pin
Broken Bokken12-May-08 6:37
Broken Bokken12-May-08 6:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.