MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9

Setting up and using USB connection

This section describes how to set up and use a USB connection between the device and the Scratchbox environment on a host workstation. Further steps also describe how to use the internet on the device through the host workstation connection.

Prerequisite:

Connecting the device to the host

1. On the device, start the SDK Connectivity tool from the Applications view and select USB.

The SDK Connectivity tool displays the IP address and a generated password in the Connectivity Details view.

USB connection in SDK Connectivity tool

2. Connect the device to your host workstation with a USB cable, and select SDK mode from the list of operation modes displayed on the device.

The workstation establishes a new network interface called usb0. To bring up the interface, enter the following command:
sudo ifconfig usb0 192.168.2.14 up

3. To create an SSH connection to the device with the developer account, enter the following command in the host workstation terminal:

ssh developer@192.168.2.15

4. Enter the password for the 'developer' user name as shown in the Connectivity Details view of the SDK Connectivity tool.

Copying files between the host workstation and the device

The most convenient way to transfer files to and from the connected device, is to use the scp command with the developer account.

To copy a file to the device, enter the following command:

scp SourceFile developer@192.168.2.15:/<path>/

To copy a file from the device, enter the following command:

scp developer@192.168.2.15:/<path>/SourceFile .

Note: Enter both commands on the host workstation.

Setting up internet access through the host workstation

To access the internet from the device, it may be convenient to do so through the host workstation instead of the WLAN interface of the device. This requires actions both on the device side and on the host workstation side.

Setting up on the device side

The DNS settings need to be identical on the device and host workstation. They are set in the /etc/resolv.conf file. Copy the list of nameservers and domains from your workstation onto the resolv.conf file on the device. Note that this is a critical file and editing it requires root privileges. It is also recommended that you create a backup file. For more information on using the root account, see Activating developer mode.

To copy the resolv.conf file to the device, enter the following command on host side:

scp /etc/resolv.conf developer@192.168.2.15:/<path>/

On the device terminal, enter the following command:

cp <path>/resolv.conf /etc

Make the host to be the default route to access the internet. Enter the following command on the device terminal:

devel-sh -c 'route add defalt gw 192.168.2.14'

Setting up on the host workstation side

To set up masquerading and IP forwarding, which allows you to access the outside world from your Harmattan device, enter the following commands:

sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo su
echo "1" > /proc/sys/net/ipv4/ip_forward
exit