C# Getting/Setting BIOS Settings? - c#

I work with a Dell XPS M1710. The laptop has lights in the lid, the side speakers, and the front speakers (3 sets of lights that can be individually adjusted) and a light under the mousepad. In the BIOS I can change the color of these lights, at least, each group. Also, I can turn a light on/off under the mousepad, I can't change it's color, just alternate if it's lit. The laptop came with a lot of software from Dell, but I've installed Windows 7 and lost all of their apps, including one that allowed me to change these light colors. Now that Dell's app is gone, I'm interested in making my own C# application to change the color of these 3 sets of lights (I don't particularly care to change the light under the mousepad, I like it off). How would I go about developing an app to retrieve and change these BIOS settings?

We released an SDK for the community:
http://www.dell.com/html/global/xps/lightfx/index.html
(I can say "we" because I worked on it!!)
Offers an extensive library of
functions for building custom effects
using the XPS M1710 LED lights.
Allows you to build custom effects
just by creating a text file with a
few simple XML tags -- even if you
are not an XML programmer.
Includes application programming interface
(API) functions that allow you to
program lighting effects directly
into applications.
Highlights
several sample effects to inspire you
to new heights of creativity.

From what I've been able to find, this hackery is done in SMBIOS.
Looks like this developer figured it out -- he's written a Python GUI on Linux.
I read the source, and he's hooking to dellLEDCtl in libsmbios to do the dirty work. Here's the source, if you can stomach it. The git repo that Dell provided to the community for this stuff is here.
I don't think you're going to get this done completely managed.

Related

Windows 10 access keyboard light on laptop

I recently purchased a lenovo t420 laptop. I upgraded it with an SSD and did the update from 7 to 10. I then installed a clean image of windows 10, without all the bloatware. I would like to have access to the keyboard light without installing the Lenovo software. It isnt a backlight but is a single white LED next to the camera above the display. I see it come on for a split second when I cold boot the machine, I'm assuming this is part of the POST test or similar boot process and as such I would think there would be some way for me to connect to it.
I have tried using the new Lamp class in the windows 10 UWP API, and that doesnt work. I also tried using the device enumeration method and that doesnt show anything that looks like the LED.
Here is the code I tried so far, condensed a bit.
Lamp lamp = await Lamp.GetDefaultAsync();
this reults in lamp = null
string selectorString = Lamp.GetDeviceSelector();
DeviceInformationCollection devices = await DeviceInformation.FindAllAsync(selectorString);
this also results in null
this is the device enumeration code:
DeviceInformationCollection devices = devices = await light.EnumerateDevices();
This gives me about 291 different devices in the collection, none of which seem to match. I have held back on posting here as the list is long but can if requested.
Is there any way for me to access the LED through C#, if not C# than perhaps another language?
EDIT: I just found the keyboard key, I had bad info before, its Fn + Pgup. That works so i guess I dont need to write something myself but I am still curious as to why I cant find a hook to it.
As a learning exercise I would still like to know how to access the LED.
Ok, so I think this is as close as I am going to get to an answer and I would like to put it here for any future curious minds.
Here is a link to a page with a bunch of info on how to get at the ThinkLight from Linux and Windows.
http://www.thinkwiki.org/wiki/ThinkLight
And here is the important stuff in case the link breaks.
Controlling the ThinkLight with the keyboard works on all systems since it relies on the BIOS exclusively. Just press Fn+PageUp to toggle its state between on and off.
Starting with the ##30 series models (T430, T530, W530, etc), the keystroke was changed to Fn+Space in order to better accommodate the new 6-row keyboard layout. On models with backlit keyboards, there are 4 states: off, dim backlit, full backlit, and full backlit w/ ThinkLight. Models without backlit keyboards only have ThinkLight on and ThinkLight off, which can be obtained by disabling the backlit keyboard in the BIOS of models with backlit keyboards installed.
Software Control via thinkpad-acp
Software Control via thinkpad-acpi
Support for controlling the light with ACPI is provided by thinkpad-acpi. After installing it, a simple
# echo 255 > /sys/class/leds/tpacpi\:\:thinklight/brightness
switches it on and a
# echo 0 > /sys/class/leds/tpacpi\:\:thinklight/brightness
switches it off again.
This allows one to control the light in scripts. Unfortunately, no known ThinkPad comes with a light sensor (yet). ;)
To use these controls in scripts without root permissions, you should run
# chmod 666 /sys/class/leds/tpacpi\:\:thinklight/brightness, which is probably best done using udev.
Applications
led-notification: Pidgin plugin to use any LED to indicate new
messages. I've forked led-notification to support the ThinkLight via
thinkpad-acpi. The plugins below either weren't compatible with the
latest pidgin or didn't compile for me. The original author of
led-notification seems MIA. Another fork pidgin-led-notification to
write user defined strings (added to Gentoo/Linux)
gaim-thinklight: If you are using GAIM, the gaim-thinklight plugin
will enable you to use the ThinkLight as an indicator for new
messages. This depends on thinkpad-acpi.
gaim-lighthink: gaim-lightthink is an alternative to gaim-thinklight.
pidgin-blinklight:pidgin-blinklight is a replacement for
gaim-lighthink intended for use with Pidgin.
rocklight: rocklight is a xmms visualization plugin that makes the
ThinkLight flash to the beat of your music. The package also includes
a standalone stroboscope mode program.
thinkblinkd:[1] Thinkblinkd is a python daemon to control the
thinklight (and possibly other lights on your Thinkpad) it comes with
the daemon and a control script.
The script for theft alarm using HDAPS optionally flashes the
ThinkLight when the alarm is armed (disabled by default, to enable
set $use_light=1).
kopete-thinklight:[2] This plugin for kopete will enable the usage of
the thinklight as notifiaction for new messages. stupid little hack
to blink the ThinkLight: [3] A little C program that may be set SUID
so that you can use it from non-privileged programs that needs to do
a little notification.
thinkalert: [4] Another C program that may be set SUID to allow
non-privileged programs to manipulate the ThinkLight. Adds some
features over the "stupid little hack to blink the ThinkLight"
program.
thinklight-notification: This Evolution plugin notifies the user with
a blinking light whenever a new message has arrived.
ThinkBlink: blink.sh is an universal bash script making ThinkLight
blink. It can be used with any application.
Windows support
Likewise, controlling the ThinkLight with the keyboard works without any additional software. The Hotkey Features software from IBM/Lenovo adds OSD icons that appear when the light is turned on/off.
Software control via Hotkey Features
The Hotkey Features software exposes an interface that allows (among other things) to control the ThinkLight. See Python script for Windows to control ThinkPad features for more information

WPF application, fonts graphical error

I have application in C# WPF (.NET4, app runs on Windows XP Embedded) and it worked correct, but now I received screenshot and there are graphical errors around text. These errors are only around text, not button edge, nor Windows desktop.
Images:
It is graphical error (hardware), or program error which can be repaired?
Try using:
TextOptions.TextFormattingMode="Display"
Which should use ClearType. Or you could try:
TextOptions.TextRenderingMode="Aliased"
..and see if you get better results
WPF should try to use ClearType and anti-aliasing by default to give a smoothed look out of the box. It cannot be turned off WPF Anti aliasing workaround.
There's a lot going on behind anti-aliasing, like sub-pixel anti-aliasing. http://blogs.msdn.com/b/text/archive/2009/08/24/wpf-4-0-text-stack-improvements.aspx. Edges are often aliased with another algorithm, that is hardware accelerated too: edge anti-aliasing. That maybe the reason you don't have problems with edges. For performance purposes the system tries to be smart and use hardware acceleration (all modern GPUs provide such). The thing what you develop is for some kind of commercial touch screen device seemingly: like electronic information booth at plaza/mall, or some control terminal in a factory, or something. These usually can have weirdo hardware in them, exotic GPUs and motherboards. Vibration and environment impact (hot day - cold night temperature change recurrence) can cause them to have glitches and hardware failures.
Try to run other software too on the device, which uses ClearType anti-aliasing like WPF does also. See if only your software causes that or not. See if other WPF software causes such.
You can try to turn off hardware acceleration if you can on that system, and see if software rendering improves anything.
http://blogs.msdn.com/b/text/archive/2006/10/18/tips-for-improving-your-wpf-text-rendering-experience.aspx
Poke around in settings also.
Try to run hardware diagnostics and GPU tests, depending on what you can get to the device.
I would rule out font file corruption: that would probably make the font completely unusable, and you also report that the weird look comes with other fonts too, I don't think that all of them is corrupted. Try to run diagnostics for software error though.
Are there any effects being applied to the text? I've seen instances where a DropShadowEffect is applied to text - this renders well on some hardware, but on other users' machines, the text looked mangled. With the drop shadow removed it rendered nicely.
See, for example, http://social.msdn.microsoft.com/Forums/vstudio/en-US/f44bce57-d67f-46d3-8161-57c80a02e893/strange-blurring-issue-when-using-shader-effect?forum=wpf

Make entire screen monochrome and other full screen effects

Does anyone know how to apply effects to the entire screen, in c# or any programming language.
I'm mostly interested in making the screen monochrome (specifically green-white instead of black white).
I know a cross-graphic card solution is possible because I found a program that can do it:
http://www.freedomscientific.com/products/lv/magic-bl-product-page.asp
Anyone knows how to accomplish something this or where to look?
Thanks !!
There is no easy Windows API to modify the entire screen contents. But this could be done at the device driver level.
Otherwise you have to resort to some Windows API tricks: place a "fake" window over the entire desktop, in a loop: grab the entire screen contents without grabbing fake window contents, do your processing to get the monochrome effect, then display that on the fake window. Yes, it's hacky and slow, but possible. Even more hacky, when you get mouse clicks to "go through" the fake window (lots of SetWindowsRgn calls).
So cross-platform here means using GDI, though some older DirectDraw APIs might work, in that case, you have a much easier time with hardware overlays (and better performance). Though I'm not sure how many cards actually support hardware overlays, and if newer versions of windows support the older DirectDraw APIs.
One more possibility is if the video card has a C# or C++ or C API, then you can do whatever you want with the card without writing device driver code.
Then there's CUDA, but I haven't yet tried that out. I know it's for stream processing on nVidia boards, but I wonder if it could get you an easy backdoor into the video display stuff.
To help people in the future who are interested in this:
This is possible with the Magnification API's color effect method. This allows one to use a matrix that can be applied to the whole screen.
NegativeScreen is an open source project that implements the feature you are describing in C#.
Unfortunately, this only works with affine transformations, as the API takes only an augmented matrices rather than a delegate or something.

Want to know about the best framework available for my app

I am trying to design a new application which basically aims at providing biometric authentication services. What I want to do is that the app will present the user with an interface where the user can get his eye scanned for authentication. The most important feature I want to incorporate is that the user need not have a webcam, the app must be able to read the eye from the display device i.e. CRT or LCD screen itself.
I want info about the best framework available for this. Once successfully tested, I am planning to provide it as a webservice. Any one who will help me will get a royalty from my income.
I think you're want Microsofts new multi-eye monitors. This is a special version of Multi-Touch intended for eye validation, much like how Microsoft Surface is intended for surface finger interaction. For example, you can just lay an eye on the table, and the table can sense the eye is there and validate it, using blue-tooth or whatever. I saw a demo where this guy just shakes his eye near the table and it validated him. I was so cool. SDK's will be available for Retina, Iris, etc.
I know for a fact that there has not been a lot of work done in this area, but the potential is big. I wish you luck.
The best way to do this is to use (old) monitors with electron tubes (LCD screens are not suited for your purpose). By applying a rectifier for the electric current input, swapping the polarity of the cable set to the electron tube and focussing the electron ray to a radio button on your user interface where the user is required to stare at you can make sure that the ray hits directly his eye and is reflected back to a small canvas you need on your UI (users should look a bit cross-eyed for this purpose). The electron pressure paints the retina layout directly to the canvas and you can read it out as a simple bitmap. No special SDK required.
You might try Apple's new iEye. This fantastic, magical add-on to the iPad rests on the eye, and is operated via a single easy-to-use button at the bottom of the device. Unfortunately, it only works with the iPad, and the SDK is proprietary.
I don't get you.
How do you propose the image of the eye is collected without some kind of image capture device.
A bog standard 'display device' is an 'output device' as opposed to an 'input device' - this means there would be no signal.
Are you talking mobile phone apps, custom manufacture eye scanning devices, desktop pc's?
please elaborate.
aaah Patrick Karcher - has the correct answer. plus one for that - i should have been more prepared for coming to stackoverflow on april fool's day.
If you mean getting images from devices without using encoders and drivers, have a look at TWAIN (Technology Without Any Interface). and it's faq.
The most important feature I want to incorporate is that the user need not have a webcam, the app must be able to read the eye from the display device i.e. CRT or LCD screen itself.
are you sure it's possible with the current CRT and LCD technologies? i think you have to have a reading device.
more info from TWAIN.org:
The TWAIN initiative was originally launched in 1992 by leading industry vendors who recognized a need for a standard software protocol and applications programming interface (API) that regulates communication between software applications and imaging devices (the source of the data). TWAIN defines that standard. The three key elements in TWAIN are the application software, the Source Manager software and the Data Source software. The application uses the TWAIN toolkit which is shipped for free.
good lucks.
I know this is an April Fools, but... Actually, if you remove the condition about the fact that it must come from a CRT or LCD screen it might be possible to do it without image capture device attached to their computer.
Possibly using their facebook username and some red-eye photos of them (reflection of the flash off the back of the retina) + a lot of luck and R+D.
Authentication then might simply come from some way of proving that you are the person in the photo.

Does WPF use the installed color profile(ICC) in windows?

Does WPF use the installed color profile in windows for correcting the colors that are rendered?
I'm pretty sure old forms/gdi-based applications are not "automatically" color corrected, but I wonder if WPF does (or can be made to do) this automatically?
(I know I can do this manually in my own WPF apps by creating a gpu shader to do the color correction.)
The reason I ask is because more and more monitors are now wide gamut, this means that colors that look "normal" on "old" monitors will seem much more vibrant on wide gamut monitors. An example is my new monitor which has much stronger red and green colors than my other monitors.
I can correct this problem on a per-application basis for some applications (firefox, photoshop, media players using a custom shader etc.., my own wpf apps using gpu shaders..) but it would be nice if there was a way to have WPF do it automatically for all WPF applications.
It is not a big problem but it is however annoying and I had hoped that Microsoft would take the opportunity with WPF to introduce color correction by default.
edit: question clarified for posterity.
Nope. You have to implement it yourself in your app. Just like the the old forms/gdi apps.
I think this is a pretty big problem! The only application I have which supports color profiles is photoshop and I'm hardly use that. In all other situations my new wide gamut display is much worse than the sRGB one it replaced.
At a 92% gamut the colors were a little over saturated, but displays keep pushing this up and are at 110%+ now. The farther they push this the worse these displays get in non managed apps. Since there are almost no managed apps then most of the the time these displays are very bad.
Each app impelmenting color management support does not seem realistic. This needs to be done on an OS or driver level. You mention that you can do this with GPU shaders, but I know of nobody doing that except for an unofficial plugin to an open source media player.

Categories