AirDroid, a handy Android app for managing your phone from Linux

AirDroid

In a previous article I explained how I installed and used the Windows application MyPhoneExplorer in WINE to manage the phone book (contacts list) in my HTC Desire mobile phone. Well, today I found out about AirDroid, a clever and useful Android application that can do the same thing, as well as the other tasks that MyPhoneExplorer can do, such as transfer files between my laptop and my phone, typing SMS on the laptop to send from the phone, and so on.

Last week I bought a Samsung Galaxy Note II and I needed to transfer a lot of large PDF files from my laptop to the new phone. Now, with my HTC Desire I could simply connect the phone to my laptop with a USB cable, mount the phone in KDE as a storage device, and drag the files across from one Dolphin file manager window to another. But the Samsung phone uses MTP for file transfers and, when the phone is connected to my laptop with a USB cable I can browse the phone’s file directories in Dolphin, but I cannot copy files from the laptop to the phone. Applications that use MTP for file transfer do exist for Windows and OS X (in fact Samsung provides Kies for this purpose), but my laptop runs Linux. I had not got around to installing the latest version (1.8.4) of MyPhoneExplorer to check if it works with the HTC Desire, let alone with a Samsung phone. So I searched the Web to see if there was a Linux application that uses MTP for general file transfer (i.e. not one of the dedicated music players in Linux that do support MTP for transferring music files only).

And that is how I learned about AirDroid, which allows you to “wirelessly manage your Android from your favourite browser.” The AirDroid Web site and the Android Play Store page for AirDroid explain the features of the application and both have a video showing it in operation.

From the AirDroid Web site:

What is AirDroid?

AirDroid is a fast, free app that lets you wirelessly manage & control your Android devices (phone & tablet) from a web browser. It’s designed with the vision to bridge the gap between your Android device and web browser, on desktop computers or tablet devices, on Windows, Mac/iOS, or Linux.

What can I do with AirDroid?

You can use AirDroid to send/receive SMS (text messages, if supported by the device), install/uninstall apps, transfer files between Android device and computer/tablet, and manage contacts, photos, music, videos, and ringtones, etc., all in a web browser. Install AirDroid on your Android device and open your favorite web browser to experience it yourself.

I immediately used Play Store on my phone to install AirDroid. I launched AirDroid, launched Firefox on my laptop and opened http://web.airdroid.com/, and was able to connect the laptop and phone quickly and easily. I block-selected the eighty files in the Dolphin window that I wanted to copy to the phone and dragged them to the phone’s Download directory window in the Firefox window. One by one the files were copied to the phone, with a little progress bar against each one. However, for some reason a few of the files were not copied so I dragged those across individually after the copying of the others had completed.

AirDroid in Firefox on my laptop

AirDroid in Firefox on my laptop

The above snapshot of my laptop’s screen shows the AirDroid desktop inside the maximised Firefox window. The window with the yellow folder icons inside it is actually an AirDroid window which I opened by clicking on the blue folder named ‘Files’ on the left side of the AirDroid desktop. These windows can be dragged around the AirDroid desktop in the browser window, and can even be resized.

A connection problem, and a solution

When I tried to connect the phone and laptop again later, an error message was displayed in the browser window on the laptop:

Failed to connect. Make sure your device is connected to a same WiFi network.

I was sure that the two devices were on the same WiFi network but, no matter what I tried, I could not get the laptop and phone to connect again. I looked through the AirDroid forums and found a thread indicating that this is a common problem.

Some users who posted in that thread were able to connect after they disabled the firewall on the PC, and others were able to connect by deleting the cookies in the browser. However, I think the fundamental cause of the problem is IPTables in Android Jelly Bean (see this comment). Anyway, taking all these factors into consideration, here is the way I got around the problem when it occurred:

On the laptop

1. Make sure the firewall is disabled.

As I use UFW on my laptop, all I need to do is:

# ufw disable

2. Launch Firefox and delete all cookies.

3. Open http://web.airdroid.com/

On the phone

1. Power down the phone, then power it up again.

2. Disable ‘Mobile data’ so that the phone cannot connect to the Internet via the mobile network, only via WiFi.

3. Enable WiFi.

4. Launch AirDroid.

From then on use AirDroid as usual, i.e. click on ‘Start’ and then either click on the camera icon and point the camera at the QR Code on the AirDroid page in the brower window or type the 6-character passcode displayed on the phone in the passcode box in the browser window and click ‘Login’.

That’s it!

AirDroid is a novel and useful application that now enables me to manage my Android phone from within Linux without needing to use WINE. Nice! 🙂

(My thanks to Gentoo Forums user Q-collective in the thread [Workaround] Syncing Galaxy S3: What mediaplayer is capable? for mentioning AirDroid, otherwise I would never have known about it.)

EDIT November 5, 2012: I have used AirDroid on my home network and a public network, both using DHCP, not static IP addresses. I think AirDroid does not work if you use static IP addressing, so if you still run into trouble after following all the steps listed above, also check if you have a static IP address specified in the phone and router, and set them to use dynamic IP addressing instead.

EDIT November 26, 2012: Apparently some people — even those using static IP addresses — can get AirDroid working in their home network simply by rebooting their home router, so that’s something else you could try.

Evaluating Sabayon Linux Xfce

Sabayon Linux Xfce on Acer Aspire 5920

EDIT (January 18, 2014): This article refers to an installation of Sabayon Linux from the Version 10 ISO, when the distribution still used OpenRC as the init system, rather than systemd. Therefore some of the commands in this article are no longer applicable to the current versions of the distribution using systemd.

The last time I installed SL (Sabayon Linux) on one of my own machines was 18 months ago, and that was my media centre. I haven’t touched that installation since: “If it ain’t broke, don’t fix it.” My most recent desktop SL installation was on a relative’s Acer Aspire 5738 laptop just over a year ago, but it was disappointing. In the end I did get SL working with the laptop’s NVIDIA GPU but, amongst other things, ALSA didn’t work correctly and even I couldn’t fix it. The owner was understandably unimpressed with SL and ended up installing Ubuntu over it, which worked perfectly out of the box.

Since then I have not used SL much apart from occasionally booting an ISO image of the latest SL LiveDVD in VirtualBox on my main laptop running Gentoo, or on the family PC running Windows Vista. So I was keen to try a recent edition of SL, and the opportunity arose this week as I had to replace an Acer Aspire 5920 laptop belonging to a family member and I thought it would be interesting to install SL Xfce Edition on it. (I bought a Samsung NP350V5C laptop to replace it, if you’re interested.)

That Acer Aspire laptop is 4 years old and had been causing a lot of hassle: a hardware design fault made the display flicker, and Windows Vista often refused to connect via WiFi to my home network. A quick search of the Web turns up plenty of complaints about these two problems with this particular Acer model. Oh, and one more thing, Windows Vista was unbelievably slow on the laptop. You really could go and make a cup of coffee in the time it took to boot.

I got a local PC repair shop to look at the ribbon cable in the lid that is known to cause the flickering display, and decided to wipe the HDD (good riddance, Vista) and install SL 10 64-bit Xfce. Below I list the laptop’s specification.

– Acer Aspire 5920-5A2G25Mi
– 15.4″ (1280 x 800)
– 250 GB SATA HDD
– Intel Core 2 Duo T5550 1.83 GHz
– 2GB DDR2 RAM
– Intel Mobile GM965/GL960 Integrated Graphics Controller with Intel Graphics Media Accelerator X3100 with up to 358 MB Shared Graphics
– Intel 82801H HD Audio Controller
– Broadcom Netlink BCM5787M Gigabit Ethernet PCIe
– Intel PRO/Wireless 3945ABG
– Ricoh RSC832 IEEE 1394 Firewire Controller
– Ricoh R5C822 SD/SDIO/MMC/MS/MSPro Adapter
– Ricoh R5C843 MMC Host Controller
– Ricoh RSC592 Memory Stick Bus Host Adapter
– Ricoh xD-Picture Card Controller
– Suyin Corp. Acer CrystalEye Webcam (0.3 Megapixels)
– CD/DVD reader/writer
– 4 USB2 ports
– 56K ITU V.92 modem port

This model has a Bluetooth button but does not have Bluetooth hardware installed. The Bluetooth button can be configured for other purposes, as I discovered after installing SL.

I downloaded the file Sabayon_Linux_10_amd64_Xfce.iso from the SL Download page, and used UNetbootin version 581 to create a LivePenDrive on a 4GB pen drive. I inserted the pen drive into the Aspire, booted, pressed F2 to get to the BIOS menu, configured the BIOS to boot the pen drive, and rebooted.

The SL Live environment loaded without problem and I was able to access my home network via WiFi with ease.

I launched the SL installer and was pleasantly surprised to see that it is more polished that the version I used a year ago. However, over the years I have found that the SL Installer often crashes when it tries to partition the HDD, and the same thing occurred this time. Normally when this happens I boot up a SystemRescueCd LiveCD and use GParted to partition the HDD and format the partitions, then I reboot the SL LiveDVD and re-run the Installer, which then works. This time, however, I just decided to open a Terminal window from the SL Live environment and use the fdisk command to create the partitions manually. Then I re-ran the SL Installer. I was now able to specify the mount points for the partitions and format them, and installation was completed quickly.

I booted the HDD and was pleasantly surprised. Almost everything worked ‘out of the box’ (including the memory card slot), and the overall impression was of a polished distribution with an attractive Xfce desktop. SL looks great on the laptop’s relatively low resolution 1280×800 screen, and I suspect the Infinality patches make a difference. Most of the applications I needed were already installed, to make life easier. Apart from the positive impression aesthetically, I am very impressed with the speed at which it runs. This is one of the snappiest Linux installations I have used.

I did need to perform a few tweaks, and I’ll mention the main ones throughout the remainder of this article.

As SL is a rolling distribution I wanted to bring the installation bang up to date, so I used the usual Entropy commands in a Terminal window:

$ su
Password:
# equo update && equo upgrade && equo conf update

I did not need to upgrade the kernel using the SL kernel-switcher utility, as the version of the latest kernel in the SL Entropy Weekly repository was the same as the version installed by the LiveDVD.

Tapping on the touchpad didn’t work out of the box, but all I had to do was configure it using Xfce’s ‘Applications Menu’ > Settings > ‘Mouse and Touchpad’ > Touchpad (tick ‘Tap touchpad to click’).

Although the Uncomplicated Firewall was installed, a front-end wasn’t, so I installed UFW Frontends:

# equo install ufw-frontends

I launched ufw-gtk (Firewall Manager) and configured UFW as explained in How to config ufw/ufw-frontends for Samba browsing/printing.

Xfce has some useful plugins and utilities, so I installed some of those:

# equo install xfce4-power-manager xfce4-sensors-plugin xarchiver xfce4-battery-plugin thunar-volman xfburn tumbler

A calculator is always handy too:

# equo install galculator

The system clock was not displaying the correct time (it was one hour ahead of actual time) so I followed the SL Wiki article HOWTO: Clock, Time, UTC, Dual boot with Windows and then used the Linux date command to set the correct date and time:

# date MMDDhhmm

OPTIONAL: To keep the system clock in sync with a remote time server when the laptop is connected to the internet, I installed the package net-misc/ntp:

# equo install ntp

and then edited the file /etc/conf.d/ntpd so it contains NTPD_OPTS="-g" and I added the initscripts for NTP Client (executes once at start up) and the NTP daemon (runs continuously) to the default runlevel:

# rc-update add ntpd default
# rc-update add ntp-client default

The SL Xfce Edition LiveDVD installs the Midori Web browser which is lightweight and good, but not as good as Firefox, my favourite browser, so I replaced Midori with Firefox:

# equo remove midori
# equo install firefox

I found that the film trailers on the iTunes Movie Trailers Web site would not play in the browser, so I installed gecko-mediaplayer and gnome-mplayer (and used Edit > Preferences > Player to set ‘Video Output’ to gl for OpenGL or xv for XVideo) and I disabled the Totem plugin in Firefox (Add-ons > Plugins and disable ‘QuickTime Plug-in 7.6.6 The Totem 3.4.3 plugin handles video and audio streams.’) which solved the problem. An earlier blog post of mine also mentions this: Playing QuickTime videos in Firefox and Chromium + XVideo bug in AMD Catalyst 11.11 and 11.12 driver.

As the volume control thumb wheel on the laptop did not work in SL, I used Xfce’s Settings > Keyboard to configure the two unallocated function keys F9 and F10 to be Decrease Volume and Increase Volume, respectively:

amixer set Master 5%- allocated to F9
amixer set Master 5%+ allocated to F10

and I allocated F8 as the Mute button, as it already had a symbol for that printed on it:

amixer set Master toggle

Sound quality is excellent.

I installed Skype:

# equo install skype emul-linux-x86-medialibs

which works well apart from the video image from the laptop’s Acer CrystalEye Webcam (310,000 pixels, circa 640×480), which has flickering blue horizontal lines. I installed GUVCView, a GUI to configure the uvcvideo driver module.

# equo install guvcview

My adjustments using GUVCView helped slightly, but the image quality is still not great. The image is just about tolerable when the subject is illuminated by daylight, but poor in artificial light. Searching the Web tells me that plenty of Windows users have had problems with this model of Webcam too.

I wanted to be able to access computers running Windows on my home network, and to be able to print on printers connected via USB to those computers, so I added SAMBA to the default runlevel so that it would be started automatically when the laptop boots:

# rc-update add samba default

I also edited the configuration file /etc/samba/smb.conf to be as follows:

[global]
netbios name = Aspire5920
message command = /usr/bin/linpopup "%f" "%m" %s; rm %s
printcap name = cups
printing = cups
printer admin = @adm
log file = /var/log/samba/log.%m
max log size = 50
map to guest = bad user
security = user
encrypt passwords = yes
smb passwd file = /etc/samba/private/smbpasswd
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
name resolve order = wins lmhosts bcast
wins support = yes
dns proxy = no

[homes]
comment = Home Directories
read only = no

[netlogon]
comment = Network Logon Service
path = /var/lib/samba/netlogon
guest ok = yes

[printers]
comment = All Printers
path = /var/spool/samba
guest ok = yes
printable = yes
create mask = 0700
print command = lpr-cups -P %p -o raw %s -r   # using client side printer drivers.

[print$]
path = /var/lib/samba/printers
write list = @adm root
guest ok = yes

[PUBLIC]
path = /home/fitzcarraldo/Public/
guest ok = yes
read only = no

I installed the drivers for two of my printers:

# equo install gutenprint

and used the CUPS browser interface http://localhost:631/ to configure CUPS to use a Canon PIXMA MP510 via SAMBA connected to a PC running Vista, and to use a Canon PIXMA MP560 on my home network via WiFi.

When configuring CUPS to use the Canon PIXMA MP510 printer connected to the family PC that is running Windows Vista, I had to specify the printer’s SMB address as follows:

smb://workgroup/username:password@hostname/printername

where username is the name of a user account on the Windows Vista PC, and password is the password of that user account.

For example, let’s say that I configured Windows Vista on the family PC some years ago as follows:

PC name: SA90

Work group name: WORKGROUP

Printer name: Canon_MP510_Printer

User name: Fitzcarraldo

User password: MollyAida

then the SMB address I would specify to the CUPS Manager for the printer would be:

smb://WORKGROUP/Fitzcarraldo:MollyAida@SA90/Canon_MP510_Printer

I configured the Xfce top Panel to show the Xfce LCD brightness plugin, Xfce audio mixer, Xfce sensor plugin, Xfce battery monitor. By the way, Xfce Power Manager works correctly when the laptop is using its battery.

Xfce makes it easy to configure shortcut keys: ‘Applications Menu’ > Settings > Keyboard | ‘Application Shortcuts’. I configured the browser launch key on the left of the laptop’s main keyboard to launch Firefox. And, as I am used to launching Yakuaki in KDE using F12, I set up F12 in Xfce to run /usr/bin/terminal (I could instead have installed Guake and used Xfce’s ‘Applications Menu’ > ‘Session and Startup’ | ‘Application Autostart’ to configure Guake to launch automatically at start up).

Basically, almost everything works well.

Also, I installed superadduser and added another user successfully:

# equo install superadduser

Although the Xfce ALSA Mixer works fine, I installed PulseAudio Volume Control too:

# equo install pavucontrol

Actually you do need both an ALSA mixer and a PulseAudio mixer because you can get into the situation where the ALSA volumes are turned up but the PulseAudio volumes are turned down.

As I sometimes download YouTube videos for offline viewing, I installed the version of the excellent Python script youtube-dl that is in the SL Weekly repository:

# equo install youtube-dl

but it turned out to be the package net-misc/youtube-dl-2012.02.27, which wouldn’t download YouTube videos. I had to download the latest version of the script from the youtube-dl developer’s Web site, made it executable (chmod +x ~/youtube-dl) and copied it to the directory /usr/bin/ to overwrite the 2012.02.27 version installed via Entropy.

Thunar was taking a very long time to open the first time I launched it after each reboot, and was also launching twice. To stop this happening I edited the file /usr/share/gvfs/mounts/network.mount and changed AutoMount=false.

Furthermore, the following message sometimes appears in a pop-up window when launching Thunar:

Failed to open directory “fitzcarraldo”.
Error when getting information for file ‘/home/fitzcarraldo/.gvfs’: Transport endpoint is not connected.

Searching the Web indicated the following command might fix it:

# umount /home/fitzcarraldo/.gvfs

It seems to have helped, but the message does still appear sometimes.

One problem I experienced 18 months ago with the SL 5.4 E17 Edition — and I notice has been reported by several users in the SL Forums since then — is that SL does not always set up the user’s locale correctly. During installation I selected English as the language, the UK as my location and English (UK) for the keyboard, and ended up with the US locale:

# locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

What I want is the British locale. I rectified it by following Steps 3, 4 and 5 in the SL Forums post Re: en_GB language missing after install.. I think the SL Installer probably needs modifying.

Summary

SL 10 Xfce is an attractive installation demonstrating a fair amount of attention to detail, but the Installer has some frustrating problems with partitioning and the set up of the locale. These problems have been present for quite some time now and could be ‘brick walls’ for newcomers to Linux.

I use Xfce in Gentoo on a legacy laptop (Pentium III) and so am familiar with it, but it looks great in SL and just seems that little bit more polished.

But the main impression I get from this installation is just how zippy and responsive it is. Video runs smoothly however fast I jiggle around a media player window, and we’re talking a relatively low-end graphics processor here, not an AMD or NVIDIA GPU. Applications open really fast. Overall, it’s a pleasure to use.

When I think back to how Windows Vista ran on this laptop, the difference is like night and day. It’s like having a new, more powerful laptop. I’ve now added a user account for my wife as she has decided she will use it. Not bad for a laptop I thought I would give to my local repair shop for spares.

Installing and using ZBar in Linux to scan bar codes with your Webcam

ZBar is an application that can scan and decode several bar code symbologies (including QR Code) from sources such as a Webcam or an image file. I had been wanting to install it for some time and was finally spurred on to do it by a request for help to get it working in the Sabayon Linux forums. Here are the steps I used.

1. I installed the package media-gfx/zbar-0.10-r1.
Note for Gentoo users: I merged the package with the imagemagick and v4l USE flags set, so that both zbarimg and zbarcam would be installed. If you only want to use ZBar with a Webcam then turn off the imagemagick flag and zbarimg will not be installed.
Note for Sabayon Linux users: The Entropy package was built with both the above-mentioned USE flags set, so zbarimg and zbarcam will be installed.

2. Then I checked the status of the installed package by using the Portage eix command:

$ eix -I zbar
[I] media-gfx/zbar
Available versions: (~)0.10-r1 {{X gtk imagemagick jpeg python qt4 static-libs +threads v4l xv}}
Installed versions: 0.10-r1(03:56:14 05/10/12)(X gtk imagemagick jpeg qt4 threads v4l xv -python -static-libs)
Homepage: http://zbar.sourceforge.net/
Description: Library and tools for reading barcodes from images or video

Sabayon Linux users could instead use the following command:

$ equo search --verbose zbar

3. Then I checked which video device my laptop’s inbuilt Webcam is:

$ ls /dev/video*
/dev/video0

4. As it is /dev/video0, I launched zbarcam as follows:

$ zbarcam --raw /dev/video0
WARNING: no compatible input to output format
...trying again with output disabled
ERROR: zbar processor in zbar_processor_init():
unsupported request: no compatible image format

Clearly zbarcam was not recognising the Webcam.

5. As I had installed the package with the Video4Linux USE flag set, I then launched zbarcam with the following prefix:

$ LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so zbarcam --raw /dev/video0

The ZBar GUI window popped up and I could see myself in the window. So far, so good.

6. I held a QR Code 2D bar code in front of the Webcam, then held a 1D Interleaved 2 of 5 bar code in front of the Webcam. The following was displayed:

$ LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so zbarcam --raw /dev/video0
http://roho.it/mryt
0161223563

Both the QR Code and the I2of5 bar code were read correctly. If the --raw parameter is omitted then zbarcam displays the symbology of the bar code too:

$ LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so zbarcam /dev/video0
QR-Code:http://roho.it/mryt
I2/5:0161223563

7. Then I tried using ZBar to read a bar code which I had previously saved as a .jpg file:

$ zbarimg --raw ~/zebra04.jpg
01234565
scanned 1 barcode symbols from 1 images in 0.04 seconds

$ zbarimg ~/zebra04.jpg
EAN-8:01234565
scanned 1 barcode symbols from 1 images in 0.04 seconds

To find out the other parameters available, use the commands:

$ man zbarcam
$ zbarcam --help
$ man zbarimg
$ zbarimg --help

ZBar is a nice tool. 😎