I'm using Mozilla and it appears that the Asus email LED only works for Microsoft mailers. The Chkmail program explicitly searches for a window named "Outlook Express Browser" and digs thru that to see if you have new mail. It also uses MAPI, which works with Outlook. I suppose if I hacked Mozilla to fake these out, that would be one way to go. Or I could hack Chkmail to use the SHGetUnreadMailCount(). That would solve the problem for Windows. Getting things working for Linux would be trickier, that means talking to the ACPI BIOS directly. The ATKACPI.SYS driver is only 6KB which isn't a lot of code. Easy enough to disassemble. Anyone else looked into this yet?
-
-
Quote: "Or I could hack Chkmail to use the SHGetUnreadMailCount(). That would solve the problem for Windows."
Hi. Could you explain further. My problem is that the LED only comes on for Email delivered to Outlook XP's Inbox folder, whereas my mail gets split up to subfolders using the rules wizard, and apparently Chkmail doesn't check for this.
------------------------W1N - 1.7GHz - 1024MB -
I think all of the available options only count new mail in your Inbox. So if you have it automatically split into other folders, none of this helps you.
I've started splitting out the ChkMail code into a separate program so I can just trigger the LED arbitrarily. When I get it working I'll post the source code, maybe you can customize it to do what you want. -
Thanks for that. I guess I should learn how to code, huh?
------------------------W1N - 1.7GHz - 1024MB -
Yeah, that would be a good idea.
Here's the code I have to toggle the Mail LED on and off.
<pre>
#include <windows.h>
#include <shlobj.h>
#define MLED 0x44454c4d
HRESULT WINAPI SHGetUnreadMailCountW(
void *hKeyUser,
void *MailAddress,
void *count,
FILETIME *stamp,
void *Shellcommand,
int doShell);
HANDLE ATKACPIhandle;
int CtrlACPI(int code, int arg, int onoff)
{
long bytes = 0;
long inbuf[5];
struct cmbuf {
short cmds[2];
long cm2;
} cbuf;
long outbuf[192];
int ret;
cbuf.cmds[0] = 0;
cbuf.cmds[1] = 4;
cbuf.cm2 = onoff;
inbuf[0] = 2;
inbuf[1] = code;
inbuf[2] = arg;
inbuf[3] = 8 * arg;
inbuf[4] = (long)&cbuf;
ret = DeviceIoControl(ATKACPIhandle, 0x222404, inbuf, sizeof(inbuf),
outbuf, sizeof(outbuf), &bytes, NULL);
return ret;
}
main()
{
FILETIME stamp = {0};
long old = 0, count;
ATKACPIhandle = CreateFile("\\.\ATKACPI", GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0,
NULL);
if (!ATKACPIhandle) {
MessageBox(NULL,"Can't open ACPI ATK0100","ERROR",MB_ICONERROR);
exit(0);
}
for (;{
SHGetUnreadMailCountW(NULL, NULL, &count, &stamp, NULL, 0);
if ( count != old ) {
old = count;
CtrlACPI(MLED, 1, count == 0);
}
sleep(10000);
}
}
</pre>
I compiled this using gcc under Msys/Mingw. Basically the main loop checks to see if there is any unread mail, toggles the LED if the new unread count is different from the previous count, and then sleeps for 10 seconds before looking again.
It's not great, it looks like Mozilla doesn't set the counter to zero after you've read all your email. It won't set the counter to zero until you exit. So pretty much, as soon as you get new mail, the LED will stay on. Anyway, the important bit of this code is how to set up the parameters to the Asus device driver to tell it to turn the LED on and off, everything else is just frill... -
Ah, duh. Mozilla only updates the UnreadMailCount once every 5 minutes by default. You can set this using the mail.windows_xp_integration.unread_count_interval in your preferences. So, everything works as intended...
-
What do i do with this code? How do i incorporate it into the driver file, or did i get the impression wrong?
-
I've updated the code. Get the zip file from my web page
http://www.highlandsun.com/hyc/chkmail.zip
The source and executable are in there. Delete the Asus Chkmail.exe from your Startup menu and put mine in there instead. Run it once to start it, that's all there is to it.
Note - the Asus program protects itself from being run multiple times. Mine doesn't. So make sure you only run it once on each boot.
-
Great stuff highlandsun.
Now, there's no way to get it to respond to emails delivered elsewhere than the Inbox is there?
------------------------W1N - 1.7GHz - 1024MB -
I don't know exactly. If the filter mechanism you're using in Outlook XP that files your messages can also trigger an external program, you could have it run a program that explicitly turns the LED on. But after that it would always be on, how would you know when there's nothing unread left, to turn it off?
Like I said, I ditched Outlook for Mozilla, and I never upgraded to outlook XP so I don't have any idea what filtering capabilities you have available. -
I have contacted Asus technical help with reference to this problem before I found this site. Hopefully they should reply to me and give me an answer. When they do I shall paste it in this forum.
I have downloaded the chkmail fix from your link and it seems to fix the problem of the LED lighting up when new e-mail arrives. By the way, I am using MS outlook express. It even lights up when MSN warns me of a new message, that is good!
I own an L5000 C laptop and the only problem is that when the chkmail program is run (once), other programs suffer like the WLAN program and the standby mode (by tilting the lid or pressing Fn button with F1). The standby mode won't execute and the WLAN program will not close.
I found out by hitting ctrl alt del keys and ending the chkmail process. Then the laptop would go on standby and would close the WLAN program.
Would you know what seems to be the problem in your code?
Regards -
jlin, when did you download it? I found a bug in my MsgWait call, and posted an updated ZIP yesterday. I was using ALLEVENT when I should have used ALLINPUT, so the program was not responding to shutdown messages. If the file you downloaded doesn't have these datestamps then you need to download it again:
chkmail.c 7/29/2004 4:49pm
chkmail.exe 7/29/2004 4:51pm
-
I downloaded it two days ago. I'll try the new version and reply back to see how it goes.
Regards -
Hi,
I have had some time to test the program and the following is what I have found out.
The applications seems to close as they should. But now I have the mail LED light on all the time when an email has been recieved and read; the LED will not go out.
Regards -
Very likely the mail program hasn't reset the registry variable that holds the unread mail count. It works fine for me with Mozilla, with the up-to-5-minute delay that Mozilla has by default.
-
Where did u get magical numbers like $44454c4d???
Im just trying to rewrite your function in Delphi...
------------------------------------------------------------------->
ATKACPIhandle:cardinal;
const
MLED:integer=$44454c4d;
function AsusLight(onoff:integer):boolean;
type
cmbuf=record
cmds:array[0..1] of smallint;
cm2:integer;
end;
var
hasarg:integer;
bytesWORD;
inbuf:array[0..4] of integer;
outbuf:array[0..191] of integer;
cbuf:cmbuf;
nOverlapped;
begin
hasarg:=1;
bytes:= 0;
cbuf.cmds[0] := 0;
cbuf.cmds[1] := 4;
cbuf.cm2 := onoff;
inbuf[0] := 2;
inbuf[1] := MLED;
inbuf[2] := hasArg;
inbuf[3] := 8 * hasArg;
inbuf[4] := integer(@cbuf);
n:=nil;
result:=DeviceIoControl(ATKACPIhandle, $222404, @inbuf,
sizeof(inbuf),
@outbuf, sizeof(outbuf), bytes, n);
end;
------------------------------------------------------------------->
But this code still not works properly =(
Just errors in type converting i think.... -
Most likely your problem is that in your DeviceIoControl call you should have used "@bytes", not "bytes".
old: Sony PCG-GR300P 1.13GHz PIII-M, 512MB
new: Asus M6Ne 2.00GHz P-M, 2GB -
If you were an experienced programmer you'd know without a second thought.
hex 44454c4d is 'DELM' in ASCII. Since the Intel is a little-endian machine, this shows up in memory as 'MLED' if you do a memory dump.
"MLED" stands for Mail LED.
old: Sony PCG-GR300P 1.13GHz PIII-M, 512MB
new: Asus M6Ne 2.00GHz P-M, 2GB -
just "bytes" is ok, because it is var parameter.
-
hi.. this may seem a little stupid but i was just wondering what the generic chkmail.. i just got my laptop and it is just there and i never use it.. is it a part of outlook or soemthing?
~.~ In need of a notebook -
Hi
I've a question: From where can i get the addresses of the other LEDs, e.g. the CD-LED ? Or does anyone here know the address of the CD-LED ?
-
Hi, I've been wondering for ages how to control the email led on my asus notebook (L3800S). Thanx for ur sw highlandsun, works like a charm (except with Mozilla Thunderbird, but that's their problem, works fine in plain Mozilla).
My question is: how did u obtain the information needed to create ur program (to access the ASUS ATKACPI driver)? From asus? -
Funny you should ask, Borg. I used a program called Borg...
old: Sony PCG-GR300P 1.13GHz PIII-M, 512MB
new: Asus M6Ne 2.00GHz P-M, 2GB -
Ur joking right? [
] If not, what a coincidence.
Btw, I have an old compiler, with a shell32.lib that doesn't have SHGetUnreadMailCountW, so I changed ur code to call SHGetUnreadMailCountW through a pointer. My version is here.Last edited by a moderator: Feb 2, 2015 -
thx for your nice program!
one more problem solved on my m6800n
by the way:
do you think it is possible to write a program for configuring the special keys?
i was searching for long time for a tool which allows this but found nothing.
(8)ball -
No joke, you can download it here http://www.caesum.com/download.php
re: the hotkeys - I don't know of any program for that yet, tho I suspect that people are working on it. If I had more time I'd work on it myself, but it really isn't a critical issue to me. I've never used hotkeys on any of my other computers, not going to start now...
old: Sony PCG-GR300P 1.13GHz PIII-M, 512MB
new: Asus M6Ne 2.00GHz P-M, 2GB -
Did any body ever get around to solving the Thunderbird and the asus chkmail issue? I use thunderbird and obviously the email led doesn't work.
<blockquote id='quote'> quote:<hr height='1' noshade id='quote'>Originally posted by Borg
Last edited by a moderator: May 8, 2015 -
<blockquote id='quote'> quote:<hr height='1' noshade id='quote'>Originally posted by Borg
Last edited by a moderator: May 8, 2015 -
If u use highlandsun's version of ChkMail, the email LED will work to some extent, but not correctly. It's a bug in Thunderbird (look here). Im fixing it as we speak. I'll post here when I'm done, but u will have to wait 4 a while to see the fix appear in the mainstream Thunderbird release.
Last edited by a moderator: Feb 2, 2015 -
Thanks for the reply.
I suspected Thunderbird was not updating the windows registry and yeah the light works with mozilla using highlandsums chkmail. Look forward to your future posts. -
Hey Borg, since you're looking into this code now, I posted a couple comments on Bugzilla, y'think you can fix those issues too?
old: Sony PCG-GR300P 1.13GHz PIII-M, 512MB
new: Asus M6Ne 2.00GHz P-M, 2GB -
<blockquote id='quote'> quote:<hr height='1' noshade id='quote'>
I've started splitting out the ChkMail code into a separate program so I can just trigger the LED arbitrarily. When I get it working I'll post the source code, maybe you can customize it to do what you want.
<hr height='1' noshade id='quote'></font id='quote'></blockquote id='quote'>
Excuse me, i've a program to check mail that not notify email changing the mail counter of registry. I need a program to turn led on to execute everytime a new mail arrives. I've read your qoute, but i'dont manage to understand well the code and to compile it. Could you make this for me, i pray you!!! How i've already sad, i need only an exe that switch on my led!
Thank for all, any decision you take.
InnuendoLast edited by a moderator: May 8, 2015 -
My LED now works the way I want with Thunderbird. I threw out the timer, and the LED now responds in real time (the way it should have been in the first place). I'll test for a day or two, then I'll post my fix on bugzilla.org. If they deem my fix worthy, it'll appear in the next mainstream Thunderbird release, and I will submit it to Mozilla as well.
Question: what is the desired functionality of the LED? Should it reflect NEW mail? Or UNREAD mail (which might be old, but marked as unread)? I would think that the LED should reflect unread mail, and biff (the tray notification icon & maybe sound) should take care of new mail.
@highlandsun: I read your comments and did some research, I'm pretty sure I can fix that as well. It'll take time though, I'm quite busy these days (and the whole WinIntegration module needs work, the biff stuff isn't working properly either in Thunderbird, is it in Mozilla?)
@innuendo: Does your email program have an option to also run a program whenever an email is marked 'read' (to switch the LED back off)? Otherwise your email LED will stay on forever. -
Borg - good question. Personally I would prefer that the LED only reflects NEW mail. After I know that it's there (e.g., manually marked unread), I don't need a reminder.
old: Sony PCG-GR300P 1.13GHz PIII-M, 512MB
new: Asus M6Ne 2.00GHz P-M, 2GB -
Ok, thx, that sounds logical, the LED should do the same as biff. Does biff function correctly in Mozilla?
-
Wow, looks like your making some progress on this. Well done - just think of all the Asus laptop owners out there who will innevitably benefit from this patch for thunderbird.
P.S Should reflect new mail untill read, similar to that horrible microsoft product OE -
[/quote]
@innuendo: Does your email program have an option to also run a program whenever an email is marked 'read' (to switch the LED back off)? Otherwise your email LED will stay on forever.
[/quote]
no, but after that it notify to me a new mail i used to open outlook and so when i read a mail the led should be switch off, isn't it?
Innuendo -
<blockquote id='quote'> quote:<hr height='1' noshade id='quote'>Originally posted by Borg
@innuendo: here's your program. Just run it to turn the LED on. Run it with an argument of 0 (zero) to turn it off again (if desired).
<hr height='1' noshade id='quote'></font id='quote'></blockquote id='quote'>
Thank's a lot!!! you have solved all my problems. Just one question? Where i can find the right compiler to make this exe? just to learn by myself.
Thanks,
InnuendoLast edited by a moderator: May 8, 2015 -
Not only the ASUS laptop owners, but all XP users that use the 'quick switch user' feature. They will see a line below the username indicating how many unread emails they have.
@innuendo: here's your program. Just run it to turn the LED on. Run it with an argument of 0 (zero) to turn it off again (if desired).Last edited by a moderator: Feb 2, 2015 -
The Micro$oft and Borland compilers cost money. For a free alternative you might try www.mingw.org.
Last edited by a moderator: Feb 2, 2015 -
Hello all!
First of all, thanx for this program. Actually, not for the program but for the ideea.
Vitiy:
The problem with the delphi conversion is that you don't open driver.
You just have to trow
Code:ATKACPIhandle:=CreateFile('\.ATKACPI', GENERIC_WRITE, FILE_SHARE_WRITE, NIL, OPEN_EXISTING, 0, 0);
Right now i'm tring to do a delphi program to blink your wireless led as long as a certain hosts responds to ping... Usefull when playing games -
Err... sorry for formatting, my first post... used with ubb/ipb/vbulletin.
-
Hey, I came across this forum accidentally while doing a little digging around about the Asus W1N, great forum
In any case, I have a question about this chkMail app... How long does the light stay on for before turning off?
I'm asking because I use Outlook 2003, and the asus chkmail never seemed to work for me... And when I tried highlandsun's the light just seems to stay on.. I've marked all my messages as read so I would assume that it would turn off.
Ideas?
It'd be cool to have this work -
My chkmail program just acts whenever the registry key changes. The mail program is the one that sets the registry key. So it's up to your Outlook 2003 client.
old: Sony PCG-GR300P 1.13GHz PIII-M, 512MB
new: Asus M6Ne 2.00GHz P-M, 2GB -
bwahaha. Thanks Highlandsun, I did a bit more digging around and found the registry key that was being updated (from borg's post about thunderbird) and now see what's going on. It has my hotmail address in there as well which *does* have unread messages.
I just deleted that key and it works like a charm!
Thanks!!
Now, maybe we could have a config file to ignore certain addresses? -
You have the source code, knock yourself out.
Obviously the name of the registry key is in the source code, since my program has to open that key. You really ought to read that stuff, it's informative even if you're not a programmer...
old: Sony PCG-GR300P 1.13GHz PIII-M, 512MB
new: Asus M6Ne 2.00GHz P-M, 2GB -
You can also manipulate the LEDs on Linux (and use the Fn- and hotkeys, control brightness, and more).
If your kernel is 2.4.22 or better, it's already in there! If you have <nobr><tt>/proc/acpi/asus</tt></nobr>, you can turn the led on with <nobr><tt>echo 1 > /proc/acpi/asus/mled</tt>.</nobr> If you don't have it, try <tt>modprobe asus_acpi</tt> (as root).</nobr> If it's still not there, you need to reconfigure and rebuild the kernel. Under <nobr><tt>Power Management Options</tt></nobr>, turn on <nobr><tt>Power Management Support</tt>,</nobr> <nobr><tt>ACPI Support</tt>,</nobr> and <nobr><tt>ASUS/Medion Laptop Extras</tt>.</nobr>
If your kernel is older (but not older than 2.4.19), go here and compile the module yourself.Last edited by a moderator: Feb 2, 2015 -
Cool, I never knew that. Saves me some effort!
old: Sony PCG-GR300P 1.13GHz PIII-M, 512MB
new: Asus M6Ne 2.00GHz P-M, 2GB -
hi borg,
could you please post your latest windows xp source code (and maybe include with it a compiled exe) for the check mail utility?
thanks a lot.
Asus M3NP 1.5GHz Pentium-M
512mb DDR (Soon to be 1GB)
40gb 5400rpm 8mb Cache Seagate Hard Drive /w 5 Year Warranty
Intel 2200BG 802.11g Wireless
14.1" XGA Screen
Asus Chkmail
Discussion in 'Asus' started by highlandsun, Jul 22, 2004.