Connect Firefox OS device to Arch Linux

Introduction

Firefox OS, what is that? If it’s your question, this article is probably not for you. You may take some information on Wikipedia.

Now, you know. So, Firefox OS (or Boot2Gecko or B2G) is developed in HTML5 (by HTML5, I mean HTML5+CSS3+ECMAScript/JS). This is a wonderful opportunity to develop new applications in a simple langage. However, to be able to do push applications on your new smartphone, you need to be able to connect it to your computer.

This article will explain how to connect a smartphone device (Geeksphone Revolution) running Firefox OS on an Arch Linux distribution. Since the connection is done through the Firefox browser, I will only consider version of the browser greater than 26.0 which allow the installation of the last Firefox OS simulator extension.

The steps

There is only a few steps to do. First of all, you will need to configure your smartphone to be able to connect it to the computer with a remote debugging. This article is only about a 1.3 version of Firefox OS, the steps may be different for an older version.

Then we will configure the computer. First of all, we need to configure the hardware part of the computer, then we will configure the software part.

The smartphone

For the smartphone, the configuration is pretty simple. You need to enable the remote debugging. Go into the Parameters menu and find Device Information > More Information > Developer. You should find a Remote debugging option. If it’s not enabled, check the checkbox.

You should also deactivate the screen locking in Parameters.

The computer

Hardware part

On the web, you’ll find a lot of website that tells you to install adb tool, even on the Mozilla website. However, it seems that this manipulation is not needed anymore with the last version of the debugging tools in Firefox browser. You can only install in your browser the ADB Helper extension. W’ll see this step in the next section.

However, you still need to configure udev to read your USB device. Edit a file into /etc/udev/rules.d/, for example 51-firefoxos.rules and put the following inside.

SUBSYSTEM=="usb", ATTR{idVendor}=="8087", ATTR{idProduct}=="0a16", MODE="0666"

You may check the idVendor of your device. First of all, plug it to your computer. Then use lsusb. If there is multiple lines, unplug it and type lsusb; one line should have disappear, it’s the one we are interested in. In the line, you should see something like the following.

Bus 001 Device 007: ID 8087:0a16 Intel Corp.

In the field 8087:0a16, 8087 is the idVendor. Save your rule and reload them with the following command (with root privileges).

udevadm control --reload-rules

The software part

First step in software part is installing last version of Firefox browser on your desktop (if it’s not already done)…​ Done? Ok, let’s continue.

You can now open the App Manager. You should find it under Tools > Web Developer > App Manager. At the bottom, you should find a Start Simulator button. Click on it. If a Firefox OS simulator is already installed, you can start it now and test a Firefox OS simulator. You may also add one (click on Add button and follow the instructions); but that’s not the subject of this article. We want to launch the remote debugging on the smartphone device.

When you clicked on the Add button above (if you didn’t, now you should!), you’ll see a link to install the simulators (a big green button with Install Simulator), at least at the day I’m writing this article. Click on it. It will propose you to install the simulators (but you already did it before) and an extensions called ADB Helper (remember, I already talked about it in the hardware part). Install it.

I think now you should see your connected device with a button next to the button to start the simulator. If not, try to restart your browser at least.

Possible errors

Get ???????????? in the App Manager

When you connect your smartphone device, the new button appearing in the App Manager you should display characters and numbers (for example, Clovertrail5B2040C1 in my case). However, at the beginning of my experimentations, it displayed ???????????? and I was unable to start the remote debugging.

If you have adb installed (see below), you also may try adb devices to see a similar result ???????????? no permissions. From what I understand, it’s mainly a authorization problem and depends only of the udev rule so trying to write correctly this rule should make your problem disappear. Looking for information about that on the web, you may find rules that adds (at the end of the line) OWNER or GROUP. Be careful to be the right user or in the right group if you use that.

Force reloading of udev rules

If the reloading of udev rules, you may try to force to reload your own rules with the following command (with root privileges).

udevadm trigger

Installing adb tools

I didn’t find a nice way to install adb tools. These are the 2 methods I found for Arch Linux.

Using yaourt

The simplest way is to install the package android-sdk-platform-tools. However, even if the package is highly ranked on AUR, I’m not really fond of installing package through yaourt.

Installing adb from Android website

You can download the Android Developer toolkit. This is an archive; uncompress it. However, they move the adb tool in this version of the toolkit (see tools/adb_has_moved.txt).

Considering the file ‘SDK README.txt’, you should launch tools/android from the root of the uncompress archive. You’ll see different packages you can install. Select Android SDK Platform-tools and install it.

If it’s not enough, you can also update the toolkit by running the following command from the root of the uncompress directory. However, it will download everything and more (around 10GB of data to download).

tools/android update sdk --no-ui

Now, you should have adb in platform-tools/adb.

To use it, try first this command when your smartphone device is plugged.

platform-tools/adb devices

If you have the error message ???????????? no permissions, then try the following (sometimes it works).

platform-tools/adb kill-server
platform-tools/adb devices

References

links

social