Listing Availible Devices

G

gwatts

Hi,
I just did a great deal of searching to figure out that the device
name for the backlight is BKL1: (I've appended code if you want to keep
it on with the power manager). But it occurs to me that the backlight
device name is arbitrary. I'm just lucky my phone used the same name
(right?). Further, this must hold true for all devices. I'm curious.
How do I find out the names of all the devices known to my smartphone's
OS?

Cheers,
Gordon.

P.S. Code showing how to turn it on/off can be found
here:http://www.peterfoot.net/KeepYourSmartphoneBacklightOn.aspx (in
VB), Or in C# the code I ended up writing:

[DllImport("coredll.dll")]
static extern bool PowerPolicyNotify(
UInt32 dwMessage,
UInt32 dwData
);

[DllImport("coredll.dll", SetLastError = true,
CharSet=CharSet.Unicode)]
static extern IntPtr SetPowerRequirement(
string device_name,
CEDEVICE_POWER_STATE DeviceState,
UInt32 DeviceFlags,
string pvSystemState,
UInt32 StateFlags);

enum CEDEVICE_POWER_STATE : int
{
PwrDeviceUnspecified = -1,
D0 = 0, // Full on
D1, // Low power on, fully functional at low
D2, // Standby: partially owered with automatic wake
D3, // Sleep: partially powered with device initaited wake
D4, // Off: Unpowered.
PwrDeviceMaximum
}

public const int POWER_NAME = 0x00000001;


Code:
private IntPtr _power_hold;

On:
_power_hold = SetPowerRequirement("BKL1:",
CEDEVICE_POWER_STATE.D0,
POWER_NAME, null, 0);
Off: (should do error checking!)
ReleasePowerRequirement(_power_hold);
 
G

gwatts

Hi,
Thanks! What is a decent registry editor? I didn't see one in the
stuff that cae in the SDK (or I just missed it).

Cheers,
Gordon.

It's in the registry under HKLM\Drivers\Active

-Chris


Hi,
I just did a great deal of searching to figure out that the device
name for the backlight is BKL1: (I've appended code if you want to keep
it on with the power manager). But it occurs to me that the backlight
device name is arbitrary. I'm just lucky my phone used the same name
(right?). Further, this must hold true for all devices. I'm curious.
How do I find out the names of all the devices known to my smartphone's
OS?

Cheers,
Gordon.

P.S. Code showing how to turn it on/off can be found
here:http://www.peterfoot.net/KeepYourSmartphoneBacklightOn.aspx (in
VB), Or in C# the code I ended up writing:

[DllImport("coredll.dll")]
static extern bool PowerPolicyNotify(
UInt32 dwMessage,
UInt32 dwData
);

[DllImport("coredll.dll", SetLastError = true,
CharSet=CharSet.Unicode)]
static extern IntPtr SetPowerRequirement(
string device_name,
CEDEVICE_POWER_STATE DeviceState,
UInt32 DeviceFlags,
string pvSystemState,
UInt32 StateFlags);

enum CEDEVICE_POWER_STATE : int
{
PwrDeviceUnspecified = -1,
D0 = 0, // Full on
D1, // Low power on, fully functional at low
D2, // Standby: partially owered with automatic wake
D3, // Sleep: partially powered with device initaited wake
D4, // Off: Unpowered.
PwrDeviceMaximum
}

public const int POWER_NAME = 0x00000001;


Code:
private IntPtr _power_hold;

On:
_power_hold = SetPowerRequirement("BKL1:",
CEDEVICE_POWER_STATE.D0,
POWER_NAME, null, 0);
Off: (should do error checking!)
ReleasePowerRequirement(_power_hold);
 
G

Guest

Use the Remote Registry Editor tool (off your Start Menu under Studio 05);


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--


Hi,
Thanks! What is a decent registry editor? I didn't see one in the
stuff that cae in the SDK (or I just missed it).

Cheers,
Gordon.

It's in the registry under HKLM\Drivers\Active

-Chris


Hi,
I just did a great deal of searching to figure out that the device
name for the backlight is BKL1: (I've appended code if you want to keep
it on with the power manager). But it occurs to me that the backlight
device name is arbitrary. I'm just lucky my phone used the same name
(right?). Further, this must hold true for all devices. I'm curious.
How do I find out the names of all the devices known to my smartphone's
OS?

Cheers,
Gordon.

P.S. Code showing how to turn it on/off can be found
here:http://www.peterfoot.net/KeepYourSmartphoneBacklightOn.aspx (in
VB), Or in C# the code I ended up writing:

[DllImport("coredll.dll")]
static extern bool PowerPolicyNotify(
UInt32 dwMessage,
UInt32 dwData
);

[DllImport("coredll.dll", SetLastError = true,
CharSet=CharSet.Unicode)]
static extern IntPtr SetPowerRequirement(
string device_name,
CEDEVICE_POWER_STATE DeviceState,
UInt32 DeviceFlags,
string pvSystemState,
UInt32 StateFlags);

enum CEDEVICE_POWER_STATE : int
{
PwrDeviceUnspecified = -1,
D0 = 0, // Full on
D1, // Low power on, fully functional at low
D2, // Standby: partially owered with automatic wake
D3, // Sleep: partially powered with device initaited wake
D4, // Off: Unpowered.
PwrDeviceMaximum
}

public const int POWER_NAME = 0x00000001;


Code:
private IntPtr _power_hold;

On:
_power_hold = SetPowerRequirement("BKL1:",
CEDEVICE_POWER_STATE.D0,
POWER_NAME, null, 0);
Off: (should do error checking!)
ReleasePowerRequirement(_power_hold);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top