In this blog I'll post news about Ubuntu, Linux, Android, my current hardware experiments, etc. Most of the posts will be some sort of mental notes which I think will be useful for others. Please be patient because it might take some time...

donderdag 24 februari 2011

Ubuntu and EasySMS (for android)

Introduction

When you are on your computer almost all the time it might be interesting to send sms messages using your computer. There is an application for Android that lets you do this. It is called EasySMS and is available in the Android market.

But it only gets useful if it's configured well. So I want to share my configuration. Important to note is that my configuration is for USB connections. As I prefer a USB connection to a WiFi connection.

Configuration on the phone

After installing the application from the market you can launch the application (you can choose free or paid version. The paid version obviously has some advantages and I bought it).When the application is launched you see a screen were you can set configuration options. Check the box before "Auto" underneath "Control of services Wifi/USB". Secondly you should set a port for Wifi/USB (mine is set to 2511 but you can choose any number higher than 1023). I have got the HTC Hero and my phone needs the checkbox before "Alt. send" to be checked. Normally you only have to check this if you notice that your messages don't get send.You can set other configurations as you wish.

Configuration of Ubuntu

This part will tell you how to make it possible to send SMS messages by just clicking one button. A requirement for your system is that you have the Android SDK somewhere on it. You can find the SDK on http://developer.android.com/sdk/index.html

First make an simple script "startUSBSMS.sh" with the following contents:#!/bin/sh$PATH_TO_ANDROID_SDK/tools/adb forward tcp:1977 tcp:2511google-chrome http://localhost:1977/

Of course you can use another browser by changing google-chrome to firefox or any other browser launching command. $PATH_TO_ANDROID_SDK must be changed to the android SDK folder containing the tools folder. It is important that the bold port numbers match and that the number in italics is the same as the port number that was chosen during the configuration of the phone. Finally you should make the script executable (chmod +x startUSBSMS.sh or using the properties window of the file)

Normally you can add a custom application launcher to one of your gnome panels. When creating this launcher you can select an icon and a command. The command is just the path to your script.

This might work for you but I had to do a little bit of extra work. Since my phone wasn't always connected with the right permissions I had to create some udev rules to make sure my phone was accessible. The udev rules should only be executed when you're phone is connected. One way to do this is to find out the VendorId corresponding with your phone. This can be done by executing lsusb WHEN YOUR PHONE IS CONNECTED VIA USB! it will give output of the different USB devices. Find the line corresponding to your phone. Normally every line has a description. Ee.g. I have a htc (=High Tech Corporation) Hero phone and output is:

Bus 002 Device 003: ID 0bb4:0c99 High Tech Computer Corp.

The number after ID and before the following colon will be the vendorid. Now we have got all the information to make the udev rules. Make a file /etc/udev/rules.d/50-android.rules with the following content:SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", RUN+="$PATH_TO_ANDROID_SDK/tools/adb start-server"

Finally execute sudo restart udev to make sure the rules are activated. After reconnecting your phone you should be able to use your SMS button!