On Thu, Aug 13, 2009 at 11:15:31AM +0200, arne anka wrote: > > >> - the fso way of retrieving the resource is discouraged > > > > Hm, no? fsoraw does exactly that: manages access to resources the fso > > way. > > it's not that i know all these fso dbus commands by heart, but > > mdbus -s org.freesmartphone.ousaged /org/freesmartphone/Usage > org.freesmartphone.Usage.SetResourcePolicy WiFi enabled > > which you called "in this particular case harmful", looks pretty much like > the fso way to me. am i wrong?
Yes. :-( You should not use SetResourcePolicy if you can at all avoid it. If an app needs a resource, it should call RequestResource instead. If the app doesn't have FSO support, use fsoraw to request the resource. There is a bit of trickery in using fsoraw with a shell script. You can either make the script call itself with fsoraw except if given a command line option such as --no-fsoraw, or use a here-document. Example of the latter: #!/bin/sh # GPS-TTFF - Find GPS time to first fix using all the important buzz-words # such as D-bus, Gypsy, freedesktop.org and freesmartphone.org. # Destinations and paths are listed in /etc/dbus-1/system.d/*. # Interfaces are "documented" at <URL:http://docs.freesmartphone.org/>. fsoraw -r GPS -- sh <<"__end_of_script" DBUSCALL_='dbus-send --print-reply=undocumented --system --type=method_call --dest=' if [ "--coldstart" = "$1" ]; then rm -f /var/lib/freesmartphone/ogpsd.pickle fi START=$(date +%s) # Where is the first return value from GetPosition documented? while ${DBUSCALL_}org.freedesktop.Gypsy /org/freedesktop/Gypsy org.freedesktop.Gypsy.Position.GetPosition \ | head -n 1 | grep -q -v -F -e 'int32 15' -e 'int32 7'; do sleep 1 done FINISH=$(date +%s) echo "Time to first fix: $((${FINISH} - ${START})) s" ${DBUSCALL_}org.freedesktop.Gypsy /org/freedesktop/Gypsy org.freedesktop.Gypsy.Position.GetPosition __end_of_script Please compare with how it should not be done, by a clueless newbie: https://lists.openmoko.org/pipermail/community/2009-July/050629.html > why is simply requesting the resource like openmoko-panel-plugin does, > sufficient? Requesting the resource tells FSO that an app wants to use the resource. If the policy permits, FSO will arrange for the resource to be available. > which is the rationale for fsoraw here? To request resources for apps that don't have FSO support themselves. > why using fsoraw, why isn't fso sufficient? You are confused. Fsoraw uses FSO. -- Rask Ingemann Lambertsen Danish law requires addresses in e-mail to be logged and stored for a year _______________________________________________ Openmoko community mailing list community@lists.openmoko.org http://lists.openmoko.org/mailman/listinfo/community