Documentation/Maemo PC Connectivity Tutorial/Configuration

Contents

[edit] Connection Establishment

On a Maemo device, connections can be easily configured using Maemo PC Connectivity applets. It is possible to configure a Maemo device to use USB, Bluetooth and WLAN connection types.

USB connection type sets a USB mode (Network, Mass Storage or Host) to be used between a Maemo device and a host PC.

Bluetooth connection type sets a Bluetooth network over TCP/IP between a Maemo device and a host PC.

WLAN connection type sets a WLAN ad-hoc network between a Maemo device and a host PC.

On the host PC side (Linux, Windows and Mac OS X), the Host PC Connectivity product provides some tools to make it easier to configure the chosen connection type between the Maemo device and the host PC. Next the configuration of each supported connection type (USB, Bluetooth and WLAN) between the Maemo device and host PC are described briefly.

[edit] Configuring USB Network

For Maemo Diablo devices, the USB connection has been configured to Mass storage mode by default. That is, when connected to a host PC via USB cable, the Maemo device is visible as a memory card for the host PC.

For Fremantle, when a Maemo device is connected to the host PC via USB cable, the Maemo device shows a default pop-up menu where the USB mode can be selected. the choices given are Mass storage or PC Suite mode. You must NOT use this default USB pop-up menu if you have installed Maemo PC Connectivity to the N900 device! Just click outside this default USB pop-up menu to close it and use Maemo PC Connectivity widgets to change the USB mode.

File:Dialog-information.png Note: With the Maemo Fremantle platform and N900 device, if Maemo PC Connectivity has been installed, the USB connection is used in a different way beyond the default Mass storage and PC Suite modes and thus ONLY Maemo PC Connectivity applets can be used to change the USB mode for the Maemo N900 device.

For USB connection type it is possible to set following options for a Maemo device:

Network
sets a USB network over TCP/IP between the Maemo device and host PC.
Mass storage
sets the Maemo device file system to be accessible from the host PC as a memory card.
PC Suite
sets the Maemo device to be accessible by Nokia applications like Nokia PC Suite.
Host
sets the Maemo device to USB Host mode, where it allows external USB devices (such as hard drives, digital cameras, card readers, input devices, and so on) to be connected to the Maemo device, just like to a regular PC.
File:Dialog-information.png Note: Maemo Diablo N800 and N810 devices do not support PC Suite mode. Due to hardware limitations, Maemo Fremantle device N900 does not support USB Host mode.

The description of how to setup a USB connection to Mass storage, PC Suite and Host modes is skipped, since the configuration is simply to select and apply the desired mode on a Maemo device using Maemo PC Connectivity. Next, it is explained how to configure a USB network over TCP/IP between a Maemo device and host PC through Maemo PC Connectivity. Before that, you must install the maemo-pc-connectivity meta package on the Maemo device and the host-pc-connectivity package on the host PC (Linux, Windows and Mac OS).

[edit] Configuring USB for Maemo devices

To set up a USB network for a Maemo device you need to start PC Connectivity Manager, figure 3.1.


Figure 3.1: PC Connectivity Manager

File:Mpc maemo nm usb basic.png

Follow these steps to enable USB Networking:

  1. Disconnect the USB cable from Maemo device
  2. Run Settings - Control Panel - Connectivity - PC Connectivity Manager
  3. Check USB option
  4. Press Apply button
  5. Connect the USB cable to the host PC.
  6. Press the Advanced button and PC Connectivity Manager switches to advanced mode, if you want to change the default values.
  7. Change network options such as DHCP Server, IP address, Gateway and Netmask.
  8. Click on the Apply button.

The USB Networking must have the following default values, figure 3.2.

Figure 3.2: PC Connectivity Manager USB Networking

File:Mpc maemo nm usb.png

  • DHCP Server: enabled
  • IP address: 192.168.2.15
  • Gateway: 192.168.2.14
  • Netmask: 255.255.255.0

Once you have configured your USB Network using PC Connectivity Manager, you can enable or disable it easily by using Connection Switcher from the status bar, figure 3.3.

Figure 3.3: Connection Switcher dialog

File:Mpc maemo switcher usb.png

If you prefer, you can follow the steps below to configure USB Network manually for a Maemo device (Diablo):

  • Run Utilities - X Terminal
  • Type sudo gainroot
  • Type insmod /mnt/initfs/lib/modules/2.6.21-omap1/g_ether.ko
  • Edit the /etc/network/interfaces file to configure the IP address of the usb0 interface:

The /etc/network/interfaces file should have following entries in it:

auto usb0
iface usb0 inet static
address 192.168.2.15
netmask 255.255.255.0
  • Type ifup usb0
  • Plug in the USB cable

To disable USB Network manually on a Maemo device (Diablo), follow these steps:

  • Run Utilities - X Terminal
  • Type sudo gainroot
  • Type ifdown usb0
  • Type rmmod g_ether

[edit] Configuring USB for Linux

If you install the host-pc-connectivity package, your Linux host PC is ready for USB Network.

Otherwise, you can configure your Linux host PC manually following the steps below:

On Ubuntu, you need to edit the /etc/udev/rules.d/85-ifupdown.rules file and replace the following line:

SUBSYSTEM=="net", DRIVERS=="?*", GOTO="net_start"

with this line:

SUBSYSTEM=="net", GOTO="net_start"

If this workaround is not done, the usb0 interface does not get its IP address back when you unplug and plug back the Maemo device to the host PC. Therefore, you must restart the network manually with the command /etc/init.d/networking restart to get the usb0 IP address back. This is a known issue on Ubuntu (see the related bug report here).

On Debian, this workaround is not needed.

Add the following lines to the network configuration file /etc/network/interfaces:

auto usb0
allow-hotplug usb0

mapping hotplug
script grep
map usb0

iface usb0 inet dhcp
up iptables -t nat -A POSTROUTING -s 192.168.2.15 -j MASQUERADE
up echo 1 > /proc/sys/net/ipv4/ip_forward
down iptables -t nat -D POSTROUTING -s 192.168.2.15 -j MASQUERADE
down echo 0 > /proc/sys/net/ipv4/ip_forward

You can now connect the USB cable. With this configuration, you ensure that the ifup usb0 command sets up the IP address correctly on the host PC since it is using DHCP. Also, it allows a Maemo device to access the Internet from the host PC through the usb0 interface.

If you are using VMware:

  • Connect USB cable.
  • Go to VMware - Devices - Netchip RNDIS/Ethernet Gadget and click on the Connect (Disconnect from host) option. If VMware hangs, unplug the USB cable and wait for a short period of time. You get two device in use error messages, one from Native OS and another from VMware (likely because of automatic USB Mass Storage mode).
  • Connect the USB cable. Repeat the previous steps if any problems are encountered.

Invoke the sudo ifdown usb0 and sudo ifup usb0 commands. The down/up sequence ensures that the host PC attempts to reconnect the usb0 interface.

If this results in a lot of Failed to bring up usb0 errors, try again a few times. There can be a delay until the host PC and Maemo device become aware of each other. If it does not succeed but no error message is displayed, you can unplug and plug back the USB cable.

Test the usb0 connection with the following command ping 192.168.2.15

If you do not get the ping working, try again a few times. This can be an annoying process, especially in VMware where the USB connection may be automatically configured to Mass Storage mode every time you plug the USB cable into the host PC. It may even require restarting VMware in some cases.

[edit] Configuring USB for Windows

In order to get USB Networking functioning between a Windows host PC and a Diablo Maemo device, you must replace the original Diablo kernel with a new one that fixes some generic Linux USB Networking issues.

To replace the Diablo kernel, follow these steps:

$ flasher-3.5 -k diablo_kernel_usbnet_windows/zImage -f -R

Now, you can get USB Network working between a Diablo Maemo device and a Windows host PC.

File:Dialog-information.png Note: On Fremantle and the N900 device this kernel fix has already been applied by default.

After reflashing the kernel to the Maemo Diablo device and installing the PC-Connectivity.exe package to the host PC, your Windows host PC is ready for USB Network. That is, Windows detects and configures the Maemo device automatically when you plug in the USB cable. Remember to activate USB Network on your Maemo device before plugging the cable into the Windows host PC.

If you did not enable the DHCP option for the Maemo device, you need to configure the USB Network address for the host PC through the application available on the Windows Start menu Start - Programs - PC-Connectivity - UsbNetworking, figure 3.4.

Figure 3.4: USB Network address on Windows

File:Mpc win usb app.png

If you do not install the PC-Connectivity package, you have to configure the USB network manually on your Windows host PC. For that, you must follow the steps below:

  • Activate USB Network on the Maemo device.
  • Plug in the USB cable between the Maemo device and the Windows host PC.
  • Windows detects the device.

In the Found New Hardware Wizard, figure 3.5, proceed as follows:

Figure 3.5: Windows Found New Hardware Wizard

File:Mpc win usb device found.png

  • Select the No, not this time option. Click on the Next button, figure 3.5.
  • Select the Install from a list or specific location (Advanced) option. Click on the Next button.
  • Select the Don't search, I will choose the driver to install option.
  • Click on the Next button, figure 3.6.
  • Select the Network adapters option. Click on the next button (optional screen).
  • Select the Have disk option. Then, Click on the Browser button, select the driver (.inf file) and click on the OK button. The driver is available inside the zip file that was used to fix the Diablo kernel (diablo_kernel_usbnet_patch_windows_v0.4.zip).
  • Follow the next steps as with a normal driver installation.

The new USB Network interface is available on the Start - Network Connections menu.

Figure 3.6: Windows Search and Installation options for USB

File:Mpc win usb choose driver.png

File:Dialog-information.png Note: If you did NOT choose the DHCP option on the Maemo device, you need to set up the network using the following information: IP address: 192.168.2.14 Subnet mask: 255.255.255.0, figure 3.7.

To check if the connection is working, go to Windows command prompt and type ping 192.168.2.15.

Figure 3.7: Manual IP Network configuration dialog for USB

File:Mpc win usb tcp.png

[edit] Configuring USB for Mac OS X

To enable USB Network to work on Mac OS X you can follow these steps:

  • Activate USB network on the Maemo device.
  • Plug in the USB cable between Maemo device and the Mac OS X host PC.
  • The following pop-up should appear, figure 3.8.
  • Click on the Network Preferences button.
  • Click on the Apply button. Now, you should be able to connect to your Maemo device.
Figure 3.8: New network interface found pop-up dialog

File:Mpc mac usb pop up.png

File:Dialog-information.png Note: If you did not choose the DHCP option on the Maemo device, you need to set up the USB network address manually on Network panel. For example, IP address: 192.168.2.14 Subnet mask: 255.255.255.0, figure 3.9.
Figure 3.9: Network panel configuration dialog

File:Mpc mac usb tcp properties.png

[edit] Configuring Bluetooth Network

With Maemo PC Connectivity, you can configure a Bluetooth network between a Maemo device and a host PC by setting up connection attributes like IP address, network mask, and so on. For that, you have to first install Maemo PC Connectivity to the Maemo device and Host PC Connectivity to the host PC (Linux, Windows or Mac OS X).

[edit] Configuring Bluetooth for Maemo device

In order to set up a Bluetooth network for a Maemo device, you should follow these steps:

  • Run Settings - Control Panel - Connectivity - PC Connectivity Manager.
  • Click on the Advanced button.
  • Select an environment or create a new one.
  • Select the Bluetooth option as shown in Figure 3.10.
  • Click on Search to find the host PC.
  • Once the host PC is found, mark its name and then click Select, figure 3.11.
  • The default settings are presented below, you can change them if needed.
  • Finally, click on Apply to enable the Bluetooth network.
Figure 3.10: PC Connectivity Manager Bluetooth configuration

File:Mpc maemo nm bluetooth.png

Default values for Maemo device Bluetooth configuration are:

  • DHCP Server: enabled
  • IP address: 192.168.3.15
  • Gateway: 192.168.3.14
  • Netmask: 255.255.255.0
  • Bluetooth address: empty (you should search the host PC to connect to), figure 3.11.
Figure 3.11: Searching Bluetooth devices dialog

File:Mpc maemo nm bluetooth search.png

Once you have configured your Bluetooth Network using PC Connectivity Manager, you can enable or disable it easily by using Connection Switcher from the status bar, figure 3.12.

Figure 3.12: Connection Switcher dialog

File:Mpc maemo switcher bluetooth.png

[edit] Configuring Bluetooth for Linux

After you have installed the host-pc-connectivity package for your Linux host PC, it is ready for the Bluetooth network.

Or you can configure your Linux host PC manually for Bluetooth following the steps given below.

Add these lines to the file /etc/network/interfaces:

auto bnep0
iface bnep0 inet dhcp
up iptables -t nat -A POSTROUTING -s 192.168.3.15 -j MASQUERADE
up echo 1 > /proc/sys/net/ipv4/ip_forward
down iptables -t nat -D POSTROUTING -s 192.168.3.15 -j MASQUERADE
down echo 0 > /proc/sys/net/ipv4/ip_forward

Edit the file /etc/default/bluetooth and change these lines:

BLUETOOTH_ENABLED=1
...
PAND_ENABLED=1
...
PAND_OPTIONS="-listen -role=NAP -e bnep0"

Restart the Bluetooth service with the command:

$ sudo /etc/init.d/bluetooth restart

Now your Linux host PC is ready for the Bluetooth network.

[edit] Configuring Bluetooth for Windows

The description of how to configure Bluetooth on a Windows host PC is based on the BlueSoleil application. BlueSoleil is one of the most popular Windows Bluetooth applications. If you do not use BlueSoleil, the screenshots below can differ from what you see in your host PC, but they can help in understanding what you need to change on your Windows configuration.

You should follow the next steps to get the Bluetooth network configured in your Windows host PC (with BlueSoleil).

  • In the System tray, right click on the Bluetooth icon .
  • Select the Bluetooth Configuration option, figure 3.13.
  • In the Bluetooth Configuration dialog, select the Accessibility tab.
  • Check the Let other Bluetooth devices discover this computer option, figure 3.14.
  • In the Bluetooth Configuration dialog, select the Local Services tab.
  • Mark the Network Access service and click the Properties... button, figure 3.15.
  • If you want to share Internet over Bluetooth, select Allow other devices to access the Internet/LAN via this computer on the Select the type of the service to offer remote devices option.
  • Click on the Configure Network Adapter button, figure 3.16.
  • Double click on the Internet Protocol (TCP/IP) option, figure 3.17.
  • For all opened dialogs, press the OK button.
File:Dialog-information.png Note: If you did not choose the DHCP option on the Maemo device, type the following information for the network adapter: IP address: 192.168.3.14 Subnet mask: 255.255.255.0, figure 3.18
Figure 3.13: Bluetooth configuration menu

File:Mpc win bluetooth tray.png

Figure 3.14: Bluetooth Accessibility dialog

File:Mpc win bluetooth accessibility.png

Figure 3.15: Bluetooth Network Access entry

File:Mpc win bluetooth services.png

Figure 3.16: Bluetooth Properties dialog

File:Mpc win bluetooth properties.png

Figure 3.17: Bluetooth Network properties dialog

File:Mpc win bluetooth network.png

Figure 3.18: Network Adapter configuration dialog

File:Mpc win bluetooth tcp.png

[edit] Configuring Bluetooth for Mac OS X

After installing the PC-Connectivity package to the host PC, your Mac OS X is ready for the Bluetooth network.

Otherwise, you can configure your Mac OS host PC manually by following these steps.

  • Go to System Preferences and click on the Network icon, figure 3.19.
  • Add a new network interface, figure 3.20.
  • For the Interface field, select Bluetooth PAN type.
  • For the Service Name field, write the interface name, figure 3.21.
  • Press the Apply button.
File:Dialog-information.png Note: If you did not choose the DHCP option on the Maemo device, select the newly created Bluetooth PAN interface and use the Manually option in the Configure field. After that, type the following information: IP address: 192.168.3.14 Subnet mask: 255.255.255.0, figure 3.22
Figure 3.19: System Preferences dialog

File:Mpc mac bluetooth network preferences.png

Figure 3.20: Adding new network interface

File:Mpc mac bluetooth network add.png

Figure 3.21: Configuring new Bluetooth interface name

File:Mpc mac bluetooth network name.png

Figure 3.22: Configuring Bluetooth interface network

File:Mpc mac bluetooth network tcp.png

[edit] Configuring a WLAN ad-hoc Network

With Maemo PC Connectivity, you can configure a WLAN ad-hoc network for your Maemo device. You can set up connection attributes such as IP address, network mask, and so on.

[edit] Configuring WLAN ad-hoc for a Maemo device

To set up a WLAN ad-hoc network for your Maemo device, you need to perform the following configuration steps.

In Control Panel, open the PC Connectivity Manager widget, figure 3.23.

Figure 3.23: PC Connectivity Manager - basic mode

File:Mpc maemo nm wlan basic.png

Select the WLAN check-box and press the Apply button. A new WLAN ad-hoc connection is created with the following configuration:

  • DHCP Server: Enabled
  • IP Address: 192.168.4.14
  • Gateway: 192.168.4.15
  • Netmask: 255.255.255.0
  • Essid: devel_adhoc
  • WEP: key empty

If you want to change these default values, press the Advanced button, go to WLAN ad-hoc connection type and change the values. Then, press the Apply button, figure 3.24.

File:Dialog-information.png Note: By default, the WEP key is not used for new WLAN networks but for security reasons it is highly recommended to set also the wireless key.

The WEP key must have 5, 10 or 13 characters (For example: aaaaa).

Figure 3.24: PC Connectivity Manager - advanced mode

File:Mpc maemo nm wlan.png

Once you have configured your WLAN ad-hoc Network using PC Connectivity Manager, you can enable or disable it easily using Connection Switcher from the status bar, figure 3.25.

Figure 3.25: Connection Switcher dialog

File:Mpc maemo switcher wlan.png

[edit] Configuring WLAN ad-hoc for Linux

The iwconfig command is the configuration utility in Linux for WLAN interfaces. It is used to set the parameters of the network interface, which are specific to the wireless operation. The iwconfig command may also be used to display the parameters and the wireless network statistics. It extracts this information from the /proc/net/wireless file. By typing the iwconfig command without any arguments, it displays the current status of all wireless interfaces on the system.

To configure your host PC to connect with your Maemo device using a WLAN ad-hoc network, you should execute the following steps as root user:

$ ifconfig wlan0 up
$ iwconfig wlan0 mode Ad-Hoc
$ iwconfig wlan0 essid devel_adhoc
$ iwconfig wlan0 key off
File:Dialog-information.png Note: The example below disables the usage of wireless key, but for security reasons it is highly recommended to set also the wireless key.

To set the wireless key for your WLAN ad-hoc network, you should give the following command (using your own key value).

$ iwconfig wlan0 key 6161616161

You must use the same WEP key you used for Maemo device configuration, but as hexadecimal digits (for example, aaaaa is 6161616161 in hexadecimal).

[edit] Configuring WLAN ad-hoc for Windows

To set up a WLAN ad-hoc network that allows others computers to connect to your Windows host PC, follow these steps.

  • Connect your Maemo device to devel_adhoc.
  • In the System Tray, right click on the wireless icon. Select the View Available Wireless Networks option, figure 3.26.
  • The Wireless Network Connection window displays the devel_adhoc network on the list. If you do not see devel_adhoc, click Refresh network list in the upper left corner, figure 3.27.
  • Select devel_adhoc, and then click on the Connect button.
  • If you configured the WEP Key for your Maemo device, the Windows asks you to write that key at this point, figure 3.28.
Figure 3.26: View Available Wireless Networks menu

File:Mpc win wlan tray.png

Figure 3.27: Choose a wireless network dialog

File:Mpc win wlan selection.png

Figure 3.28: Wireless network key dialog

File:Mpc win wlan key.png

[edit] Configuring WLAN ad-hoc for Mac OS X

To configure a WLAN ad-hoc network for your Mac OS X host PC, follow these steps.

  • Connect your maemo device to devel_adhoc.
  • On the Menu Bar, click on the wireless icon and select the devel_adhoc network.
  • If you configured WEP Key for your Maemo device, the Mac OS X asks you to write that key at this point.
  • The wireless icon should change to inform that it is now connected.

[edit] Using Configuration Environments

With Maemo PC Connectivity, it is possible to use configuration environments for your Maemo device. For example, you can create an environment named Home that has the USB connection and the NFS disk mounts configured, and an environment named Office that has the WLAN connection and the SBRSH tool configured. When you are at home you can select a Home environment for your Maemo device and all previously stored connection and tool configurations in the Home environment are restored for your Maemo device.

To create or modify new configuration environments for your Maemo device you need to launch the Environment Manager widget, figure 3.29.

Figure 3.29: Environment Manager

File:Mpc maemo nm env create.png

To create a new environment you should follow these steps:

  • Run Settings - Control Panel - Connectivity - PC Connectivity Manager.
  • Click on the Advanced button.
  • Click on the ... button.
  • Click on the New button.
  • Set the environment name. For example, Home, and click on the Ok button.
  • Configure connections and tools to be used with this environment. For example, USB connection and NFS tool.
  • Click on the Save button.

After you have created new environments, you can switch between them using the Connection Switcher widget, figure 3.30.

Figure 3.30: Connection Switcher

File:Mpc maemo switcher env.png

To change between stored environments using Connection Switcher:

  • Run Connection Switcher from the status bar.
  • Select an environment.

All stored configuration information for the chosen environment are applied to the Maemo device.

Also, the PC Connectivity Manager widget can be used to switch between stored environments, figure 3.31.

Figure 3.31: PC Connectivity Manager - Basic mode

File:Mpc maemo nm env basic.png

  • Run Settings - Control Panel - Connectivity - PC Connectivity Manager.
  • Select an environment.
  • Click on the Apply button.

You can modify stored configuration environments with the PC Connectivity Manager widget in its Advanced mode, figure 3.32.

Figure 3.32: PC Connectivity Manager - Advanced mode

File:Mpc maemo nm env.png

  • Run Settings - Control Panel - Connectivity - PC Connectivity Manager.
  • Click on the Advanced button.
  • Change the environment configuration. For example, USB connection and/or X11VNC tool.
  • Click on the Apply button. All configurations, including changes, are saved and applied