#!/bin/bash # # Identify USB serial connection for Nokia phone. See: # http://labs.danilocesar.com/blog/2010/05/05/symbian-development-using-linux-on-real-life/ # # Wraps runonphone, which must be installed: # http://labs.qt.nokia.com/2010/12/17/experimental-packages-for-symbian-development-on-linux/ # # Add to a project's deploy configuration or run configuration: # 1) Open project in Qt Creator # 2) Go to "Projects > Remote compiler: Run" # 3) Add a custom deploy step # * Command: runonphone.wrap # * Working directory: $BUILDDIR # * Command arguments: install # # Copyright (c) Andrew Flegg 2011. Released under the Artistic Licence. SIS=$(ls -t "$BUILDDIR/"*.sis | head -n 1) USB=$(lsusb | grep 'Nokia Mobile'| awk '{print $6}') VENDOR=$(echo $USB | cut -d: -f 1) PRODUCT=$(echo $USB | cut -d: -f 2) APP=$(echo $SIS | cut -d_ -f 1) PORT=$(ls -t /dev/ttyUSB* | grep ^c | tail -n 1) if [ -z "$PORT" ]; then gksudo -D "Symbian deployment (enable USB serial)" modprobe usbserial vendor=0x${VENDOR} product=0x${PRODUCT} # vivainio said this had to be changed to $10 on Ubuntu Maverick PORT=$(dmesg | grep "now attached to" | tail -n 1 | awk '{print $9}') fi if [ "$PORT" != "ttyUSB0" ]; then echo "Got ${PORT}. Removing USB serial..." kill -9 $(lsof -Fp /dev/ttyUSB* | sed -e 's/^p//') gksudo -D "Symbian deployment (reset USB serial #1)" rmmod usbserial echo "Reinserting..." gksudo -D "Symbian deployment (reset USB serial #2)" modprobe usbserial vendor=0x${VENDOR} product=0x${PRODUCT} PORT=$(dmesg | grep "now attached to" | tail -n 1 | awk '{print $9}') fi if [ "$PORT" != "ttyUSB0" ]; then echo "Cannot get ttyUSB0 (getting $PORT)" exit 1 fi echo "$SIS -> $USB via $PORT" if [ "$1" == "install" ]; then runonphone -s "$SIS" -v -p /dev/${PORT} elif [ "$1" == "run" ]; then runonphone -p /dev/${PORT} "${APP}.exe" else echo "syntax: $0 [install|run]" exit 1 fi