When hal properties are updated

I call GetProperty on org.freedesktop.Hal.Device from my handler during the PropertyNotified signal. I only call GetProperty by properties that have been added or changed.

When I call GetProperty while adding properties, I get an org.freedesktop.Hal.NoSuchProperty exception. I am also concerned that during the changes I get the old values.

When do I need to call GetProperty? What race conditions are involved?

+4
source share
1 answer

How about the DeviceExists method (like here ):

if device.PropertyExists('info.product'): return device.GetProperty('info.product') return "unknown" 

And the PropertyModified signal, ( ex from the real world ):

  # # _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
source

Source: https://habr.com/ru/post/1276732/


All Articles