Ubuntu display bugs

Two weeks ago I have upgraded my laptop by replacing the HDD with an SSD and I can say that the improvement is massive. Everything feels very snappy and the improvement is most obvious while browsing.

However….Ubuntu (14.04)seems to have a problem with that. The issue was that the display manager used by Ubuntu – lightdm – did not start properly or at least didn’t finish the job it was supposed to do. After the boot the system displayed nothing but a black screen. TTY access was possible though and this is how the solution can be implemented.

I didn’t to an extensive search about this issue (mainly because I had already spent long hours installing and reinstalling video drivers, not knowing what the problem was) and therefore the fix is more of a workaround.

The cause of the problem seems to be a race condition involving GUI components. lightdm does not do everything in the correct order probably because it starts too quickly (because of the SSD), so the workaround is to delay its start by adding “sleep x” in the config file /etc/init/lightdm.conf where x is the time in seconds. It should be added right before lightdm call.

sudo vi /etc/init/lightdm.conf

sleep 2

(before exec lightdm)

Source: http://www.webupd8.org/2013/01/ubuntu-lightdm-black-screen-when-using.html

Truth be told, Ubuntu may not actually be at fault. The bug is in lightdm code that Ubuntu is simply using to provide higher functionality.

Usefull:

Display currently active video driver:

lshw -c video

Display information about openGL support:

glxinfo

Additions

Sound quality can be improved a little by using the pulseaudio equalizer.

sudo add-apt-repository ppa:nilarimogard/webupd8sudo apt-get updatesudo apt-get install pulseaudio-equalizer

Source: http://askubuntu.com/questions/597710/sound-quality-is-good-on-ubuntu-but-great-on-windows

Enabling two finger scroll did not work when used in rc.local but worked when used in .bashrc (synclient “TapButton2″=2).

Better workflow:

– Guake terminal

– Use of aliases for accessing folders very commonly used and replacing commands such as “exit” and “clear”

alias egc=”cd /home/username/Dropbox/EGC”

alias x=”exit”

alias c=”clear”

Others

Unable to run script from ntfs partition. Cause: by default, when mounting a ntfs partition it is mounted with the option noexec. Solution: add the exec option to fstab file.

UUID=”101D6F1F3A07678B” /media/store ntfs-3g rw,users,exec,permissions 0 0

To get the UUID: blkid.

To find the location of a file: locate libXv.so.1

/usr/lib/x86_64-linux-gnu/libXv.so.1

/usr/lib/x86_64-linux-gnu/libXv.so.1.0.0

Get the package providing it: dpkg -S /usr/lib/x86_64-linux-gnu/libXv.so.1

Source: http://askubuntu.com/questions/453368/skype-error-while-loading-shared-libraries-libxv-so-1-cannot-open-shared-obje

Advertisements

Android setup for USB Wi-Fi adapter

Purpose: make the Cubieboard2 running Android use the USB Wi-Fi adapter. By default, the Android images I found available did not have the required driver or better said, it was not being used.

Usefull:
http://taqlim.blogspot.ro/2013/06/belkin-f7d1101-wireless-usb-on-android.html
http://linux-sunxi.org/A20

Really good tutorial:
http://archive.miniand.com/wiki/Allwinner/Unpacking+and+building+LiveSuit+images+for+Hackberry.html

One Android images source:
http://docs.cubieboard.org/tutorials/cb2/installation/cubieboard2_android-4.2.2_releases

Linux tools:
http://dl.miniand.com/allwinnera10/system/image/tools.tar.gz

Packer:
http://forum.xda-developers.com/showthread.php?t=1753473

1. I used Android 4.2_v1.08 image.
2. Inpack the .img file with imgrepacker

./imgrepacker .img

Output:
imgrepacker (version 2.05 linux)
LiveSuit’s & PhoenixSuit’s firmware image unpacker/packer

(c) RedScorpio, Moscow, 2012-2014
RedScorpio@land.ru

==========================[ START ]==========================

— Firmware unpacking —

PhoenixSuit image format detected

– image.cfg creating –
image.cfg created

– Files extracting –
“/sys_config.fex” extracted (format: unknown)
“/sys_partition.fex” extracted (format: unknown)
“/split_xxxx.fex” extracted (format: unknown)
“/boot0_nand.fex” extracted (format: Allwinner BOOT0 file)
“/boot0_sdcard.fex” extracted (format: Allwinner BOOT0 file)
“/u-boot.fex” extracted (format: unknown)
“/fes1.fex” extracted (format: Allwinner BOOT0 file)
“/usbtool.fex” extracted (format: Windows PE file)
“/aultls32.fex” extracted (format: Compiled lua file)
“/aultools.fex” extracted (format: Compiled lua file)
“/cardtool.fex” extracted (format: Windows PE file)
“/cardscript.fex” extracted (format: unknown)
“/sunxi_mbr.fex” extracted (format: unknown)
“/dlinfo.fex” extracted (format: unknown)
“/bootloader.fex” extracted (format: FAT16 image)
“bootloader.fex.iso” created
“/Vbootloader.fex” extracted (format: unknown/empty?)
“/env.fex” extracted (format: unknown)
“/Venv.fex” extracted (format: unknown/empty?)
“/boot.fex” extracted (format: Android boot image)
“/Vboot.fex” extracted (format: unknown/empty?)
“/system.fex” extracted (format: sparse image)
“/Vsystem.fex” extracted (format: unknown/empty?)
“/recovery.fex” extracted (format: Android boot image)
“/Vrecovery.fex” extracted (format: unknown/empty?)
“/diskfs.fex” extracted (format: unknown)

==========================[ STOP ]==========================

3. Copy these files is a separate folder:
boot.fex
system.fex
recovery.fex

4. Rename boot.fex and recovery.fex to boot.img and recovery.img.

5. Use the slpit_booting.pl script from the linux tools archive:

./split_bootimg.pl boot.img

Now in the folder containing the split_bootimg script there are two new files. Unzip the ramdisk archive to a new folder.

mkdir ramdisk
cd ramdisk
gunzip -c ../boot.img-ramdisk.gz | cpio -i

6. Edit the file init.sun7i.rc by adding this line:
insmod /system/vendor/modules/rtl8192cu.ko

Usefull:

To get info about modules:
modinfo

To see the modules already loaded in the kernel:
lsmod

____________________
To access the system itself thee steps are needed:

1. Convert from .fex to .img:
./simg2img system.fex system.img

2. Make a new directory for the system and mount it
mkdir system
sudo mount -o loop system.img system

3. Restore the image to fex
sudo ./mkuserimg.sh -s system new-system.fex ext4 ../tmp 500M
The 500M part tells how much memory should be allocated for the image, if 500M does not work check the size of the orginal .img and use something similar, otherwise just increase until it executes successfully.

I was surprised to find a lot of drivers already included in the system.

system/vendor/modules$ ls
8188eu.ko gc0307.ko mali.ko scsi_wait_scan.ko
8189es.ko gc0308.ko mcs7830.ko sp0838.ko
8192cu.ko gc0309.ko mma7660.ko stk831x.ko
8723as.ko gc0329.ko mma8452.ko sun7i-ir.ko
8723au.ko gc2015.ko mma865x.ko sun7i-keypad.ko
afa750.ko gc2035.ko Module.symvers sun7i_tvd.ko
al3010.ko gpio-sunxi.ko mt9d112.ko sunxi_csi0.ko
asix.ko gspca_main.ko mt9m112.ko sunxi_csi1.ko
bcm20710a1.hcd gt2005.ko mt9m113.ko sunxi-ps2.ko
bcm4330.ko hdcp.ko mxc622x.ko sunxi-ts.ko
bma250.ko hi253.ko nand.ko sw_device.ko
camera.ko hi704.ko nvram_ap6210.txt ump.ko
cdc_ether.ko hid-logitech-dj.ko ov2643.ko usbnet.ko
dmard10.ko i2c_device_debug.ko ov2655.ko usb-storage.ko
example.ko kxtik.ko ov5640.ko uvcvideo.ko
fw_bcm40181a2_apsta.bin leds-sunxi.ko qf9700.ko videobuf-core.ko
fw_bcm40181a2.bin lis3de_acc.ko rtl8150.ko videobuf-dma-contig.ko
fw_bcm40181a2_p2p.bin lis3dh_acc.ko s5k4ec.ko

____________________________________________________________________

Ok… nothing worked!!!

After trying a lot to get the wi-fi adapter to work on Android I didn’t manage to do it, BUT AGAIN, the experience gave me an idea about browsing so I ended up here:

where I found the long lost Android image containing the driver. It worked flawlessly. (TODO: open it up and see how it was made)

Source: http://cubiuntu.com/2014/09/14/help-needed-cb_a20_android42_v1-05_8192cu-ddr432-en_us-img-lost/

Download link: http://www.4shared.com/file/EtaZ2Lisba/android-cb2-v105_sugar-8192cu.html

Further Android setup

First problem:
The only layer that truly works and supports perfectly hardware acceleration on the board was MXPlayer. However, due to licencing problems no more AC3 audio decoding software was included so it needs to be added manually.
Solution found here: http://forum.xda-developers.com/apps/mx-player/mx-player-custom-codec-dts-support-t2156254
Download the all-in-one zip pack of codecs then using MXPlayer’s settings (custom codec) point it to the location of the archive.

____________________________________________________________________

Second problem: the NAND memory is too small for video caching so I need to make Android 4.2.2 write to external USB hard-drive.
Solution found here: http://www.cnx-software.com/2012/08/26/how-to-allow-apps-to-write-files-to-usb-mass-storage-devices-in-android/

1. connect through adb to the board
2. mount the system
mount -o remount,rw /system
3. Make a copy of the file and edit it by adding in the body of android.permission.WRITE_EXTERNAL_STORAGE

cd /system/etc/permissions/
busybox cp platform.xml platform-old.xml
busybox vi platform.xml

reboot

Now the video streaming app can use an external device as cache storage place.

Setup USB wi-fi adapter on linux

Purpose: connecting a developer computer board (cubieboard2) to the Internet by means of wireless connection. The already installed Linux distribution does not have a proper driver for the device.

Used tutorials and sources of information

https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=44044
http://askubuntu.com/questions/16584/how-to-connect-and-disconnect-to-a-network-manually-in-terminal
http://askubuntu.com/questions/138472/how-do-i-connect-to-a-wpa-wifi-network-using-the-command-line

Check for device detection:
1: lsusb
2: lsmod -> see what drivers are installed for a given device
3: dmesg | grep 819 (819 is the version of the driver)

Example output:
rtl8192cu: Chip version 0x11
rtl8192cu: MAC address: 14:cc:20:20:d9:b9
rtl8192cu: Board Type 0
rtl8192cu: Loading firmware rtlwifi/rtl8192cufw.bin
usbcore: registered new interface driver rtl8192cu
rtlwifi: Firmware rtlwifi/rtl8192cufw.bin not available
Error: Driver ‘rtl8192cu’ is already registered, aborting…

***Notice rtl8192cu: Loading firmware rtlwifi/rtl8192cufw.bin
-> Firmware is needed
source for the file:
https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/tree/rtlwifi

Firmware directory: /lib/firmware/name-of-driver

mkdir /lib/firmware/RTL8192CU
or
mkrdir rtlwifi

mkdir /lib/firmware/RTL8192CU

cd /lib/firmware/RTL8192CU

wget https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/tree/rtlwifi/rtl8192cufw.bin

http://ubuntuforums.org/showthread.php?t=1667140
http://ubuntuforums.org/showthread.php?t=1861463&page=11

After reboot:

dmesg | grep 819
PERCPU: Embedded 7 pages/cpu @d3808000 s7616 r8192 d12864 u32768
pcpu-alloc: s7616 r8192 d12864 u32768 alloc=8*4096
rtl8192cu: Chip version 0x11
rtl8192cu: MAC address: 14:cc:20:20:d9:b9
rtl8192cu: Board Type 0
rtl8192cu: Loading firmware rtlwifi/rtl8192cufw.bin
usbcore: registered new interface driver rtl8192cu
Error: Driver ‘rtl8192cu’ is already registered, aborting…

The inbuilt driver needs to be blacklisted.
Add “blacklist rtl8192cu” here: /etc/modprobe.d/blacklist.conf

http://forums.fedoraforum.org/archive/index.php/t-157746.html
_____________________________________________________________

Setting up wireless connection on linux using command line

1) Install wpasupplicant
2) edit/create gedit /etc/wpa_supplicant.conf by adding:

network={
ssid=”ssid_name”
psk=”password”
}

OR

wpa_passphrase SSID PASSWORD > CONFIG_FILE

3) To check for available wi-fi signal: iwlist scan
4) Check the name of the wireless interface: ifconfig or iwconfig

http://askubuntu.com/questions/16584/how-to-connect-and-disconnect-to-a-network-manually-in-terminal

Checking can be done by using ping through a given interface:
ping -I <interface> <website>

From this moment on nothing else of what I tried worked (the device is recognised and I can scan for Wi-Fi networks but I am unable to connect) so I had to use the GUI. I plugged the board in a monitor and used the internet symbol from the desktop GUI of xfce4 to access the Wi-Fi network, configure it (add password) and finally my cubieboard2 was connected by a wireless connection to the Internet.

Useful:

Place on system where repository lists are kept:
/etc/apt/sources.list
/etc/apt/sources.list.d/*.list

To continue using an outdated release then edit /etc/apt/sources.list and change archive.ubuntu.com to old-releases.ubuntu.com.

http://old-releases.ubuntu.com/ubuntu/dists/
https://help.ubuntu.com/community/Repositories/CommandLine

Double curly brackets initialization in Java 8

It doesn’t work. At least when used in JUnit tests, but I am sure the problem is not with JUnit.


public void test() {
Pattern p = new Pattern(new ArrayList()
{{ addAll(cl2); addAll(cl1); addAll(cl1); addAll(cl2); }});

private ArrayList&amp;amp;lt;LinkedHashSet&amp;amp;gt; fieldTable = new ArrayList();
    private LinkedHashSet bindings = new LinkedHashSet();
    
    public Pattern(List allBindings) {
        this.bindings.addAll((List)allBindings);
        fieldTable = new ArrayList();     
        fieldTable.add(new LinkedHashSet());
        fieldTable.add(new LinkedHashSet());
        fieldTable.add(new LinkedHashSet());
        this.parseBindings();
    }

The static constructor represented by the double curly brackets will cause a java.lang.exceptionininitializererror .
The more usual variant where a new ArrayList is created separately and then filled using addAll() works fine.

I solved the problem by installing JDK1.7, adding the platform to netbeans from Tools > Java Platforms and then going to project > right click > properties > here set the JDK7 in library and sources format.

Usefull links:
Curly brackets initialization explained.
http://stackoverflow.com/questions/507602/how-can-i-initialize-a-static-map

Java8 and curly brackets

Building Mozilla Firefox

Installing mozilla from source – an unexpected challenge I faced while trying to bring my contribution to the open source world (this is the first large program that I built from source code).
First error(just an unmet dependency):
autoconf 2.13 not found (something similar to this)

solve:
apt-get install autoconf2.13

Error:
0:14.05 configure:17480: checking for gtk+-2.0 >= 2.18.0 gtk+-unix-print-2.0 glib-2.0 gobject-2.0 gdk-x11-2.0
0:14.05 configure: error: Library requirements (gtk+-2.0 >= 2.18.0 gtk+-unix-print-2.0 glib-2.0 gobject-2.0 gdk-x11-2.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.

I started installing GTK+ (and plenty of dependencies)
For one particular dependency (pango) I got this error:

/usr/local/lib
./.libs/libpango.so: undefined reference to `g_string_printfa’

😦

Luckly I solved the problem by installing libgtk2.0-dev.

sudo apt-get install libgtk2.0-dev

Then: installed yasm, libasound2-dev, libpulse-dev, gstreamer and gstreamer plugin base 1.4.5(and some dependencies for it)

The gstreamer installation failed to work with the Mozilla installer:

configure:21625: checking for gstreamer-0.10 >= 0.10.25
0:05.32                       gstreamer-app-0.10
0:05.32                       gstreamer-plugins-base-0.10
0:05.32 configure: error: gstreamer and gstreamer-plugins-base development packages are needed to build gstreamer backend. Install them or disable gstreamer support with –disable-gstreamer

Then I found out that gstreamer 0.11 and 1.0 are kind of like two completely different libraries, not just different versions. So I uninstalled those two and installed 0.11 versions….or tried to.
gstream gave the error:

Makefile:534: recipe for target ‘libgstparse_la-grammar.tab.lo’ failed
make[3]: *** [libgstparse_la-grammar.tab.lo] Error 1

😦

So…I finally installed from packages:

sudo add-apt-repository ppa:gstreamer-developers/ppa
sudo apt-get update
sudo apt-get install gstreamer-0.10

However, I didn’t know the name of the package that contained the plugin base for gstreamer so instead of wasting time searching I installed it from source.

But of course…this happened the I tried to build it:

make[3]: Entering directory ‘/home/smith/openSource/gst-plugins-base-0.11.99/gst-libs/gst/tag’
CC     libgsttag_1.0_la-gstvorbistag.lo
gstvorbistag.c:39:30: fatal error: gst/gsttagsetter.h: No such file or directory
#include <gst/gsttagsetter.h>
^
compilation terminated.

Search:
apt-cache search -n gstreamer0.10-plugins

It turned out the plugins base was installed already, but the Mozilla install still complained about gstreamer not being installed.

Then I found out that I can make Mozilla use gstreamer1.0 instead of 0.10. I installed all gstreamer1.0 libraries again:
sudo apt-get install gstreamer1.0*

and added to the configuration file mozconfig this:

ac_add_options –enable-gstreamer=1.0

only to run into this:

0:05.41 configure:21625: checking for gstreamer-1.0 >= 1.0
0:05.41                       gstreamer-app-1.0
0:05.41                       gstreamer-plugins-base-1.0
0:05.41 configure: error: gstreamer and gstreamer-plugins-base development packages are needed to build gstreamer backend. Install them or disable gstreamer support with –disable-gstreamer

Exporting gstreamer path did not help:
export PATH=$PATH:/usr/lib/gstreamer-1.0

I went mad and run: sudo apt-get install libgstreamer-*
I noticed the that despite all the previous installations, there were still 4-5 plugin libraries not installed.

This finally installed gstream completly:
sudo apt-get install libgstreamer-plugins-*

Next:
sudo apt-get install libxt-dev

Finally, 40 minutes later (!!!) Firefox nightly was up and running :).

Part II:

I have somehow managed to completely break my system installing mozilla, ubuntu si somehow dead regarding the GUI, no window bars or unity / gnome interface works any more and the icons are blank white.

Installed a fresh Ubuntu 14.10(the only version where my trackpad works well) and started again. This time I’ve only got one single kind of error:

The following packages have unmet dependencies:
libcairo2-dev : Depends: libcairo2 (= 1.13.0~20140204-0ubuntu1) but 1.13.0~20140204-0ubuntu1.1 is installed.
Depends: libcairo-gobject2 (= 1.13.0~20140204-0ubuntu1) but 1.13.0~20140204-0ubuntu1.1 is installed.

Not only with libcairo but with some others as well. After some struggle I discovered that this means my libs are too new and had to downgrade them.
source: http://ubuntuforums.org/archive/index.php/t-1350709.html

sudo apt-get install libcairo2=1.13.0~20140204-0ubuntu1
sudo apt-get install libcairo-gobject2=1.13.0~20140204-0ubuntu1
sudo apt-get install libcairo2-dev
sudo apt-get install libgtk2.0-dev
sudo apt-get install libdbus-1-dev
Had to download dbus-glib-0.104 from official website and install manually.
sudo apt-get install yasm
sudo apt-get install libasound2-dev
sudo apt-get install libpulse-dev
sudo apt-get install gstreamer0.10 (<- probably not necessary)
sudo apt-get install libgstreamer-plugins-base0.10-*
sudo apt-get install libxt-dev

success

Update:

As I briefly mentioned above I managed to break Ubuntu while building Mozilla Firefox, to be more precise: Ubuntu had no side bar, there were no window bars and the ctrl + alt + t shortcut did not work. Also, the icons were all wrong (blank or error like). I did however get an error from Ubuntu that told me about two libs from /usr/local/lib that might be the cause of my my problems. After deleting those the icons were back to normal. Fortunately I came across this page which solved the last nasty bit about the interface:

http://askubuntu.com/questions/309498/unity-launcher-missing-and-terminal-shortcut-stopped-working

I will copy it here:

  1. Log into unity.
  2. Right click on the desktop and create a new folder.
  3. Open the folder and go to /usr/bin and start gnome-terminal by clicking on it.
  4. Type ccsm in the terminal to start compiz config settings manager.
  5. Go to preferences -> plugin list.
  6. Uncheck the automatic plugin list. And enable all the plugins.

As a matter of fact, activating unity-shell plugin was the only thing I needed.

DOSBox for Linux

Today I installed DOSBox on Ubuntu in order to learn some Assembly and prepare for the oncoming exams.

First step:

sudo apt-get install dosbox

dosbox

First I needed to mount a drive using as location an already existing directory. So I made a directory called “dosprogs” in home folder and then ran in DOSBox environment:

mount D ~/dosprogs

D:

Files needed for compiling and debugging: debug.exe, tasm.exe, tlink.exe. I found those on the Internet and uploaded them here.

To automate this process even more so I don’t have to do it every time DOSBox runs, I changed the configuration file from ~/.dosbox by adding the following lines at the end of it:

mount D ~/dosprogs
D:
SET PATH=Z:\;D:\

To make my Assembly programming more pleasant I created a Batch script that runs the assembler, linker and executable file for me:

D:\TASM\tasm %1
if ERRORLEVEL 1 exit \B
D:\TASM\tlink %1
if ERRORLEVEL 1 exit \B
%1

Unfortunately the “exit” command will also close DOSBox even if I add ‘\b’ afterwards. I don’t know yet how to stop the execution of the script in case of error without also closing DOSBox so the script will actually look like:

D:\TASM\tasm %1
if ERRORLEVEL 1 echo Error
D:\TASM\tlink %1
if ERRORLEVEL 1 echo Error
%1

[UPDATE] Found the solution:

D:\TASM\tasm %1
if ERRORLEVEL 1 goto end
D:\TASM\tlink %1
if ERRORLEVEL 1 goto end
%1
:end

The last line I wrote in the DOSBox configuration file makes it possible to run this script from anywhere using:

make assembyFileName

The file should be sent without its extension (helloW.asm => make helloW).

Linux configuration for laptop

After deciding to install Linux on my new laptop (Lenovo G50-70 i5)  I was surprised to find that the system was a lot more unstable than when running Windows 8.1. Unlike the desktop, the laptop install of Ubuntu had several problems.

1. First and worst of all, it froze after coming back from suspend (sleep) .

2. Battery was draining too fast.

3. No gestures such as two finger scrolling were available by default.

4. Screen backlight was always at maximum after boot

5. No image through HDMI but the wallpaper

Solutions

1. In order to get Ubuntu to work at all, during installation I had to go to a console environment and install a general AMD graphics package (fglrx). However, this turned out not to be the best driver choice for my laptop, these drivers were the cause of crushes. The solution was downloading a Catalyst Package from AMD website which in turn created four different driver packages based on my configuration. After installing these (there were four because drivers were split between core functionality drivers, basic drivers, graphic acceleration drivers and developer package) the system stopped freezing.

2 days later I found out that sometimes when waking up from suspended/sleep the system crushed and I had to do a cool reboot. The bug appears in several threads such as:

https://bugzilla.novell.com/show_bug.cgi?id=817552#c1

From the error message I get: “RADEON dpm resume failed” or similar, I figure it has something to do with the dynamic power management of the GPU. This wiki page explains what dpm is:

https://wiki.archlinux.org/index.php/ATI

2.

Update: The following steps are the cause of the nasty buggy behaviour mentioned above. The power optimiser called “tlp” when set to run on battery mode will make the laptop fail to wake from suspend  after a second suspend or to shut down after a suspend.

Battery drainage proved to be a lot simpler to solve than I thought it would be.

– install powertop utility to check for main power consumers and for tunables.


sudo apt-get install powertop

sudo powertop

– install tlp optimisation application, a very capable and smart program with plenty of functionality to be found online

sudo apt-get install tlp

run with sudo tlp start

or:

sudo add-apt-repository ppa:linrunner/tlpsudo 
apt-get update
sudo apt-get install tlp tlp-rdw smartmontools ethtool

tlp will check if the laptop runs only on battery and optimises the system accordingly. If the laptop is plugged then tlp runs in AC mode. I noticed the power optimisations are greatest when power comes from battery alone and tlp runs in “bat” mode (tlp bat).

After running tlp bat, powertop no longer displays unsolved tunables.

To start tlp at startup add tlp start or tlp bat or better /usr/sbin/tlp start ( or bat) in /etc/rc.local before the “exit 0” line.

3.

There seems to be a bug related to Lenovo trackpads that caused the issue but I am not sure.

I installed tpconfig and tried several solutions from the internet but I kept encountering the error :

Couldn’t find synaptics properties. No synaptics driver loaded?

So I actually have no synaptics drivers installed, only the generic evdev Linux drivers. What is worse is that synaptiks package was maintained only until version 13.10 (I am running 14.04) si it will not solve my problem.

Basically I have the exact same problem with the one described here: https://bbs.archlinux.org/viewtopic.php?id=176279 and at the current time the is no answer given.

I found a possible solution here:

http://askubuntu.com/questions/529974/elantech-touchpad-not-working-at-all/541966#541966

After upgrade to 3.18.1 kernel everything worked as expected, although for some reason the sensitivity of the trackpad was very very low.

This brought it to a normal state:

xinput set-prop &amp;amp;amp;amp;quot;ETPS/2 Elantech Touchpad&amp;amp;amp;amp;quot; &amp;amp;amp;amp;quot;Synaptics Finger&amp;amp;amp;amp;quot; 1 10 256

xinput set-prop &amp;amp;amp;amp;quot;ETPS/2 Elantech Touchpad&amp;amp;amp;amp;quot; &amp;amp;amp;amp;quot;Synaptics Pressure Motion&amp;amp;amp;amp;quot; 1 160

xinput set-prop &amp;amp;amp;amp;quot;ETPS/2 Elantech Touchpad&amp;amp;amp;amp;quot; &amp;amp;amp;amp;quot;Synaptics Pressure Motion Factor&amp;amp;amp;amp;quot; 0. 65 0.65

To upgrade the kernel:

Download the Linux kernel (3.18.*) from official website and Linux headers from here:

http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.18.1-vivid/linux-headers-3.18.1-031801-generic_3.18.1-031801.201412170637_amd64.deb

http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.18.1-vivid/linux-headers-3.18.1-031801-generic_3.18.1-031801.201412170637_all.deb

http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.18.1-vivid/linux-image-3.18.1-031801-generic_3.18.1-031801.201412170637_amd64.deb

And then install all packages:

sudo dpkg -i linux-headers-3.18.1-031801*.deb linux-image-3.18.1-031801-generic_3.18.1-031801.201412170637_*.deb

Another useful script for trackpad configuration:

#!/bin/bash

xinput --set-prop --type=int --format=32 &amp;quot;ETPS/2 Elantech Touchpad&amp;quot; &amp;quot;Synaptics Two-Finger Pressure&amp;quot; 1

# Below width 1 finger touch, above width simulate 2 finger touch. - value=pad-pixels
xinput --set-prop --type=int --format=32 &amp;amp;amp;amp;quot;ETPS/2 Elantech Touchpad&amp;amp;amp;amp;quot; &amp;amp;amp;amp;quot;Synaptics Two-Finger Width&amp;amp;amp;amp;quot; 10

# vertical scrolling, horizontal scrolling - values: 0=disable 1=enable
xinput --set-prop --type=int --format=8  &amp;amp;amp;amp;quot;ETPS/2 Elantech Touchpad&amp;amp;amp;amp;quot; &amp;amp;amp;amp;quot;Synaptics Two-Finger Scrolling&amp;amp;amp;amp;quot; 1 1

# vertical, horizontal, corner - values: 0=disable  1=enable
xinput --set-prop --type=int --format=8  &amp;amp;amp;amp;quot;ETPS/2 Elantech Touchpad&amp;amp;amp;amp;quot; &amp;amp;amp;amp;quot;Synaptics Edge Scrolling&amp;amp;amp;amp;quot; 0 0 0

# stabilize 2 finger actions - value=pad-pixels
xinput --set-prop --type=int --format=32 &amp;amp;amp;amp;quot;ETPS/2 Elantech Touchpad&amp;amp;amp;amp;quot; &amp;amp;amp;amp;quot;Synaptics Jumpy Cursor Threshold&amp;amp;amp;amp;quot; 250

exit

I have also added the script to the startup list.

Good source for trackpad tweaking:

http://www.x.org/archive/X11R7.5/doc/man/man4/synaptics.4.html

To simulate middle click with with two finger tap:

synclient "TapButton2"=2

source: http://askubuntu.com/questions/306412/how-can-i-setup-my-touchpad-multi-finger-tapping-functionality

Notice

Enabling the horizontal scroll my cause a buggy behaviour in Java based programs such as NetBeans. To disable horizontal scrolling change this line like this:

xinput --set-prop --type=int --format=8  "ETPS/2 Elantech Touchpad" "Synaptics Two-Finger Scrolling    " 1 0

4. Added this command to rc.local

echo 200 &amp;amp;amp;amp;gt; /sys/class/backlight/intel_backlight/brightness

Where 200 is how bright the screen should be.

5. Found the solution here:

http://superuser.com/questions/701716/disabling-laptop-monitor-when-external-hdmi-monitor-is-plugged-in

Check the available displays with

xrandr

xrandr --output eDP1 --off

Where eDP1 is my laptop’s display.