Код отслеживания Google Analytics.

Feb 21, 2010

Cell-phone file system access

Just short note about how we can explorer file system of cell phone (in my case it was Nokia 3120 classic). The main idea can be found at http://dev.zuckschwerdt.org/openobex/wiki/ObexFs.



Well at first I switched on bluetooth on my notebook as well as on phone. Also I set phone in searchable mode for two minutes.
At second we have to know bluetooth device number:
$ hcitool scan
Scanning ...
     XX:XX:XX:XX:XX:XX  Nokia 3120 classic
and channel number:
$ sdptool browse XX:XX:XX:XX:XX:XX | grep -E "Service Name|Channel"
...
Service Name: OBEX File Transfer
    Channel: YY
...
Now we have bluetooth device ID (XX:XX:XX:XX:XX:XX) and sure "OBEX File Transfer" protocol is supported on channel YY. It is all we need and we can try some common activities(mount, ls, umount):
$ obexfs -b XX:XX:XX:XX:XX:XX -B YY -- ./Tmp
$ ls ./Tmp/
Graphics  Images  Music files  Received files  Recordings  Themes  Tones  Video clips
$ fusermount -u ./Tmp

probably you will be asked about authentication code for connnection between phone and computer.
Unfortunately the string in fstab (method which was described in article mentioned above)does not work for me due to unknown reasons and I've just added one more script at my collection which mount/unmount directory to my phone:

#!/bin/bash

bluetoothDevice=XX:XX:XX:XX:XX:XX
channel=YY
mountPoint=/mnt/cellPhone

if mount | grep --no-messages "${mountPoint}"; then
    fusermount -u "${mountPoint}"
    echo "device was unmounted"
else
    obexfs -b "${bluetoothDevice}" -B "${channel}" "${mountPoint}"
    echo "device was mounted at ${mountPoint}"
fi

and prepare environment for it (as root):
# adduser ns fuse
# mkdir /mnt/cellPhone
# chgrp fuse /mnt/cellPhone
# chmod g+rwx /mnt/cellPhone

We also can send our files directly to phone without any mount actions ("OBEX Object Push"):
$ bluetooth-sendto --device=XX:XX:XX:XX:XX:XX <file name>... 

No comments: