Monday, May 6, 2013

Disable auto-awake after suspend/hibernate under Linux ubuntu 12.04.2

I suffered a crazy problem in my Ubuntu that did not let my PC to hibernate or suspend. It seemed like the keyboard or the mouse had a hardware problem and after a suspend/hibernate gave mysteriously a command to to resume!

For long time I believed it was a hardware or BIOS setup issue... Please find below a workaround that solves the problem...

Why does my laptop resume immediately after suspend?
Suspend to RAM not working
HOW-TO:Enable Wake-On-Device for Ubuntu

According to these posts you may download (apt-get install) acpitool. After that you may issue the command "acpitool -w" to display status of your devices and "acpitool -W x" to toggle status to disabled. Below you can see my initial configuration and the changed one...


root@rodos:/home/konstantinos# acpitool -w
   Device S-state  Status   Sysfs node
  ---------------------------------------
  1. HUB0  S5 *disabled  pci:0000:00:0a.0
  2. XVR0  S5 *disabled  pci:0000:00:0b.0
  3. XVR1  S5 *disabled  pci:0000:00:0c.0
  4. XVR2  S5 *disabled  pci:0000:00:0d.0
  5. UAR1  S5 *disabled  pnp:00:09
  6. USB0  S4 *enabled   pci:0000:00:04.0
  7. USB2  S4 *enabled   pci:0000:00:04.1
  8. AZAD  S5 *disabled  pci:0000:00:09.0
  9. MMAC  S5 *disabled  pci:0000:00:0f.0

root@rodos:/home/konstantinos# acpitool -W 6
  Changed status for wakeup device #6 (USB0)

   Device S-state  Status   Sysfs node
  ---------------------------------------
  1. HUB0  S5 *disabled  pci:0000:00:0a.0
  2. XVR0  S5 *disabled  pci:0000:00:0b.0
  3. XVR1  S5 *disabled  pci:0000:00:0c.0
  4. XVR2  S5 *disabled  pci:0000:00:0d.0
  5. UAR1  S5 *disabled  pnp:00:09
  6. USB0  S4 *disabled  pci:0000:00:04.0
  7. USB2  S4 *enabled   pci:0000:00:04.1
  8. AZAD  S5 *disabled  pci:0000:00:09.0
  9. MMAC  S5 *disabled  pci:0000:00:0f.0

root@rodos:/home/konstantinos# acpitool -W 7
  Changed status for wakeup device #7 (USB2)

   Device S-state  Status   Sysfs node
  ---------------------------------------
  1. HUB0  S5 *disabled  pci:0000:00:0a.0
  2. XVR0  S5 *disabled  pci:0000:00:0b.0
  3. XVR1  S5 *disabled  pci:0000:00:0c.0
  4. XVR2  S5 *disabled  pci:0000:00:0d.0
  5. UAR1  S5 *disabled  pnp:00:09
  6. USB0  S4 *disabled  pci:0000:00:04.0
  7. USB2  S4 *disabled  pci:0000:00:04.1
  8. AZAD  S5 *disabled  pci:0000:00:09.0
  9. MMAC  S5 *disabled  pci:0000:00:0f.0

root@rodos:/home/konstantinos# acpitool -w
   Device S-state  Status   Sysfs node
  ---------------------------------------
  1. HUB0  S5 *disabled  pci:0000:00:0a.0
  2. XVR0  S5 *disabled  pci:0000:00:0b.0
  3. XVR1  S5 *disabled  pci:0000:00:0c.0
  4. XVR2  S5 *disabled  pci:0000:00:0d.0
  5. UAR1  S5 *disabled  pnp:00:09
  6. USB0  S4 *disabled  pci:0000:00:04.0
  7. USB2  S4 *disabled  pci:0000:00:04.1
  8. AZAD  S5 *disabled  pci:0000:00:09.0
  9. MMAC  S5 *disabled  pci:0000:00:0f.0

For a permanent solution you have to "sudo gedit /etc/rc.local":


#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Added by kmav

echo USB0 | sudo tee /proc/acpi/wakeup
echo USB2 | sudo tee /proc/acpi/wakeup

exit 0

All the above must be persived as a workaround: /proc/acpi/wakeup contains the list of devices that are enabled or disabled to wakeup the computer after a successful suspend (as explained in HOW-TO:Enable Wake-On-Device for Ubuntu) ... So, you (... I) cannot use anymore the keyboard or the mouse to resume power to your (my) system.

Resizing partitions in Linux Ubuntu

Resizing partitions in Linux is possible and effective task although very time consuming... Let's say that you have a disk /dev/sda with three partitions and no unused space:

Primary boot partition /dev/sda1 /boot size=190MB
Extended partition /dev/sda2 that is devided into:

  • Linux swap partition /dev/sda5
  • Linux root partition /dev/sda6
We want  to increase the size of the /boot partition by reducing the size of the root partition.

We need to create a Linux startup disk or download the Linux Ubuntu desktop Live CD iso from the Ubuntu site equiped with the gparted disk utility. Alternatively you may download the gparted live iso.

Because  /boot is included in the primary volume partition, you have to pay attention in the fact that after resizing/shrinking extended partition it is not possible to Move the Extended partition in the end of the volume (or move the empty space before  the extended partition!!! The task is accomplished with the steps below:
  1. Boot from the Live/Startup CD
  2. Run gparted
  3. Resize/shrink the last /dev/sda6 root partition as much as you wish in order to free space to transfer to your boot partition
  4. Move the /dev/sda6 root partition to the end of the volume
  5. Move the swap partition /dev/sda5 right before the /dev/sda6 partition with no empty space between them. Now the empty space was moved in the start of the extended partition /dev/sda2
  6. Resize the extended partition to free-up the unused space. Now the unused space was moved before the extended partition i.e. in the primary partition.
  7. Resize the primary boot partition to include the empty space
The whole process took about 4 to 5h for a 120Gb volume. It is a good practice to ensure that the power will be uninteruptible (e.g. using a UPS) or pray not to have a power outage during this procedure... Good luck!

Using upstart in Ubuntu linux

Use the following command to print a list of  the known jobs and instances and to output the status of each to standard output:

user@mycomputer:~$ initctl list
user@mycomputer 


The output is like the following:
...
smbd start/running, process 988
tty5 start/running, process 1260
failsafe stop/waiting
hybrid-gfx stop/waiting
modemmanager start/running, process 1091
rfkill-store stop/waiting
atd start/running, process 1461
dbus start/running, process 612
ecryptfs-utils-restore stop/waiting
failsafe-x stop/waiting
mounted-var stop/waiting
plymouth stop/waiting
resolvconf start/running

...


Let us check and change the status of the job/process mediatomb :


user@mycomputer:~$ ps -el |grep media

4 S 124 1878 1 0 80 0 - 30849 futex_ ? 00:00:00 mediatomb

user@mycomputer:~$ start mediatomb

start: Rejected send message, 1 matched rules; type="method_call", sender=":1.120" (uid=1000 pid=6722 comm="start mediatomb ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")

user@mycomputer:~$ sudo start mediatomb

start: Job is already running: mediatomb

user@mycomputer:~$ sudo status mediatomb

mediatomb start/running, process 1878

user@mycomputer:~$ sudo stop mediatomb

mediatomb stop/waiting

user@mycomputer:~$ ps -el |grep media

(no output displayed because there is no mediatomb process active!)

user@mycomputer:~$ sudo status mediatomb

mediatomb stop/waiting

user@mycomputer:~$ sudo start mediatomb

mediatomb start/running, process 6740

user@mycomputer:~$ ps -el |grep media

4 S 124 6740 1 2 80 0 - 30849 futex_ ? 00:00:00 mediatomb

Good reference articles are the following:
Upstart - Getting Started
What's the recommended way to enable / disable services?

Sunday, April 7, 2013

Maven to Android Integration

Follow these links:

http://code.google.com/p/maven-android-plugin/wiki/EclipseIntegration
http://code.google.com/p/maven-android-plugin/wiki/GettingStarted
http://code.google.com/a/eclipselabs.org/p/m2eclipse-android-integration/
https://github.com/akquinet/android-archetypes

Installation prcedure according to : http://rgladwell.github.io/m2e-android/

You can install the Android Connector for Maven via the Eclipse Marketplace. Select Help -> Eclipse Marketplace... and search for "android m2e".

Click the Install button next to the Android Configurator for M2E (Maven to eclipse) that appears and follow the path through the wizard dialog to install the plug-in and its dependencies (including the Android Development Toolkit and the Maven for Eclipse m2e plug-in). Accept the terms-and-conditions and click Finish. Once you restart your Eclipse workspace you should be ready to start using the Android Connector.

A) Existing Android project
If you already have an Android project please make sure you have created a POM for your project using version 3.0.0 or greater of the maven-android-plugin.
Then right-click on your project and select Configure -> Convert to Maven Project.

B) New Android project
If you are starting with a new project you can use the Maven Android archetypes to create Android projects completely within Eclipse:
  1. Create a new Maven Project (File -> New -> Project... then select Maven -> Maven Project).
  2. When prompted to Select Archetype click Add Archetype...
  3. In the dialog that appears enter "de.akquinet.android.archetypes" for Archetype Group Id.
  4. In Archetype Artifact Id enter "android-quickstart".
  5. In Archetype Version enter "1.0.8" and continue.
  6. When prompted enter your desired project group and artifact ID, version and, optionally, set the "platform" property for the Android version (defaults to '10').
  7. Click Finish

Saturday, April 6, 2013

ebook reader software

I work usually with heavy PDF files that are generated by scanned images (like old books etc.). I have used several mobile readers and I would suggest the following for each mobile OS in the order presented. I didn't find any adequate PDF reader for J2ME phones... However, for ePub format Albite Reader is great!
  1. iphone: 
    1. iBooks (PDF, epub, apple) 
    2. Stanza (PDF, epub) 
    3. Good Reader (PDF, Word, Excel, etc.)
  2. android: 
    1. Aldiko (epub, PDF)
    2. Adobe reader (PDF)
    3. FBReader
  3. java phones: 
    1. Albite Reader (for epub, txt, xhtml formats)

Music chromatic tuners for Android phones

You may find some fine free music chromatic tuners for Android smartphones by following the links below:


You may use these if you have to tune even complex string musical instruments (e.g. santur, dulcimer etc.) ...

Android Greek keyboard

You may find a good Greek keyboard application in URL Greek Keyboard.


Αφού το κατεβάσετε πρέπει

  1. Να το ενεργοποιήσετε πηγαίνοντας Ρυθμίσεις-Γλώσσα και πληκτρολόγιο, και τσεκάροντας την επιλογή "Greek Keyboard".
  2. Όταν είστε σε πεδίο που έχετε να εισάγετε κείμενο, κρατάτε πατημένο το πεδίο αυτό (long-pressing touch) και αλλάζετε input method επιλέγοντας και από εκεί το Greek Keyboard.