Tuesday, March 23, 2010

Nokia N900 guide: Sync folders between N900 and PC over wifi

Since I got my N900, one thing that I really wanted to do was to sync the DCIM folder (where the 5-megapixel camera stores its pictures and videos) with my Windows XP PC over wifi. After reading some posts on http://talk.maemo.org/, I knew that it would be possible but couldn't find anything that details the steps required to unleash the power of wireless sync between N900 and PC. In this post, I will explain to you step-by-step how to actually implement it.

N900:
  • Obtain root access to the N900 since you are going to be editing files in /etc. Follow instructions here.
  • [Optional] Download and install Open SSH. It's much easier to type on a full-sized keyboard than on the N900. Alternatively, you could use VNC the N900.
  • Using your favorite editor, edit the file /etc/default/rsync and enable rsync as root user. The line should say
RSYNC_ENABLE=true
  • Check that you have /etc/default/rcS. If not, create that file and paste the following content into it:
#
# /etc/default/rcS
#
# Default settings for the scripts in /etc/rcS.d/
#
# For information about these variables see the rcS(5) manual page.
#
# This file belongs to the "initscripts" package.

TMPTIME=0
SULOGIN=no
DELAYLOGIN=no
UTC=no
VERBOSE=no
FSCKFIX=no
  • Now, create the file /etc/rsyncd.conf with the following content. This defines which directories you want to sync.
max connections = 3
[camera]
path = /home/user/MyDocs/DCIM
uid = nobody
gid = 65534
  • In rsync.conf, I'm allowing only 3 simultaneous rsync connections to my N900. DCIM is the folder that I want the rsync client to synchronize and as a first step, anybody can get the files anonymously. (You may not want that if you are on a public wifi network. But since I'm going to be doing this on my home wireless network only, anonymous access is not a concern for me at this point.)
  • Now you are ready to start the rsync server. Type this
    /etc/init.d/rsync start

Now, go to a Windows machine on the same wireless network...
  • Download and install cwrsync.
  • Create the destination directory. For example, C:\Documents and Settings\N900 User\My Documents\My Pictures\From N900 Camera
  • Create a file called sync_n900.bat anywhere you like. (Feel free to name the batch file something else.)
  • set RSYNC="C:\Program Files\cwRsync\bin\rsync"
    %RSYNC% -az --progress 192.168.0.105::camera "/cygdrive/C/Documents and Settings/N900 User/My Documents/My Pictures/From N900 Camera"

    • Substitute 192.168.0.105 with the IP address of your N900.
    • Note: Since cwrsync really is rsync-under-cygwin, to specify C: drive, you have to write /cygdrive/C.
  • Alternatively, instead of a batch file, you can of course use other GUI wrappers for cwrsync.
  • If everything goes well, after running sync_n900.bat, you will see something like this:

  • Note that I can consistently get ~600kB/s at home through my 802.11g wireless router.
  • That's it!
Troubleshooting
rsync: opendir "/." (in camera) failed: Permission denied (13)

sent 28 bytes received 140 bytes 67.20 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 2
3) at main.c(1508) [generator=3.0.7]
  • Ensure the N900 is NOT in Mass Storage Mode (with USB data cable connected to a computer).

5 comments:

Arun Chandran said...
This comment has been removed by the author.
Arun Chandran said...

THE SYNC SEEMS TO BE ONE WAY(FROM N900 TO PC)
IS THERE ANY WAY TO MAKE IT FROM WINDOWS PC TO N900

Toby Newman said...
This comment has been removed by the author.
Toby Newman said...

/etc/default/rsync does not exist on my n900

S said...

Toby, it doesn't exist. You have to create it.