PDA

View Full Version : How to transfer files from and to your Nokia N70 through USB with Fedora 7


fombu
11th September 2007, 06:34 PM
0. Environment.
1. Previous work.
2. obexftp and obexftp-frontend.
3. Java problem and solution.
4. Useful links.

0. Environment.

The target of this guide is to connect a Nokia N70 mobile phone (OBEX compatible) to your linux box running Fedora 7 through the USB cable and transfer files from/to the phone.
I have tested this guide with three computers, two PC and one laptop. The PC have USB 1.1 ports, and the laptop has USB 2.0 ports. I did the test with "Fedora kernel" 2.6.22.4-65.fc7.
I will give you some (probably not enough) information about how to connect other brands or models, and how to connect through bluetooth.
If your phone is not OBEX compatible, or better, uses USB mass storage device class to transfer files, this is not your guide (and you don't need any guide in the second case because your phone will work out of the box).

1. Previous work.

1.1 - Install obexftp and package dependencies:
yum install obexftp

1.2 - Blacklist cdc-acm module, adding to /etc/modprobe.d/blacklist as root:

blacklist cdc-acm

1.3 - Unload cdc-acm module:

modprobe -r cdc-acm

1.4 - Add an udev rule to modify the default behaviour. In my example, /etc/udev/rules.d/60-mobile.rules. The file has to contain:

# NOKIA

# Nokia N70
SUBSYSTEM=="usb_device", ATTRS{idVendor}=="0421", ATTRS{idProduct}=="043a", MODE="0666"

IMPORTANT: Since F8 udev version and maybe latest F7 udev version, the above rule doesn't work. Try this one instead:

# NOKIA

# Nokia N70
SUBSYSTEM=="usb", ATTRS{idVendor}=="0421", ATTRS{idProduct}=="043a", MODE="0666"

- Two tips:
1. The rule number (60 in my example) must be upper than the number of udev rules, at the moment 50-udev.rules.
2. You can use this guide with other brands or models, just changing idVendor and idProduct with your values. To find them, with root privileges type lsusb in a terminal with the phone properly plugged in. Here is my output to illustrate:
lsusb
Bus 002 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 001 Device 028: ID 0421:043a Nokia Mobile Phones
Bus 001 Device 003: ID 413c:8000 Dell Computer Corp.
Bus 001 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000

The two numbers we are looking for are after ID and before "Nokia Mobile Phones".

1.5 - Reload udev rules:

udevcontrol reload_rules

1.6 - Unplug and plug in the phone again.

2. obexftp and obexftp-frontend.

2.1 - Try, with a non privileged user to list the usb obex interfaces:

obexftp -u
If USB doesn't work setup permissions in udev or run as superuser.
Found 2 USB OBEX interfaces

0 (Manufacturer: Nokia Product: Nokia N70 Serial: (null) Interface description: SYNCML-SYNC)
1 (Manufacturer: Nokia Product: Nokia N70 Serial: (null) Interface description: PC Suite Services)

Use '-u interface_number' to connect
Nothing to do. Use --help for help.

2.2 - OK, now try to list the root directory of your phone:

obexftp -u 1 -l
If USB doesn't work setup permissions in udev or run as superuser.
Connecting...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="Memoria del teléfono"/>
<folder name="E:" user-perm="RW" mem-type="MMC" label="Kingston"/>
</folder-listing>done
Disconnecting...done

2.3 - All hard work is done and you can upload and retrieve files to/from your phone. It's the moment to improve the user experience with a nice gui for obexftp.

2.4 - Download OBEXFTP Front-end from the project's homepage (http://obexftpfrontend.sf.net). At the moment, the newest version is 0.6.2 and the file that I downloaded is obexftp-frontend-0.6.2-bin.zip

unzip obexftp-frontend-0.6.2-bin.zip
Archive: obexftp-frontend-0.6.2-bin.zip
creating: obexftp-frontend-0.6.2-bin/
creating: obexftp-frontend-0.6.2-bin/lib/
inflating: obexftp-frontend-0.6.2-bin/lib/jdom-1.0.jar
inflating: obexftp-frontend-0.6.2-bin/lib/looks-2.1.2.jar
inflating: obexftp-frontend-0.6.2-bin/lib/obexftp-frontend-art-0.6.jar
inflating: obexftp-frontend-0.6.2-bin/lib/javahelp-2.0.02.jar
inflating: obexftp-frontend-0.6.2-bin/lib/obexftp-frontend-help-0.6.jar
inflating: obexftp-frontend-0.6.2-bin/lib/log4j-1.2.13.jar
extracting: obexftp-frontend-0.6.2-bin/Run.sh
inflating: obexftp-frontend-0.6.2-bin/LICENSE.txt
inflating: obexftp-frontend-0.6.2-bin/README.txt
inflating: obexftp-frontend-0.6.2-bin/obexftp-frontend-0.6.2.jar
inflating: obexftp-frontend-0.6.2-bin/CHANGELOG.txt

2.5 - Run obexftp-frontend:

java -jar obexftp-frontend-0.6.2-bin/obexftp-frontend-0.6.2.jar

2.6 - The first time you run obexftp-frontend, preferences window pops up and ask you about some important information, like "ObexFTP path" (/usr/bin/obexftp) and "Connection type". In "Value" box you have to write the number that you've got with obexftp -u corresponding to "PC Suite Services".

2.7 - If you prefer to connect to your phone through a Bluetooth dongle, set "Connection type" to Bluetooth and write your phone MAC address in the "Value" box. To know your phone MAC address:

hcitool scan
Scanning ...
00:AA:BB:DD:EE:FF yourmobile

2.8 - For bluetooth users, don't forget to pair your phone with your computer before try to connect with obexftp-frontend.

3. Java problem and solution.

3.1 - I got and exception with java-1.5.0-gcj-1.5.0.0-14.fc7:

java -jar obexftp-frontend-0.6.2-bin/obexftp-frontend-0.6.2.jar
Exception in thread "main" java.lang.ClassFormatError: net.sourceforge.obexftpfrontend.Main (unrecognized class file version)
at java.lang.VMClassLoader.defineClass(libgcj.so.8rh)
at java.lang.ClassLoader.defineClass(libgcj.so.8rh)
at java.security.SecureClassLoader.defineClass(libgcj .so.8rh)
at java.net.URLClassLoader.findClass(libgcj.so.8rh)
at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj .so.8rh)
at java.lang.ClassLoader.loadClass(libgcj.so.8rh)
at java.lang.ClassLoader.loadClass(libgcj.so.8rh)
at gnu.java.lang.MainThread.run(libgcj.so.8rh)

3.2 - My solution was to install java from Sun (not only to solve this), but it's obviously more hard work to do. Anyway, here you have my instructions:

3.2.1. Download the Java SE Development Kit with Java Runtime Environment (http://java.sun.com/javase/downloads/index.jsp). I chose "Linux self-extracting file" because the "Linux RPM in self-extracting file" version changes some MIME types associations.

3.2.2. As root, create a directory java behind /usr, move the file there and add executable permissions to it:

mkdir /usr/java
cp /home/user/jdk-6u2-linux-i586.bin /usr/java/jdk-6u2-linux-i586.bin
chmod +x /usr/java/jdk-6u2-linux-i586.bin
/usr/java/jdk-6u2-linux-i586.bin

3.2.3. Read and accept the "License Agreement".

3.2.4. Make a symbolic link like this (very useful for later updates):
ln -s /usr/java/jdk1.6.0_02 /usr/java/latest

3.2.5. Create /etc/profile.d/java.sh with this content and give it executable permissions:

export JAVA_HOME=/usr/java/latest
export PATH=$PATH:$JAVA_HOME/bin

chmod 655 /etc/profile.d/java.sh

3.2.6. Close your session and open it again (the easiest way to apply profile changes).

3.2.7. Configure the default java machine:
alternatives --install /usr/bin/java java /usr/java/latest/bin/java 500
alternatives --install /usr/bin/javac javac /usr/java/latest/bin/javac 500
alternatives --config java
(Choose /usr/java/latest/jre/bin/java)
alternatives --config javac
(Choose /usr/java/latest/jre/bin/javac)

3.2.8. In order to have the java plugin for seamonkey or firefox, you also have to do with your normal user:
mkdir ~/.mozilla/plugins
ln -s /usr/java/latest/jre/plugin/i386/ns7/libjavaplugin_oji.so /home/user/.mozilla/plugins/libjavaplugin_oji.so

3.2.9. That's all! I hope you'll enjoy obexftp-frontend and the java machine as well.

4. Useful links.

4.1 - I read some useful pages before get all that working. The most important ones were:
- http://news.softpedia.com/news/Transfer-Files-To-And-From-Your-Nokia-Phone-63116.shtml
- http://vertito.blogspot.com/2007/08/nokia-n70-on-fedora-via-usb-data-cable.html
- http://reactivated.net/writing_udev_rules.html
- http://ubuntuforums.org/showthread.php?t=168221
- http://www.egjug.org/?q=linux_java

Deady
23rd September 2007, 10:55 AM
If you have Sun's JRE-1.6, you can also load webstart version of obexftp-frontend-0.6.2 (2nd in list, extention: 'jnlp'). To run application, type:
javaws -viewer
then right-click on app and select "Install shorcuts". The shortcut will appear on your desktop.
Now each time you run app, it will check for updates (but you can also run it offline).