Building obex-method

  • Post author:
  • Post category:Uncategorized

I published a Bazaar branch of the Nautilus obex method here:

http://bazaar.launchpad.net/~jamesh/+junk/gnome-vfs-obexftp

This version works with the hcid daemon included with Ubuntu Edgy, rather than requiring the btcond daemon from Maemo.

Some simple instructions on building it:

  1. Download and build the osso-gwobex library:

    svn checkout https://stage.maemo.org/svn/maemo/projects/connectivity/osso-gwobex/trunk osso-gwobex

    The debian/ directory should work fine to build a package using debuild.

  2. Download and build the obex module:

    bzr branch http://bazaar.launchpad.net/~jamesh/+junk/gnome-vfs-obexftp

    There is no debian packaging for this — just an autogen.sh script.

It should work on other distributions, but I haven’t tried it. The main requirement is bluez-utils 3.7, and that -x is passed to hcid to enable the org.bluez.RFCOMM interface.

Still to do is cleaning up the obex:/// listing of bonded devices, so that it serves desktop entries rather than symlinks, so that it is usable in Nautilus. This would also make it easier to show the device names to the user and get nice icons.

Playing Around With the Bluez D-BUS Interface

  • Post author:
  • Post category:Uncategorized

In my previous entry about using the Maemo obex-module on the desktop, Johan Hedberg mentioned that bluez-utils 3.7 included equivalent interfaces to the osso-gwconnect daemon used by the method. Since then, the copy of bluez-utils in Edgy has been updated to 3.7, and the necessary interfaces are enabled in hcid by default.

Before trying to modify the VFS code, I thought I’d experiment a bit with the D-BUS interfaces via the D-BUS python bindings. Most of the interesting method calls exist on the org.bluez.Adapter interface. We can easily get the default adapter with the following code:

import dbus

bus = dbus.SystemBus()
manager = dbus.Interface(
    bus.get_object('org.bluez', '/org/bluez'),
    'org.bluez.Manager')

adapter = dbus.Interface(
    bus.get_object('org.bluez', manager.DefaultAdapter()),
    'org.bluez.Adapter')

At this point, it is possible to perform discovery:

import dbus.glib
import gtk

def remote_device_found(addr, class_, rssi):
    print 'Found:', addr
def discovery_complete():
    gtk.main_quit()

adapter.connect_to_signal('RemoteDeviceFound', remote_device_found)
adapter.connect_to_signal('DiscoveryCompleted', discovery_completed)

adapter.DiscoverDevices()
gtk.main()

It is also possible to configure periodic discovery, which will send signals about devices that get found, disappear, or change name, so we could easily implement the obex: directory listing that shows all the devices found that support OBEX-FTP. One thing that isn’t clear from the API documentation is what happens if multiple programs try to start or stop discovery at the same time. It looks like the second program will get a org.bluez.Error.InProgress error when it tries to begin discovery. Ideally discovery would stay active til the last program interested in the results closed. Maybe I am misunderstanding it a bit and you can actually use the interface in this mode.

When we want to actually do OBEX-FTP with the device, we can establish the rfcomm connection:

rfcomm = dbus.Interface(
    bus.get_object('org.bluez', manager.DefaultAdapter()),
    'org.bluez.RFCOMM')

# will return e.g. /dev/rfcomm0
devname = rfcomm.Connect(bluetooth_address, 'ftp')

# communicate with the phone via the new rfcomm device

rfcomm.Disconnect(devname)

So it should be possible to modify obex-method to function with only the daemons included in Ubuntu Edgy. All that’s left is to do the actual work 🙂.

OBEX in Nautilus

  • Post author:
  • Post category:Uncategorized

When I got my new laptop, one of the features it had that my previous one didn’t was Bluetooth support. There are a few Bluetooth related utilities for Gnome that let you send and receive SMS messages and a few other things, but a big missing feature is the ability to transfer files to and from the phone easily.

Ideally, I’d be able to browse the phone’s file system using Nautilus. Luckily, the Maemo guys have already done the hard work of writing a gnome-vfs module that speaks the OBEX FTP protocol. I had a go at compiling it on my laptop (running Ubuntu Edgy), and you can see the result below:


Browsing files and viewing images stored on my phone

There are a few rough edges:

  • While I can get a list of discovered devices at the location obex:///, it displays the raw bluetooth addresses rather than device names. Furthermore, the files displayed here are symlinks to the appropriate obex://[$ADDRESS]/ URLs, which aren’t that useful given that gnome-vfs does not support symlinks pointing to other schemes or authorities. This could be fixed by generating .desktop files instead, which would make it possible to provide nice icons too.
  • Can’t rename files. This might be a limitation of the OBEX FTP protocol though: the man page for the command line obexftp client says moves only work with Siemens phones.
  • Doesn’t seem to handle devices disappearing very well — when I tried turning off Bluetooth on my phone and told Nautilus to reload the window, Nautilus hung and stopped redrawing til I turned Bluetooth on again.

I don’t have any ready made binaries for others to try at this point. Below are some notes for anyone else who wants to try building it:

  • You’ll need the osso-gwconnect, osso-gwobex and osso-gnomevfs-extra modules. I grabbed them from Maemo Subversion.
  • When trying to build a debian package for osso-gwconnect, I removed the libosso-dev and mce-dev build dependencies, and made an equivalent change to the configure arguments in debian/rules. The configure script also asks for BlueZ 3.2, while Edgy only has 3.1. The package built fine when I decreased the minimum version requirement.
  • You’ll need to build osso-gwconnect and osso-gwobex before osso-gnomevfs-extra. There are a few build problems with this last module:
    1. The autogen.sh script asks for automake 1.8.x specifically, but works fine with the current 1.9.x releases.
    2. I had to change a dbus_connection_disconnect() call to dbus_connection_close() in obex-module/src/om-dbus.c.
    3. You only need to build the obex-utils and obex-module directories. There are other bits in this module that you probably don’t want, and some bits like the replacement GTK filesystem backend didn’t build for me.

With a little bit of work, this would fit into the main Gnome desktop quite well. When talking to Bastien a while back, he said that the extra dbus daemons shouldn’t really be necessary, so it might be worth trying to bypass them.

Gnome-gpg 0.5.0 Released

Over the weekend, I released gnome-gpg 0.5.0. The main features in this release is support for running without gnome-keyring-daemon (of course, you can’t save the passphrase in this mode), and to use the same keyring item name for the passphrase as Seahorse. The release can be downloaded here:

http://download.gnome.org/sources/gnome-gpg/0.5/

I also switched over from Arch to Bazaar. The conversion was fairly painless using bzr baz-import-branch, and means that I have both my revisions and Colins revisions in a single tree. The branch can be pulled from:

bzr branch http://www.gnome.org/~jamesh/bzr/gnome-gpg/devel gnome-gpg

All of the converted revisions authored by me have been signed with my PGP key. As signatures can’t get moved over in the conversion process, none of Colin’s revisions are signed. Note that the signatures in Bazaar are for particular tree states rather than changes between two tree states, so it doesn’t affect the trust of the current revisions.

While I was at it, I also converted the other branches I had in my www.gnome.org Arch archive over to bzr. The only other branch that people might find useful is the http-resource code, which I’ve updated to compile with the latest libsoup.

Vote Counting and Board Expansion

  • Post author:
  • Post category:Uncategorized

Recently one of the Gnome Foundation directors quit, and there has been a proposal to expand the board by 2 members. In both cases, the proposed new members have been taken from the list of candidates who did not get seats in the last election from highest vote getter down.

While at first this sounds sensible, the voting system we use doesn’t provide a way of finding out who would have been selected for the board if a particular candidate was removed from the ballot.

The current voting system gives each foundation member N votes to assign to N candidates (where N is the number of seats on the board). The votes are then tallied for each candidate, and the N candidates with the most votes get the seats.

If we look at last year’s results, there were 119 people who voted for Luis. If Luis had not been a candidate, then those 119 people would have used that vote to pick other candidates. The difference in the number of votes received by Vincent (the board member receiving the least votes) and Quim (the unsuccessful candidate with the most votes) was just 16, so those extra 119 votes could easily have affected the ordering of the remaining candidates.

Furthermore, if the election was for nine seats rather than seven then each foundation member would have had an additional two votes to cast.

This particular problem would not be an issue with a preferential voting system where each foundation member lists all the candidates in their order of preference. If a board member drops out, it is trivial to recalculate the results with that candidate removed: the relative orderings of the other candidates on the ballot are preserved. It is also possible to calculate the results for a larger number of seats.

Of course, all the candidates from the last election would make great board members so it isn’t so much of an issue in this case, but it might be worth considering for next time.