Friday, March 4, 2011

OpenSync Installation Protocol

So absent my current problems with Bluetooth, hopefully soon to be cured with OpenSuSE 11.4, here is the installation protocol I have gleaned from all the multitudinous sources. Again, I'll make it pretty tomorrow:

=============================================
1. Start clean. Nuke all opensync files and directories then download and install:
    - libsyncml
    - libsyncml-tools
    - libopensync
    - libopensync-pluginxxx 

     where xxx is one of the following:
        -evolution2
        --file
        -gnokii
        -kdepim
        -syncml
        -python-module
    - libopensync-tools


libopensync-plugin-kdepim is problematic as it no longer seems to exist.
The multisync-gui is nothing more than a text editor for the two configuration files.

2. Check to see if everything went right:
    msynctool --listplugins
    Result:
    Available plugins:
    syncml-obex-client
    evo2-sync
    gnokii-sync
    file-sync

We did not get syncml-http-server but it is there, check by running
    syncml-http-server

3. Set up the phone to sync. My N8 uses
    Settings
        > Connectivity
            > USB > Nokia Ovi Suite
            > Data Transfer
                > Sync
                    x Contacts
                    x Calendar
                    x Notes
                    x Bookmarks


All the following are done as user, not root:

4. Create a directory to store your files:
    mkdir ~/files_from_nokia

5. Add groups:
    a. Add a group to sync your Nokia to Evolution as user:
        msynctool --addgroup nokia2evo
    b. Add a group to sync your Nokia to files as user:
        msynctool --addgroup nokia2file

6. Add members to each group:
    a. Add members to the Evolution group
        msynctool --addmember nokia2evo evo2-sync
        msynctool --addmember nokia2evo syncml-obex-client

    b. Add members to the File group
        msynctool --addmember nokia2file file-sync
        msynctool --addmember nokia2file syncml-obex-client


7. Detect your phone over bluetooth:
    hcitool scan    This returns
        Scanning ...
                E0:A6:70:FE:9B:DC       Andy's N8
    http://osdir.com/ml/misc.opensync.user/2006-11/msg00006.html   
    A easy way to check/create your bluetooth pairing is (as root):

All the following are done as root, not user:
        hcitool cc E0:A6:70:FE:9B:DC
                Runs fine

        hcitool auth E0:A6:70:FE:9B:DC
            Not connected

             So we connect with the p1630 Bluetooth manager. Now: same answer, although the manager says we're connected.
        hcitool dc E0:A6:70:FE:9B:DC
            Not connected


        sdptool browse E0:A6:70:FE:9B:DC
            This returns the long list of services even with USB cable removed. So we are clearly connected, despite what hcitool auth says. So there is a problem with Bluetooth in general, as investigated and reported in my previous report.

8. Get all services available on this phone:
    sdptool browse E0:A6:70:FE:9B:DC | less
     This returns a very long list (253 lines in my case) of services, listed in the sub-tab Services.
    The |less pipe lets you scroll up and down the list using up and down arrows.

9. Find the USB services offered by the phone. Plug in the USB cable  and do
    syncml-obex-client -u
    If you don't plug in the cable you will get
        Found 0 USB OBEX interfaces
    With the USB cable connected you will get
    Found 4 USB OBEX interfaces
    Interface 0:
            Manufacturer: Nokia
            Product: N8-00
            Interface description: SYNCML-SYNC
    Interface 1:
            Manufacturer: Nokia
            Product: N8-00
            Interface description: PC Suite Services
    Interface 2:
            Manufacturer: Nokia
            Product: N8-00
            Interface description: SYNCML-DM
    Interface 3:
            Manufacturer: Nokia
            Product: N8-00
            Interface description: Haptics Bridge
    Use '-u interface_number' to connect


All the following are done as user, not root:
10. Configure clients:
    a. Evolution clients:
        i. Configure client 1 evo2-sync:
             msynctool --configure nokia2evo 1
             This creates the configuration file and opens it in vi. For this member much needs to be done, and done so much more easily in kate or some other GUI text editor so just quit:
      :q[Enter]

        ii. Configure client 2 syncml-obex-client:
             msynctool --configure nokia2evo 2
             Again, this creates the configuration file and opens it in vi. For this member much needs to be done, and done so much more easily in kate or some other GUI text editor so just quit
:q[Enter]

    b. File clients:
        i. Configure client 1 file-sync:
             msynctool --configure nokia2file 1
            This creates the configuration file and opens it in vi. For this member much needs to be done, and done so much more easily in kate or some other GUI text editor so just quit
      :q[Enter]

        ii. Configure client 2 syncml-obex-client:
             msynctool --configure nokia2file 2
            Again, this creates the configuration file and opens it in vi. For this member much needs to be done, and done so much more easily in kate or some other GUI text editor so just quit
     :q[Enter]
   
10. Refine client configurations. Open the file in your favorite editor. The file to open is:
        /home/$user/.opensync/groupm/n/syncmember.conf
      where
            $user is your user name (e.g., andy)
             m is the group number:
                1    Evolution group
                2    File group
            n is the member number:
                1    set number (evo, file)
                2    obex-client

    a. Refine configuration for nokia2evo evo-sync:
        kate /home/andy/.opensync/group1/1/evo2-sync.conf
        This file needs the explicit path to the evolution databases. Replace:
              default
         with (note to delete the trailing slash)
              ~/.evolution/addressbook/local/system
              ~/.evolution/calendar/local/system
              /~/.evolution/tasks/local/system   


    b. Refine configuration for nokia2evo file-sync
        kate /home/andy/.opensync/group2/1/file-sync.conf
        This file needs the explicit path to where to save files. Replace:
              default
                      with              ~/files_from_nokia

    c. Refine configuration for syncml-obex-clients for both Evolution and File:
        i. Make the uncontroversial settings:
            + Bluetooth MAC address:E0:A6:70:FE:9B:DC or whatever your value is from hcitool scan

            + The string that the plugin will use to identify itself.
                The identifier for Nokia mobile phones is:
                        PC Suite
                This parameter sets the "Synchronization Software" Identifier, which will be used to identify to the mobile phone. Most mobile phones ignore this identifier value. So far we only know Nokia mobile phones, which reject the synchronization when the identifier is wrong.

            + Other settings:
                https://help.ubuntu.com/community/NokiaEvolutionSyncing/Opensync suggests:
                    * version: 1
                    * wbxml: 1
                    --wbxml
                    This switch to WAP Binary XML instead of plain XML in the synchronization.
                    So far as we known this is used by most mobile phones, so we enable it by default.
                    If you have trouble with the initial sync testcase remove this parameter.
                    * usestringtable: 1
                    * recvLimit: 10000    Default is 0
                    * maxObjSize: 10000     Default is 0
                Don't change contact_db, calendar_db or note_db, and don't put in a username or password (perhaps unless you have one set up in the phone).

                https://help.ubuntu.com/community/NokiaEvolutionSyncing/Opensync
                    says to set it to the channel being used  by SyncML Server (10).
                    But other sources suggest using the SyncML Client (6)
                    And then we are using PC Suite Services, which suggests channel 8
                    So this needs to be determined by tests.

            + The USB interface number of the SYNCML-SYNC target returned by step 8 sdptool browse. The conf file says this is is the interface number (0) from step 9 above (syncml-obex-client -u with USB cable)
                    Interface 0:
                            Interface description: SYNCML-SYNC
                    Interface 1:
                            Interface description: PC Suite Services
                    Interface 2:
                            Interface description: SYNCML-DM
                    Interface 3:
                            Interface description: Haptics Bridge


        c. Additional settings not in the default .conf file
            https://help.ubuntu.com/community/NokiaEvolutionSyncing/Opensync
                suggests additional settings for USB:
                You'll need to fix permissions for your USB device. First you should connect your device with the usb cable. Then make sure that the lsusb command lists your device:
                    lsusb
                returns a bunch, including
                Bus 001 Device 003: ID 0421:0302 Nokia Mobile Phones

            i. Change the rules:
                + Unplug the phone
                + Use kate as root to modify /etc/udev/rules.d/40-nokia-mobiles.rules. The file does not exist.
                     Write it as
                    BUS=="usb", SYSFS{idVendor}=="0421", SYSFS{idProduct}=="*", MODE="0660", GROUP="dialout"
                    # This might work if the above doesn't :-( (substitutes ATTR for SYSFS)
                    # SUBSYSTEM=="usb", ATTR{idVendor}=="0421", ATTR{idProduct}=="*", MODE="0660", GROUP="dialout"
                + Run as root:
                    /etc/init.d/boot.udev reload                + Replug the phone

11. Check Bluetooth
    syncml-obex-client -b E0:A6:70:FE:9B:DC #        where # is 6, 7, 8, 9, or 10
        -b
        This parameter is for Bluetooth connections. For fill in the MAC address of your mobile phone and for the number of the SyncML service. But these all fail with
            Failed to start the client: You have to configure at least one database

12. To get a resume of your configuration just do a:
    msynctool --showgroup sync_nokia2file

13. Now all is configured: just sync your date from your phone to your computer:
    msynctool --sync sync_nokia2file

============================
In theory, enjoy. But first, we need to fix Bluetooth and USB connectivity.

No comments: