首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >hal属性何时更新

hal属性何时更新
EN

Stack Overflow用户
提问于 2008-09-16 06:15:12
回答 1查看 468关注 0票数 4

在PropertyNotified信号期间,我从我的处理程序调用org.freedesktop.Hal.Device上的GetProperty。我只在已添加或更改的属性上调用GetProperty。

当我在属性添加过程中调用GetProperty时,我得到了一个org.freedesktop.Hal.NoSuchProperty异常。我还担心,在改变的过程中,我会得到旧的价值观。

我应该在什么时候给GetProperty打电话?涉及哪些竞态条件?

EN

回答 1

Stack Overflow用户

发布于 2009-03-03 10:54:32

DeviceExists方法(如here)怎么样:

代码语言:javascript
复制
    if device.PropertyExists('info.product'):
        return device.GetProperty('info.product')
    return "unknown"

和PropertyModified信号,(ex from real world

代码语言:javascript
复制
 #
 # _CBHalDeviceConnected
 #
 # INTERNAL
 #
 # Callback triggered when a device is connected through Hal.
 #

 def _CBHalDeviceConnected(self, obj_path): 
...
 self.device.connect_to_signal("PropertyModified", 
   self._CBHalDeviceAuthStateChanged) 
...

#
# _CBHalDeviceAuthStateChanged
#
# INTERNAL
#
# Callback triggered when a Hal device property is changed, 
# for checking authorization state changes
#

def _CBHalDeviceAuthStateChanged(self,num_changes,properties):
 for property in properties:
 property_name, added, removed = property
 if property_name == "pda.pocketpc.password":
 self.logger.info("_CBHalDeviceAuthStateChanged: 
     device authorization state changed: reauthorizing")
 self._ProcessAuth() 

HAL 0.5.10 Specification

D-Bus Specification

D-Bus Tutorial

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69744

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档