all groups > dotnet compact framework > september 2005 >
You're in the

dotnet compact framework

group:

setDevicePower(), getDevicePower()



setDevicePower(), getDevicePower() Minh
9/14/2005 6:16:02 PM
dotnet compact framework: When I called setDevicePower, the function executed fine and returned 2,
implying successul (perhaps). But the device won't turn on or off. So I
called getDevicePower(), then the program throw an InvalidProgramException.
name doesn't mean anything Minh
9/14/2005 6:55:02 PM
setDevicePower(string name, ..,..)
i changed the name to some non-existent string, but it still executes fine
and returns 2. Looked at the registry and nothing changed of course.

Re: setDevicePower(), getDevicePower() Alex Feinman [MVP]
9/14/2005 7:04:27 PM
Perhaps not. Error 2 (can be looked up in WinError.h) means
ERROR_FILE_NOT_FOUND, i.e. the device you specified was not found.
What parameter did you specify as pvDevice? Did you remember to use 1
(POWER_NAME) as the second parameter?

[quoted text, click to view]
Hmm... wrong name? Minh
9/14/2005 7:17:03 PM
I tried each of these calls but none of them worked:
SetDevicePower("NDS1:", POWER_NAME, DevicePowerState.D4);
SetDevicePower("NDS1", POWER_NAME, DevicePowerState.D4);
SetDevicePower("TIACXWLN:", POWER_NAME, DevicePowerState.D4);
SetDevicePower("TIACXWLN", POWER_NAME, DevicePowerState.D4);
SetDevicePower("TIACXWLN1:", POWER_NAME, DevicePowerState.D4);
SetDevicePower("TIACXWLN1", POWER_NAME, DevicePowerState.D4);

and yes POWER_NAME is 0x00000001 (1).

This is a copy of my PPC's registry: http://67.160.9.251/Pub/Enabled.reg.txt
Could you take a look and see if i got the right name (or what it is ;P)
from there? Thanks Alex

Re: Hmm... wrong name? Alex Feinman [MVP]
9/14/2005 10:38:04 PM
According to this post you need the NDIS power driver (NPW):
http://groups.google.com/group/microsoft.public.windowsce.embedded.vc/browse_thread/thread/35003914c563de6b/232159729bb261fc?lnk=st&q=SetDevicePower&rnum=6&hl=en#232159729bb261fc

Unfortuantely I do not have a device with WiFi card around, so I can't test

[quoted text, click to view]
Re: Hmm... wrong name? Minh
9/15/2005 10:30:01 AM
I have found the complete/correct solution. So simple yet it took me days to
find: DevicePowerNotify() must be called prior to SetDevicePower() for it to
work:
int e1 =
DevicePowerNotify("{98C5250D-C29A-4985-AE5F-AFE5367E5006}\\TIACXWLN1",DevicePowerState.D4, POWER_NAME);
int e2 = SetDevicePower("{98C5250D-C29A-4985-AE5F-AFE5367E5006}\\TIACXWLN1",
POWER_NAME, DevicePowerState.D4);

Both e1 and e2 should return 0's. Thanks Alex, without you pointing out 2
is failure, I would have banged my head on the finding-the-right-name wall
Re: Hmm... wrong name? Michael H
9/15/2005 10:36:29 AM
On Wed, 14 Sep 2005 19:17:03 -0700, "Minh"
[quoted text, click to view]

--> I tried each of these calls but none of them worked:
--> SetDevicePower("NDS1:", POWER_NAME, DevicePowerState.D4);
--> SetDevicePower("NDS1", POWER_NAME, DevicePowerState.D4);
--> SetDevicePower("TIACXWLN:", POWER_NAME, DevicePowerState.D4);
--> SetDevicePower("TIACXWLN", POWER_NAME, DevicePowerState.D4);
--> SetDevicePower("TIACXWLN1:", POWER_NAME, DevicePowerState.D4);
--> SetDevicePower("TIACXWLN1", POWER_NAME, DevicePowerState.D4);
-->
--> and yes POWER_NAME is 0x00000001 (1).
-->
--> This is a copy of my PPC's registry:
http://67.160.9.251/Pub/Enabled.reg.txt
--> Could you take a look and see if i got the right name (or what it
is ;P)
--> from there? Thanks Alex
-->
--> Minh


Any luck, Captain Minh?
Say "hi" to the crew :)

AddThis Social Bookmark Button