nokia 9300 & gentoo bluetooth mount script

here is a simple snippet to mount your nokia 9300i as a drive assuming you have all the right bluetooth tools on your machine. this script was only tested with gentoo, not that it would make any difference, keep in mind this script is still being modified and tested so i guarantee nothing.

this script also assumes that you have nfsapp installed on your phone.

function pause(){
    read -p "$*"
}

# hci mount scan
HCI_MNT_SCAN=/tmp/hci_mnt_scan.txt
if [ -f ${HCI_MNT_SCAN} ]; then
    rm -rfd ${HCI_MNT_SCAN} && touch ${HCI_MNT_SCAN}
fi

# rfcomm bindings temp file
RFCOMM_SCAN=/tmp/rfcomm_scan.txt
if [ -f ${RFCOMM_SCAN} ]; then
    rm -rfd ${RFCOMM_SCAN} && touch ${RFCOMM_SCAN}
fi

clear
printf "\n"
printf "\n"
printf "beginning hcitool scan to list devices\n"

# listing available bid's
hcitool scan | grep -v "Scanning ..." >> ${HCI_MNT_SCAN}
if [ ! -s ${HCI_MNT_SCAN} ]; then
    printf "no devices found.\n"
    printf "exiting\n"
    exit 1
fi
cat ${HCI_MNT_SCAN}

printf "enter the BID of the device to use:\n"
read RFCOMM_BID

# listing rfcomm bindings
rfcomm >> ${RFCOMM_SCAN}
cat ${RFCOMM_SCAN}

if [ -s ${RFCOMM_SCAN} ]; then
    RFCOMM_STATUS=`cat ${RFCOMM_SCAN} | awk '{print $5}'`
    printf "unbinding rfcomm for usage\n"
    # running command with sudo instead of having to run the script in sudo
    sudo rfcomm release /dev/`cat ${RFCOMM_SCAN} | awk '{print $1}' | sed 's/\://'`
fi    

# rfcomm bind /dev/rfcomm0 ${RFCOMM_BID} 13
# running command with sudo instead of having to run the script in sudo
rfcomm bind /dev/rfcomm0 ${RFCOMM_BID} 3

printf "at this point, begin nfsapp on the 9300i\n"
pause 'press enter to continue...'

P3NFS_MNT_DIR=/home/lgarion/phone
p3nfsd -series80 -tty /dev/rfcomm0 -dir ${P3NFS_MNT_DIR}
«
»

    Leave a Reply

    Your email address will not be published. Required fields are marked *