Saturday, April 29, 2006
* Change brightness in 8 steps
* Change fan speed in three steps
* Remembers settings (put it in your startup directory)
* Remembers settings and switches between them when you change from AC to battery.
* When comming back from standby or hibernate, changing the fan speed wont work before you run the tpsmain.exe program.
The program is supposed to replace the Toshiba Power Management software, and works great together with the Notebook Hardware Control.
Tuesday, April 25, 2006
Warner Crocker is asking me if I’d like to release the little utility I just blogged about how I wrote here, here and here. The answer is yes. There are just a few issues I need to resolve before releasing it into the public (Whenever I return from suspend mode, calling the functions for setting the cooling method wont work, and I need to run tpsmain.exe to reset something. I’m looking into it, and will keep you all posted)
Remember that this tool is supposed to be used together with a utility for controlling the processor/ speed/voltage (I’m using Notebook Hardware Control). My little utility only replaces the code for automatically adjusting the brightness and cooling method when switching between battery and ac operation.
The picture I posted yesterday was of course from running on batteries. When running on AC the “battery optimized” fan speed makes the computer a bit hotter, the temperature lies between 50–60 C, but always closer to 50 than 60.
Monday, April 24, 2006
You're probably interested in hearing what the results are after running the Fan Utility for while. See the picture to show you that I managed to keep the computer quite cool and running for quite a while with the fan in battery mode and the processor in "slow motion".
Yes, approx three hours of battery time, and a cool computer (around 40C). And all this with Notebook Hardware Control and my own custom fan control utility that also turns down the screen brightness.
Sunday, April 23, 2006
From my last posts you’ve probably read that I managed to find out how to declare and use the APIs for getting and setting the cooling method on my Toshiba Tecra M4.
When I develop applications I always spend some time researching before I start to write the final program. I also throw away the code I write in the research phase so that I can start all over, believing that doing things twice increases the quality of my programs.
The initial design for my utility was a small program that would rest in the tray area letting me change the cooling method from a simple pop up menu. After some thinking I found out that I some additional features that would be nice to have:
- Setting the brightness level of the screen (to save power when running on batteries)
- Add functionality for automatically changing between settings when using batteries and when running from an AC power source
Getting and setting the brightness level was an easy task to accomplish since both the functions GetBrightness and SetBrightness were exported by the Toshiba DLL I was using. The interfaces for these functions were almost the same as for getting/setting the cooling method.
Receiving notifications when switching power sources is easy to do in C#. I remembered reading an article on Codeproject.com about getting notifications about power source changes written by Al Gardner. The article how to use the SystemEvents.PowerModeChanged event and also described how to retrieve information about the current power source using PInvoke to call the Windows API GetSystemPowerStatus.
Creating a Tray Application in C# is simple, all you have to do is create an ordinary WinForms application, set the main form’s ShowInTaskBar property to false and its WindowState property to Minimised.
In addition I added a NotifyIcon component to display an icon in the tray area and a ContextMenu component with the menu options I needed (remember to set the NotifyIcon’s context menu property to point to the context menu you just created).
The rest was just a matter of connecting events to the functionality I had previously discovered, and to write some code for reading/writing the settings for the application to/from the registry.
I’m currently testing the application on my Toshiba Tecra M4, and if all goes well I’ll post a copy of it here on my blog.
Friday, April 21, 2006
Previously I posted an article about the development of a little utility for controlling the fan on my Toshiba Tecra M4. The last thing I wrote was that I had tested the APIs for retrieving the current cooling method. Next up I had to find a way to set the cooling method.
The function SetCoolingMethod seemed to be a good starting point, and since I recently had some success using a pointer to a pointer to an integer (which in c# is declared as ref IntPtr paramname), I tried this with the SetCoolingMethod function as well. I wrote the interfaces in my little test project, and fired it up from within the debugger. This time the program crashed with a null pointer exception. I tried several different ways of declaring the parameter, using integers, pointers to integers and the pointer to a pointer to an integer.
I did some research to see how the Toshiba Power Management software were using the function, and saw that it seemed to send two parameters to the function. I tried to pass two pointer-to-a-pointer-to-an-int parameters to the function, and this time it worked – the fan suddenly stopped spinning like crazy when I fed it with the value 2 as the first parameter!
I now had a way of both getting and setting the cooling method, and was all set to go to build a real program that utilized this knowledge.
Stay tuned for my next post.
Thursday, April 20, 2006
A couple of years ago (ok, eight years or so), I went to my local toy store and bought the Lego Mindstorms Robotics Invention kit for my kids (they were only three years old at the moment, but the guy behind the counter didn’t know :-). I built quite a few robots, among them were roverbots using infrared lights for prozimity detection and even a dragracer that changes gears when it reached a certain speed. It was fun!
I’ve been waiting for the next version of the Mindstorms kits, and really enjoyed an article I read at the MSDN Coding for Fun site about a .Net SDK for communicating with the RCX. I found the link over at Scott Guthries blog.
I’ve blogged about power management on my Toshiba Tecra M4 Tablet PC before, and have done a lot of thinking on how I could minimise fan noise and maximise the battery lifetime. I’ve blogged about my favourite program for undervolting and controlling processor speed, Notebook Hardware Control (which I can recommend), and I’ve blogged about discarding the Toshiba Power Management program.
Lately I’ve investigated how I could control the fan speed on my computer to minimise the noise the fan is making (which a lot of people has complained about). I started to dig to see if I could find any tools to remedy this problem. I knew that I wouldn’t install the Toshiba Power Management software again, since it has a bad habbit of interfering with the Notebook Hardware Control.
I found some utilities that claimed to control the fan, but none of them worked on my Tecra M4. So I set out on the journey to create a new utility. First of all I started to search for some system utilities that could provide me with an interface to the functionality I was looking for. I took a sneak peek into the Toshiba Power Management software, and found out that it used some functions in a DLL called TPeculiarity.dll. The dll exposes a few functions that seemed interesting for what I was looking for:
Of course there are no publicly available interfaces to these functions, so all we could do is guess. From previous experiences with APIs, I guessed that GetCoolingMethod would take a pointer to a pointer to an integer and fill it with the correct data on return. Using Visual Studio 2003 and C#, I could quickly create a small test project that verified that my assumptions were correct.
In my next post I’ll give you some more information on how I developed my utility!
Wednesday, April 19, 2006
I’ve been using IE7 (beta 1/2) for a couple of months now, and it has a lot of features that I really enjoy (and I’m not talking CTRL+Q). Among the nice things I like are the small things that makes my workday (and spare time) easier. As an example is the functionality that gives focus to a window where something has happened or where a new page has been loaded.
This led me to ask for the following feature: Why can’t the same happen with a newly opened page in a frame?
Here is my scenario: I’m sitting in my sofa reading all my feeds with bloglines in Tablet PC mode. Each time I click on a link in the left frame, the right/main frame changes it’s active/selected page. To start reading (which involves scrolling), I need to perform an additional click in the right frame to give it focus. Otherwise the Tablet PC button will scroll the contents in the left frame. This is really annoying, since I need to double click twice as many times as necessary.
Wednesday, April 05, 2006
For developers like me that are used to automatic memory management and almost unlimited memory on today’s platforms, the article brings back a lot of memories from building compilers and development tools for the PalmOS platform, embedded development in C, writing games in BASIC on my Dragon 32 etc.
Tuesday, April 04, 2006
I previously wrote that I wasn’t using the “Dynamic Switching” scheme for setting processor speeds dependent on the processor load because I thought it made the computer running hotter. Again, by accident, I switched to “Dynamic Switching” mode, and presto, the temperature dropped to 42C, and it’s been there since!
UPDATE: And after a few hours the computer just turned black, and had to be rebooted. I’m still running in Dynamic Switching mode, but I need to do some more testing with different voltages. I’ve now just turned all multipliers from 8 to twelve.