PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Compact Framework Listing Availible Devices

Reply

Listing Availible Devices

 
Thread Tools Rate Thread
Old 13-09-2006, 04:30 AM   #1
gwatts@phys.washington.edu
Guest
 
Posts: n/a
Default Listing Availible Devices


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/KeepYourSm...acklightOn.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);

  Reply With Quote
Old 13-09-2006, 01:03 PM   #2
Guest
 
Posts: n/a
Default Re: Listing Availible Devices

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

-Chris


<gwatts@phys.washington.edu> wrote in message
news:1158118203.433940.111820@e3g2000cwe.googlegroups.com...
> 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/KeepYourSm...acklightOn.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);
>



  Reply With Quote
Old 13-09-2006, 09:01 PM   #3
gwatts@phys.washington.edu
Guest
 
Posts: n/a
Default Re: Listing Availible Devices

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.

<ctacke/> wrote:
> It's in the registry under HKLM\Drivers\Active
>
> -Chris
>
>
> <gwatts@phys.washington.edu> wrote in message
> news:1158118203.433940.111820@e3g2000cwe.googlegroups.com...
> > 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/KeepYourSm...acklightOn.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);
> >


  Reply With Quote
Old 13-09-2006, 10:59 PM   #4
Guest
 
Posts: n/a
Default Re: Listing Availible Devices

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
--


<gwatts@phys.washington.edu> wrote in message
news:1158177675.754468.204300@i3g2000cwc.googlegroups.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.
>
> <ctacke/> wrote:
>> It's in the registry under HKLM\Drivers\Active
>>
>> -Chris
>>
>>
>> <gwatts@phys.washington.edu> wrote in message
>> news:1158118203.433940.111820@e3g2000cwe.googlegroups.com...
>> > 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/KeepYourSm...acklightOn.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);
>> >

>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off