Version 1.70, 26 January 2006
This page describes how I transfer files to and from my Nokia 6670 using the Nokia DKU-2 USB cable and Bluetooth. These instructions worked with a 6630 for Luca Marrazzo and should also work verbatim for a Nokia 7610, Sony Ericsson Z1010 or LG U8110/8120. I have had reports that these instructions work for Nokia 6680, 6682 and 3230 phones and that they can be used under OS X. Many web sites deal with IR, Bluetooth and TCP/IP connections but I wanted to use a USB connection due to:
Disclaimer: The information contained in this document has all been gleaned from the Internet, which is not renowned for its accuracy. The method outlined below Worked For Me and I hope it works for you as well. It is not my fault if it causes your hard drive to crash, wife to leave you, etc.
Most Nokia phones (as well as a large number of other makes) use the OBject EXchange (OBEX) protocol. OBEX was originally defined by the Infrared Development Association (IrDA) to be used for IR transfers but the transport layer was deliberately not defined. As a result, many mobile phone manufacturers have chosen to use the OBEX protocol on top of transports such as IR, Bluetooth, USB and TCP/IP.
OpenOBEX is a free implementation of OBEX licenced under the GPL. The last release of the OpenOBEX library (v1.0.1, released October 2003) supports IR, Bluetooth (via bluez) and TCP/IP connections. It is possible to use OpenOBEX over USB for phones which have an in-built USB-to-Serial converter but this limits the maximum throughput to serial speeds. However, a fellow by the name of Alex Kanavin has developed a patch to OpenOBEX which allows OpenOBEX direct USB access via libusb. He writes:
For Nokia phones the rule of thumb is this: if it comes with a DKU-2 cable, it has a proper OBEX interface, and should work with this patch. If it comes with a DKU-5 or any other cable, then it's using some other method and isn't compatible. The compatibility chart is here.
Alex's patch was added to the OpenOBEX CVS respository on the 19th December 2005 so it is no longer necessary to apply the patches manually.
$ cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/openobex login
No password, just press <enter>
$ cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/openobex co -P openobex
Make sure that you have all the necessary tools and libraries installed (gcc, make, automake, autoconf, libusb, etc). The commands shown here are to install to $HOME/usbobex. If necessary, first create the target directory with mkdir ~/usbobex (or whatever directory you are going to install into). Now:
$ cd openobex
$ ./bootstrap
$ ./configure --prefix=$HOME/usbobex --enable-apps
$ make install
Some people have reported getting an error reading "The option --tag=CC was not recognized by libtool" when running make. Fabrizio Pinto suggested running libtoolize before ./bootstrap in the above commands. If this does not work for you, then Luca Citi suggested the following:
The problem was in my distribution (FC3) automake 1.9 is the default and it generates scripts for the new libtool with the option --tag=CC that is not recognized by the libtool in the lib folder. The solution was to add a soft link "automake -> automake-1.4" and "aclocal -> aclocal-1.4" before the whole process.
Others have reported getting a "syntax error before string constant" error when building the OpenOBEX apps with certain versions of gcc. This can be fixed by adding the following lines to ./include/obex.h:
#ifndef __FUNCTION__ # ifdef __func__ # define __FUNCTION__ __func__ # else # define __FUNCTION__ __FILE__ # endif #endif
Now that OpenOBEX is installed you can use obex_test to test the connection. Make sure that your phone is connected via the USB cable and query the available interfaces:
$ ~/usbobex/bin/obex_test -u
A successful response will look similar to:
Using USB transport, querying available interfaces Interface 0: Nokia Nokia 6670 SYNCML-SYNC Interface 1: Nokia Nokia 6670 PC Suite Services Use '~/usbobex/bin/obex_test -u interface_number' to run interactive OBEX test client
There are a few common problems encountered at this stage:
You may need to run the above command as root if the current user does not have permission to access the appropriate USB device:
$ su -c $HOME'/usbobex/bin/obex_test -u'
If you see "Using IrDA transport" instead then you probably have a pre-existing installation of OpenOBEX. To fix this problem, either remove the old libraries or install over them.
If you get the error message "obex_test: error while loading shared libraries: libopenobex-1.0.so.1: cannot open shared object file: No such file or directory" then you can specify the library path with a slightly more convoluted command:
$ su -c LD_LIBRARY_PATH=$HOME/usbobex/lib' $HOME/usbobex/bin/obex_test -u'
If you found in the previous step that your current user did not have permission to the USB device, you may want to configure hotplug (if you are using it) so that it changes the file permissions when the phone is plugged in. First find the Vendor ID (VID) and Product ID (PID) of your phone using lsusb or by reading /proc/bus/usb/devices directly. As root, create the file /etc/hotplug/usb/nokia.usermap containing a single line (substituting the third and fourth fields with your VID and PID if necessary):
nokia 0x0003 0x0421 0x041d 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
This will cause the script /etc/hotplug/usb/nokia to be executed when the phone is plugged in. You can use this example but you must substitute your own user and group in the chmod command. Remember to make the script executable!
If your system uses a newer version of udev which does not call hotplug directly, you can get the same effect by adding a rule to /etc/udev/rules.d/020_permissions.rules similar to:
BUS=="usb", SYSFS{idVendor}=="0421", SYSFS{idProduct}=="041d", GROUP="group"
Remember to substitute your own group your user along with the Vendor ID and Product ID if necessary.
My patch to allow ObexFTP to use USB can be found here. Note that my patch includes support for Andrzej Szombierski's --output flag to enable Midnight Commander support. Download and untar ObexFTP, then:
$ patch < ~/obexftp.patch
$ cd obexftp-0.10.8
$ cat aclocal.m4 >> acinclude.m4
$ aclocal && autoconf
$ ./configure --prefix=$HOME/usbobex PKG_CONFIG_PATH=$HOME/usbobex/lib/pkgconfig/ --disable-perl --disable-python --disable-tcl
$ make install
You can now test ObexFTP with the command below. You may need to substitute the integer after the -U flag with the interface number that obex_test returned for "PC Suite Services".
$ ~/usbobex/bin/obexftp -U 1 -c C: -l
If everything has been successful, you should see something like:
No custom transport Connecting...failed: connect Still trying to connect Connecting...failed: connect Still trying to connect Connecting...failed: connect Still trying to connect Connecting...done Sending C:... Sending C:... done Receiving (null)... <?xml version="1.0"?> <!DOCTYPE folder-listing SYSTEM "obex-folder-listing.dtd" [ <!ATTLIST folder mem-type CDATA #IMPLIED> <!ATTLIST folder label CDATA #IMPLIED> ]> <folder-listing version="1.0"> <parent-folder /> <folder name="cache" modified="20050302T092834Z" user-perm="RWD" mem-type="DEV"/> <folder name="Nokia" modified="20040101T201008Z" user-perm="RWD" mem-type="DEV"/> </folder-listing>done Disconnecting...done
The first 3 failed attempts were attempts to connect via Bluetooth (if configured) or IrDA (default). If the command fails then it is possible that hotplug has loaded a kernel module which has claimed the USB interface. Type dmesg and look for a line that reads something like "usb 3-1: usbfs: interface 5 claimed by cdc_acm while 'obexftp' sets config #1". This indicates that the cdc_acm module has claimed the USB interface that ObexFTP needs to use. Run rmmod cdc_acm and retry the commands above. If ObexFTP now works, then you may want to modify the /etc/hotplug/usb/nokia script from the previous step so that it automatically removes the module when then phone is plugged in to the USB port. If you find that cdc_acm crashes when you unload it then the best solution is to delete it so that it is never loaded in the first place.
The phone's internal memory is accessed as C: whereas E: refers to the memory card. It is usually a good idea to surround file and directory names in quotes so that you do not have to escape spaces, e.g:
$ $HOME/usbobex/bin/obexftp -U 1 -c 'C:/Nokia/Images' -l
Remember to substitute the appropriate interface number. Sending and receiving files can be done with the -p (put) and -g (get) flags, as in:
$ obexftp -U 1 -c 'E:/Videos' -p sonic.3gp
and
$ obexftp -U 1 -c 'C:/Nokia/Sounds/Digital' -g 'Sound clip.amr'
Note that because of a problem with the 6670, directory names given to the -l flag must be terminated with a slash.
If you wish to use ObexTool, first make sure that you have Tcl and BWidget installed. Now download the Tablelist and ObexTool packages and unpack them in the $HOME/usbobex directory:
$ cd ~/usbobex
$ tar -zxvf ~/tablelist4.1.tar.gz
$ tar -zxvf ~/obextool-0.33.tar.gz
$ cd obextool-0.33
You now have to modify ./etc/obexwrap.sh to point to wherever ObexFTP is installed. If ObexFTP is installed under $HOME/usbobex, change the uncommented line:
obexftp -t /dev/modem "$@"
to
$HOME/usbobex/bin/obexftp -U 1 "$@"
For Bluetooth support you would need to change this to something like
$HOME/usbobex/bin/obexftp -b '00:0F:ED:F1:DD:5E' -B 12 "$@"
Now modify obextool.tk to point to wherever Tablelist was unpacked, i.e. change the line:
exec wish "$0" ${1+"$@"}
to
TCLLIBPATH=$HOME/usbobex/tablelist4.1/ exec wish "$0" ${1+"$@"}
Finally, set your preferences in the ./etc/obextool.cfg file. It is very important that the config.memstatus and config.filemove settings are set to 0 as these are commands are specific to Siemens phones and will cause USB to hang on a Nokia 6670 requiring a reboot. You also need to set config.dir_slash to 1 to work around a problem with the OBEX implementation on the phone. If all goes well, you should be able to execute ObexTool and see something like:
$ ./obextool.tk
The patches and compilation instructions given above will enable Bluetooth support if the BlueZ development libraries and headers are installed.
You can verify that Bluetooth is enabled at compile time by checking if HAVE_BLUETOOTH is defined in config.h.
Once the OpenOBEX library and the ObexFTP application are installed, test the connection with:
$ ~/usbobex/bin/obexftp -b 00:0F:ED:F1:ED:5E -B 12 -l
If ObexFTP can communicate with the phone, the phone will inform the user that there is an attempted incoming connection. Enter a Security PIN that will be used to encrypt Bluetooth traffic:
If bluez-pin was installed correctly, the PC will prompt the user for the same PIN:
If everything has been successful, the phone will then prompt you to accept the connection and you should see someting like:
Scanning ... Using 00:0F:ED:F1:ED:5E Bazza Browsing 00:0F:ED:F1:ED:5E ... Channel: 10 Channel: 10 No custom transport Connecting...bt: 1 done Receiving (null)... <?xml version="1.0"?> <!DOCTYPE folder-listing SYSTEM "obex-folder-listing.dtd" [ <!ATTLIST folder mem-type CDATA #IMPLIED> <!ATTLIST folder label CDATA #IMPLIED> ]> <folder-listing version="1.0"> <folder name="C:" user-perm="RW" mem-type="DEV" label="Phone memory"/> <folder name="E:" user-perm="RW" mem-type="MMC" label="MMC"/> </folder-listing>done Disconnecting...done
This should have created a new entry in the Paired devices menu with the host name of the Linux PC. It is a good idea to set the entry as authorised so that it is not necessary to authorise every single connection in the future.
Andrzej Szombierski has written a Perl script which allows OBEX devices to be accessed as a virtual file system using Midnight Commander. You need to have Midnight Commander installed (obviously) as well as the XML::Simple Perl module. To install mcOBEX, you need to download the mcOBEX script and make it known to Midnight Commander. As root:
# chmod 755 mcobex
# mv mcobex /usr/share/mc/extfs/obex
Add an entry to the virtual file system list by inserting a new line in /usr/share/mc/extfs/extfs.ini which reads:
obex
You will need to modify the OBEXFTP variable if you did not install ObexFTP to $HOME/usbobex. There are a few other variables that you may need to change depending on the model of your phone and your preferred connection method.
For USB:
For Bluetooth:
You should now be able to access your OBEX device from within Midnight Commander by typing cd /#obex at the shell prompt.
Still images are JPEG files which can be immediately used by all mainstream image viewers. Radio recorded with the Sound Recorder application is in Adaptive Multi-Rate (AMR) format, which is an open standard defined by the 3rd Generation Partnership Project (3GPP). Saved video is also in a 3GPP-defined format.
3GPP provide a freely downloadable reference encoder/decoder (number 26104). Edit the Makefile and undefine the ETSI macro before compiling. The decoder will convert to headerless audio data, which can be turned into a WAV file with sox, e.g:
$ <path to 26104>/decoder 'Sound clip.amr' 'Sound clip.raw'
$ sox -r 8000 -w -c 1 -s 'Sound clip.raw' -r 16000 -w -c 1 'Sound clip.wav'
To find out how to convert to MP3, see this site or this one.
This site outlines the basic steps necessary to convert video into a format suitable for playback with the RealPlayer application. You will need to compile ffmpeg with WB-AMR support (i.e. specify --enable-amr_wb to configure), which will require downloading an AMR reference player from the 3GPP web site. You should also install mplayer to get mencoder. In brief:
$ tar -zxvf ffmpeg-0.4.9-pre1.tar.gz
$ cd ffmpeg-0.4.9-pre1/libavcodec
$ mkdir amrwb_float amr_float
$ cd amrwb_float
$ unzip ~/26204-530.zip
$ unzip -j 26204-530_ANSI-C_source_code.zip
$ cd ../amr_float
$ unzip ~/26104-540.zip
$ unzip -j 26104-540_ANSI_C_source_code.zip
$ cd ../..
$ ./configure --enable-amr_wb --enable-amr_nb
$ make
$ cd
$ tar -jxvf MPlayer-1.0pre7.tar.bz2
$ cd MPlayer-1.0pre7/libavcodec/
$ ln -s ~/ffmpeg-0.4.9-pre1/libavcodec/amr_float/
$ ln -s ~/ffmpeg-0.4.9-pre1/libavcodec/amrwb_float/
$ ./configure
$ make
You can convert your movie files to 3GPP with something similar to:
$ mencoder "Sealab 2021 - _4 - 10_ Sharko_s Machine.avi" -ovc lavc -lavcopts vcodec=mpeg4 -oac pcm -o sealab.avi -ofps 5
$ ffmpeg -i sealab.avi -s 128x96 -vcodec h263 -ar 8000 -ac 1 -acodec amr_nb -r 6 sealab.3gp
One way of converting 3GPP video to other formats can be found here. However, I have had no problems with the following:
$ mencoder -force-avi-aspect 4:3 -ovc lavc -lavcopts vcodec=msmpeg4v2 -oac mp3lame -ofps 25 -o out.avi Video\(001\).3gp
To install MIDP software, copy the .jar (archive) and the corresponding .jad (description) file to the same directory on the phone then 'Open' either file in the File Manager. This will install the software and make it accessible from the Main Menu. To compile software, install the Series 60 2nd Edition SDK for Symbian OS from Nokia (requires annoying registration) and a recent Java SDK such as those from Sun or Blackdown. Compile the source files (remembering to include the Series 60 SDK in the classpath), preverify them, and then package them with the jar tool that is included with the Java SDK, e.g.:
jar cvfm MyApp.jar META-INF/MANIFEST.MF *.class *.png
Hint: archives created using zip will work fine in the simulator but will give a Authorisation Failed message when you try to install them on the phone. You may find this Makefile helpful to automate the compilation process.
Just copy the .sis file then install it in a similar fashion to Java software.
This section contains information that I discovered while attempting to communicate with my Nokia 6670. It will probably only be interesting to OBEX developers.
I found these specification documents helpful:
The initial connection will fail if the Folder Browsing Service (FBS) UUID (382D2BD0-3C39-11d1-AADC-0040F614953A) is specified as the Target in the header. This could be because connecting to interface number #1 implies the FBS (Nokia engineers: please feel free to correct me here). As I understand it, there are 4 types of OBEX requests:
The first two appear to work in accordance with the specification but I have had problems with the latter pair. A GET command with Type set to x-obex/capability returns this, which is to be expected. However, a x-obex/folder-listing request appears to ignore the Name header and will only return the root folder. This is why my ObexFTP patch uses a SETPATH command before listing a directory with --list. A side-effect of this is that directory names must end in a slash (hence the ObexTool patch) else the path will be assumed to be a filename and subsequently be ignored. x-obex/object-profile requests do not appear to work at all.
Symbian 60 screen shots were made with Screenshot by Antony Pranata.
Mail the author with flames/comments/suggestions or
return to home
Last updated 26 January, 2006