4053|5

88

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

求解:wince6.0下电源管理,中父设备和子设备之间的关系? [复制链接]

求解:wince6.0下电源管理,中父设备和子设备之间的关系?

最新回复

我是在看pm电源管理的mdd层代码的时候发现的,pmimpl.h,pmstream.cpp // this structure describes a power-manageable device typedef struct _DeviceState_tag {     LPCTSTR     pszName;                // device's name     CEDEVICE_POWER_STATE    curDx;      // current official power state (not necessarily supported by the device)     CEDEVICE_POWER_STATE    floorDx;    // minimum device power state, or PwrDeviceUnspecified     CEDEVICE_POWER_STATE    ceilingDx;  // maximum device power state, or PwrDeviceUnspecified     CEDEVICE_POWER_STATE    setDx;      // power state if explicitly set, or PwrDeviceUnspecified     CEDEVICE_POWER_STATE    lastReqDx;  // last state requested by the device     CEDEVICE_POWER_STATE    actualDx;   // current actual device power state     CEDEVICE_POWER_STATE    pendingDx;  // Pending DX for updating     DWORD                   dwNumPending; // Number of Pending for updating.     struct _DeviceState_tag *pParent;   // parent device, or NULL    POWER_CAPABILITIES      caps;       // as reported by the device     DWORD       dwRefCount;             // structure can be deallocated when this is 0     HANDLE      hDevice;                // handle to the device from OpenDevice(), or NULL     PDEVICE_INTERFACE       pInterface; // interface to the device class power management routines     struct _DeviceList_tag  *pListHead; // pointer to the containing list     struct _DeviceState_tag *pNext;     // linked list pointers     struct _DeviceState_tag *pPrev; } DEVICE_STATE, *PDEVICE_STATE; static HANDLE OpenStreamDevice(PDEVICE_STATE pds) {     PDEVICE_STATE pdsReal = pds;     SETFNAME(_T("OpenStreamDevice"));     // determine what device to actually open     if(pds->pParent != NULL) {         pdsReal = pds->pParent;     }     // get a handle to the client     HANDLE hRet = CreateFile(pdsReal->pszName, 0,         FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);     if(hRet == INVALID_HANDLE_VALUE) {         PMLOGMSG(ZONE_WARN || ZONE_IOCTL, (_T("%s: OpenFile('%s') failed %d (0x%08x)\r\n"), pszFname,             pdsReal->pszName, GetLastError(), GetLastError()));     }     PMLOGMSG(ZONE_DEVICE || ZONE_IOCTL, (_T("%s: handle to '%s' on behalf of '%s' is 0x%08x\r\n"), \         pszFname, pdsReal->pszName, pds->pszName, hRet));     return hRet; } 打开一个流接口设备的时候,获取的是他的父设备的句柄,我开始我有点奇怪,后来发现,在添加设备的时候,那个parent的参数是NULL的,也就是wince6.0中还没有用到,留着以后用。具体这也都是我的猜测。   详情 回复 发表于 2010-4-1 17:17
点赞 关注

回复
举报

78

帖子

0

TA的资源

一粒金砂(初级)

沙发
 
我先顶一下
 
 

回复

81

帖子

0

TA的资源

一粒金砂(初级)

板凳
 
没接触过父设备和子设备的概念
 
 
 

回复

93

帖子

0

TA的资源

一粒金砂(中级)

4
 
父设备,子设备???你创造的名词?
 
 
 

回复

79

帖子

0

TA的资源

一粒金砂(初级)

5
 
呵呵,原来不只是我一个人不知道这个。

楼主再详细说说你的需求吧。
难道是两个有一定关系的设备,看起来有点像父子,要控制他们的电源管理?
 
 
 

回复

78

帖子

0

TA的资源

一粒金砂(初级)

6
 
我是在看pm电源管理的mdd层代码的时候发现的,pmimpl.h,pmstream.cpp
// this structure describes a power-manageable device
typedef struct _DeviceState_tag {
    LPCTSTR     pszName;                // device's name
    CEDEVICE_POWER_STATE    curDx;      // current official power state (not necessarily supported by the device)
    CEDEVICE_POWER_STATE    floorDx;    // minimum device power state, or PwrDeviceUnspecified
    CEDEVICE_POWER_STATE    ceilingDx;  // maximum device power state, or PwrDeviceUnspecified
    CEDEVICE_POWER_STATE    setDx;      // power state if explicitly set, or PwrDeviceUnspecified
    CEDEVICE_POWER_STATE    lastReqDx;  // last state requested by the device
    CEDEVICE_POWER_STATE    actualDx;   // current actual device power state
    CEDEVICE_POWER_STATE    pendingDx;  // Pending DX for updating
    DWORD                   dwNumPending; // Number of Pending for updating.
    struct _DeviceState_tag *pParent;   // parent device, or NULL    POWER_CAPABILITIES      caps;       // as reported by the device
    DWORD       dwRefCount;             // structure can be deallocated when this is 0
    HANDLE      hDevice;                // handle to the device from OpenDevice(), or NULL
    PDEVICE_INTERFACE       pInterface; // interface to the device class power management routines
    struct _DeviceList_tag  *pListHead; // pointer to the containing list
    struct _DeviceState_tag *pNext;     // linked list pointers
    struct _DeviceState_tag *pPrev;
} DEVICE_STATE, *PDEVICE_STATE;
static HANDLE
OpenStreamDevice(PDEVICE_STATE pds)
{
    PDEVICE_STATE pdsReal = pds;
    SETFNAME(_T("OpenStreamDevice"));

    // determine what device to actually open
    if(pds->pParent != NULL) {
        pdsReal = pds->pParent;
    }

    // get a handle to the client
    HANDLE hRet = CreateFile(pdsReal->pszName, 0,
        FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
    if(hRet == INVALID_HANDLE_VALUE) {
        PMLOGMSG(ZONE_WARN || ZONE_IOCTL, (_T("%s: OpenFile('%s') failed %d (0x%08x)\r\n"), pszFname,
            pdsReal->pszName, GetLastError(), GetLastError()));
    }
    PMLOGMSG(ZONE_DEVICE || ZONE_IOCTL, (_T("%s: handle to '%s' on behalf of '%s' is 0x%08x\r\n"), \
        pszFname, pdsReal->pszName, pds->pszName, hRet));

    return hRet;
}
打开一个流接口设备的时候,获取的是他的父设备的句柄,我开始我有点奇怪,后来发现,在添加设备的时候,那个parent的参数是NULL的,也就是wince6.0中还没有用到,留着以后用。具体这也都是我的猜测。
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/6 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表