Opened 6 years ago

Closed 5 years ago

#251 closed defect (fixed)

ogpsd's Start fails with: Known resources are []

Reported by: Sascha Owned by: daniel
Priority: minor Milestone:
Component: framework/ogpsd Version: milestone4
Keywords: Cc:


...because ogpsd starts before ousaged:

* NameOwnerChanged: org.freesmartphone.ogpsd
Start() returns error: Known resources are []
* NameOwnerChanged: org.freesmartphone.ousaged
Start() returns no error, but gps device is not powered on

Change History (7)

comment:1 Changed 6 years ago by jluebbe

  • Status changed from new to assigned

comment:2 Changed 6 years ago by daniel

Could you be more verbose in describing this problem?

comment:3 Changed 6 years ago by Sascha

The Start and Stop methods of the GPSDevice class need to
handle ousaged's errors properly.

The following patch works for my concrete example:

diff --git a/framework/subsystems/ogpsd/ b/framework/subsystems/ogpsd/
index d4ff1f6..05e7e3a 100644
--- a/framework/subsystems/ogpsd/
+++ b/framework/subsystems/ogpsd/
@@ -215,7 +215,10 @@ class GPSDevice( resource.Resource ):
                 if not self.usageiface:
                     usage = self.bus.get_object( "org.freesmartphone.ousaged", "/org/freesmartphone/Usage", follow_name_owner_changes=True )
                     self.usageiface = dbus.Interface( usage, "org.freesmartphone.Usage" )
-                self.usageiface.RequestResource("GPS", reply_handler=dbus_ok, error_handler=dbus_error )
+                def on_error( error ):
+                    self._users.remove( sender )
+                    dbus_error( dbus.DBusException("RequestResource failed") )
+                self.usageiface.RequestResource("GPS", reply_handler=dbus_ok, error_handler=on_error)

This still requires that all Start and Stop calls/replies/errors are
in the expected order, which is not always the case!

A proper fix would be to serialize all Start and Stop calls/replies/errors.

comment:4 Changed 6 years ago by daniel

  • Milestone set to milestone5.5

comment:5 Changed 6 years ago by daniel

  • Milestone milestone5.5 deleted

This needs some more thinking about how to handle resource appearance properly.

comment:6 Changed 6 years ago by daniel

I have applied the patch now since it already helps in returning a better Error message and removing the sender from the list again.

comment:7 Changed 5 years ago by stefan

  • Resolution set to fixed
  • Status changed from assigned to closed

Patch was applied let's also close this bug.

Note: See TracTickets for help on using tickets.