Tag Archives: dell xps 15 L502x

Persist your screen brightness settings in Linux

If you like me have a machine running Linux OS and want to be able to persist your screen’s brightness setting, here is a small script that does the trick. (I don’t know if that feature lacks only in Ubuntu running in a Dell XPS 15 l502x or common to all Linux laptops)

Initially the problem is that once you reboot the machine, you lose the brightness setting and you have to manually adjust again. Annoying!

With the following instructions, you’ll be able to fix that. Tested in Ubuntu 13.10.

Copy these following three scripts in your Desktop folder (Or in the same folder) and give them execution permission:

RESET script (brightness-reset.sh):

# Author: Hanine HAMZIOUI ALMADANY <hanynowsky@gmail.com>
# This script sets the brightness in Ubuntu as it is not persistent upon reboot

# In order to manually execute these commands below, the user must be root

# Brightness values are integers that range from 0 to 15

if [ -f $CUSTOMBRIGHTNESS ];then echo $(cat $CUSTOMBRIGHTNESS) > /sys/class/backlight/acpi_video0/brightness
else echo $DEFAULT_BRIGHTNESS > /sys/class/backlight/acpi_video0/brightness
exit 0

Brightness RUN (brightness-run.sh)


# Persist Brightness value in Ubuntu 13.10
# Author Hanine HAMZIOUI ALMADANY <hanynowsky@gmail.com>

if [ -f "brightness-reset.sh" ]; then
sudo cp -v brightness-reset.sh /etc/init.d/ && sudo chmod +x /etc/init.d/brightness-reset.sh
else echo "brightness-reset file does not exist, it must be in the same folder. Terminating..."; exit 0;

if [ -f "brightness-save.sh" ]; then
sudo cp -v brightness-save.sh /etc/init.d/ && sudo chmod +x /etc/init.d/brightness-save.sh
else echo "brightness-save file does not exist, it must be in the same folder. Terminating..."; exit 0;

sudo ln -s /etc/init.d/brightness-save.sh /etc/rc0.d/K10brightness-save # Brightness SAVE Symbolic link to RC 0
sudo ln -s /etc/init.d/brightness-save.sh /etc/rc6.d/K10brightness-save # Brightness SAVE Symbolic link to RC 6

rawfile=`cat /etc/rc.local | grep "/etc/init.d/brightness-reset.sh"`
if [ -z "$rawfile" ]; then
sudo sed -e 's/exit 0//g' -i /etc/rc.local
sudo echo "#Reset screeen brightness" >> /etc/rc.local
sudo echo "/etc/init.d/reset-brightness.sh" >> /etc/rc.local
sudo echo "exit 0" >> /etc/rc.local
else echo "RC.LOCAL file is already customized to reset brightness at startup...If you think otherwise, do it manually again!"

exit 0;

BRIGHTNESS Save (brightness-save.sh)


# Author: Hanine HAMZIOUI ALMADANY <hanynowsky@gmail.com>
# Target: Ubuntu 13.10 and below
# Script that saves the last brightness value used

mkdir -p $(dirname $CUSTOMBRIGHTNESS)
cat /sys/class/backlight/acpi_video0/brightness > $CUSTOMBRIGHTNESS
exit 0;


chmod +x ~/Desktop/brightness-*

And finally; from your terminal again:

bash ~/Desktop/brightness-run.sh

You will be prompted for your user password.

Now adjust brightness ti a certain value and reboot. 😉


Dell XPS 15 L502X & Ubuntu 12.04 Linux

This is a simplified tutorial for those interested to Install/Use Ubuntu 12.04 Precise Pangolin on their Dell XPS 15 notebook (laptop) and not sure if things would go fine. (This is an update to this post which covered Ubuntu 11.10).
The following instructions apply to Sandy Bridge models (64 bits).

Dell XPS 15

Dell XPS 15

Tested System:

  • – CPU: i7 2670QM with Turbo Boost up to 3.10 Ghz.
  • – Graphics : Integrated (Onboard) Intel HD 3000.
  • – Graphics 2: Discrete Nvidia GT 525M with 1 Go of memory.
  • – Standard 720p screen (1366 X 768)
  • – Backlit keyboard.

Installation of Ubuntu 12.04

  • – Download the iso image from Ubuntu.com (64 bits), then use the USB DISK CREATOR using another Ubuntu Live CD to create a bootable Ubuntu on your USB key.
  • – Boot the notebook using this USB Key (Make sure it is plugged to the USB 2.0/E-Sata port instead of the USB 3.0 port, otherwise, the installation will fail).
  • – Follow installation instructions (The installation goes smoothly). But Don’t INSTALL THIRD PARTY SOFTWARE. INSTALL ONLY UPDATE PACKAGES.
  • – Upon installation, all hardware is recognized but some manual commands may eventually be necessary to activate the 9/1 card reader and the Nvidia card.

Please refer to this page for the commands : https://wiki.ubuntu.com/HardwareSupport/Machines/Laptops/Dell/XPS/15#preview


  • Upon installation only the integrated graphics card is active (Intel HD 3000).
  • To enable the Nvidia card, you have to install bumblebee project (Optimus Enabler for Linux). DO NOT INSTALL THE NVIDIA PROPRIETARY DRIVER manually (If you do, you won’t be able to boot); let Bumblebee installation take care of it.


Alternatively, you can configure Bumblebee to install Nvidia Open Source drivers NOUVEAU instead of the proprietary ones (We’d cover this in the future.). Meanwhile, check the following links:


http://nouveau.freedesktop.org/wiki/FeatureMatrix  (Nvidia GT525m / GT540m are categorized under NVC0 version)



Bumblebee 3.0 Installation

Bumblebee Logo

bumblebee Logo

The official web site is : http://bumblebee-project.org/install.html
– Follow the README instructions through : https://github.com/Bumblebee-Project/Bumblebee
– Installation is straighforward and fast.
– More infos are to be found here:
Once bumblebee installed, basically you’d be able to run applications using the Nvidia Card, this way:
– Open Terminal and type optirun someapplication (for example: optirun firefox )



Test 3D on your Nvidia Card:

Open terminal and append:   optirun glxspheres   or optirun glxgears  instead, (a bug affecting GLXSPHERES in 12.04 affecting the performance of graphics https://bugs.launchpad.net/ubuntu/+source/compiz/+bug/944627)

a window will open with 3D spheres animated, and you should read the Frame per Second values on your terminal.

Repeat the same thing but without optirun, on Terminal, append:  glxspheres

The same Windows should appear, but with lower FPS values.

In the following screencasts (with the bug of course), our FPS ranges from 33 to 81 fps when the Nvidia GT525m is used, and from 1 to 3 fps when the Intel HD 3000 is used.

Laptop powered:

Laptop on battery:

Browser 3D:

You can also benchmark your two cards using the web browser (Firefox  – google-chrome – chromium-browser – opera):

optirun google-chrome http://webglsamples.googlecode.com/hg/aquarium/aquarium.html

or (if you want verbose information displayed on your terminal):

optirun -v --debug google-chrome http://webglsamples.googlecode.com/hg/aquarium/aquarium.html

Aquarium 3D Test on browser

Aquarium 3D Test on browser



Otherwise, you can install the Bumblebee GUI (it is still not official and has two or three -easy to live with- bugs):


Notice that the first time you open an application with Bumblebee, it’s reltively slow, because it has to load the whole Nvidia driver.

Bumblebee Indicator

Bumblebee Indicator

Launch with Bumblebee

Launch with Bumblebee

Bumblebee Notification

Bumblebee Notification

Bumblebee Configuration Applet

Bumblebee Configuration Applet through Panel Indicator

The great Bumblebee Team has also thought about a RUN VIA OPTIRUN script for nautilus. You can browse -using nautilus file manager- to an executable application and execute it with OPTIRUN, using only the mouse (RUN VIA OPTIRUN):

Screencast of Bumblebee Nautilus RUN VIA OPTIRUN Script:


Unity 2D & 3D

  • With or without Bumblebee, Unity 3D and 2D work fine.
  • If you want to tweak Unity 3D install CCSM (CompizConfig Settings Manager) (You might encounter a freeze when you try using CCSM, in this case, relogin using Unity 2D, then open CCSM, search for Unity plugin and check the unity plugin. Reboot and login using Unity 3D then retry CCSM, everything should be fine).


Multi Display (External Monitors)

  1. – Unfortunately it is impossible to have more than one external screen along with the onboard laptop screen for now (it should be possible in the near future depending on Bumblebee / Kernel drivers evolution and maybe if the X Server is repalced by another more performant and modern display compositor – Wayland  – ).
  2. – For information:
  • –> The Intel HD 3000 (Graphics card) is linked to the mini DisplayPort
  • –> The Nvidia graphics card is linked to the HDMI port.
  • –> The HDMI port is disconnected and cannot be enabled for now (Bumblebee project team is working on it. See Bug: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/844307).
  • –> The mini DisplayPort is enabled by default and works out of the box.
Displays Settings

Ubuntu 11.10 Displays Settings

Display Settings in Ubuntu 12.04

Display Settings in Ubuntu 12.04

If you want to use an external monitor you have to get a mini DisplayPort to HDMI adapter or a mini DisplayPort to DVI adapter (You can find it on ebay for a good price. We used a china made adaptor that supports 1080p and which cost 15$)
The Intel HD 3000 through the mini DisplayPort is capable of driving up to 2560X1600 as a resolution (We tested with a Dell ST2310 1920X1080p and a Samsung XL 2370 SyncMaster 1920X1080p).

If you have a VGA only capable monitor, then get yourself a MiniDisplay to VGA adapter. be sure to get a high quality one to be able to drive the 1920 resolution. Most market VGA adapters allow up to 1024 resolution only.



As mentioned, the HDMI issue is still on and we hope developers will address it soon. A bug is reported here, join it: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/844307

yet, if you want to make sure your HDMI port is physically operational, connect your external monitor to the HDMI port on your XPS 15 and do the following:

open terminal and type:

optirun nvidia-settings -c :8

The Nvidia Settings Applet should appear:

Nvidia X Settings

Nvidia X Settings


DISPLAY=:8.0 firefox

This will activate your HDMI external monitor and display Firefox in it.

If you do not get the full resolution for your external monitor plugged to the HDMI port, modify the Bumblebee Nvidia Xorg config file, by changing the value of “readEDID” from false to true (X Restart or reboot  is necessary for changes to take effect).

Otherwise, if you xant to have a pseudo extended desktop using your external monitor hooked to the HDMI port  along with another monitor hooked to the miniDIsplay Port (The laptop screen should be deactivated), then check this:


Remark:  In Ubuntu Displays settings it is not possible for now to select the main output monitor (you can use XRANDR utility to set it manually).



In 11.10 with previous kernel version, Power management was still an issue; now with the 3.2 kernel and Bumblebee 3.0, Power management works like a charm even better than Microsoft Windows OS.

There is no manual tweaking to do.

  • Normal CPU Temperature when the laptop is in passive cooling (Almost no CPU activity), peaks 44°C.
  • In normal tasking, the CPU temp peaks 54°C. Quiet Cooling.
  • During multi-tasking, the CPU temp reaches 64°C. Normal Cooling.
  • During heavy Memory and CPU usage, CPU temp reaches 75°C. / 80°C. Noisy Cooling.
CPU Temperature

CPU Temperature

The tool we use to monitor temperature in real time is HARDWARE SENSORS INDICATOR.

Be sure to install the package sensors-detect and run it (answer YES to all questions).



If you have the model with the 720p 1366X768 screen, you might have already noticed that its color profile is not suitable for most applications, especially video and photo viewing. You might also be annoyed by the blueish mediocre brightness.

Hopefully, Ubuntu comes with an utility that allows the user to load and apply what we call a Color Profile. As far as we can tell, DELL support does not provide any color profile database for users. Luckily, many color displays for monitors and laptop screen are available for downloading. As well as tools for customizing your own color profile (Open Ubuntu Software center and type COLOR, you should find a multitude of tools for ICC profiles).

Ubuntu 12.04 Color profiling

Ubuntu 12.04 Color profiling

For those having Ubuntu One account, here is a link to some profiles: https://one.ubuntu.com/files/shareoffer/34a3ac3d-2013-4534-8e01-ac815857ac94/

And for those who do not, a google document link : https://docs.google.com/open?id=0B-Sn4N_QK9abXzFHUkFIYjBUT1Mtd25fMlVxdHc0QQ


BUGS affecting the Dell L502X (Hardware issues).

If you’re affected by these bugs, please create a launchpad account (if not yet done) and mark yourself as being affected.

  1. https://bugs.launchpad.net/unity/+bug/950160 (Fn + F1 does not work in 12.04 anymore)
  2. https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/897427 (Sound volume is at low level upon login)
  3. https://bugs.launchpad.net/ubuntu/+source/unity-greeter/+bug/874241 (Unity Greeter support for multi monitor is still disabled for Laptops)
  4. The Indicator panel keys:
Dell XPS 15 Panel Keys

Dell XPS 15 Panel Keys

  • KEY 3 : is binded to “Audio next”. Open Rhythmbox for example, play a playlist of songs, and click that key, it will trigger “Next Song” just like ( Fn + ->->| ) .
  • KEY 2 : is binded to “Bightness down”.
  • KEY 1: is not bind to any keyboard shortcut, so you can set a new shortcut for it.

In order to force the key to use a custom shortcut for the application of your choice, install the tool: Ubuntu Tweak.

sudo add-apt-repository ppa:tualatrix/ppa
sudo apt-get update
sudo apt-get install ubuntu-tweak

Open Ubuntu Tweak and go to ADMINS panel. Click SHORTCUTS and add your customized keyboard shortcut and command.

In our case, the command is gnome-control-center and the keyboard key corresponds to KEY 1. When you click on the shortcut cell, you will be prompted to press the desired key, here KEY 1.

Ubuntu Tweak

Ubuntu Tweak

You’re done. Now when you click on KEY 3, the Gnome Control Center should open. (Of course, you can set the key to open the application of your choice, we set it to GCC, just because it matches the printed logo).

Please, in case you find another hardware bug, please report in Launchpad and in by commenting on this blog post. Thanks in advance.


BUGS Workarounds

Workaround for Bug #874241

The workaround can be found here for instructions: http://askubuntu.com/questions/119843/how-to-force-multiple-monitors-correct-resolutions-for-lightdm

The workaround script is the following (Assuming your external monitor is digital):

# V-1.0 by Hanynowsky - April 2012. I am a very basic script that works around bug 874241 reported in launchpad.
# Put this script in /usr/share/ and add this line display-setup-script=/usr/share/lightdmxrandr.sh to
# /etc/lightdm/lightdm.conf
# then retart lightdm (sudo service lightdm restart)
# N.B: This script assumes your laptop's screen is identified as LVDS1 and has a resolution of 1366x768
# and assumes your external monitor is named HDMI1 and has a resolution of 1920x1080
# Use the command xrandr -q to identify these values accurately and modify them in variables XCOM0, XCOM1 & XCOM2
# e.g. You might have DP1 or VGA1 instead of HDMI1 or 1920x1200 instead of 1920x1080
# Also this script does not override your default desktop displays configuration after login.
XCOM0=`xrandr -q | grep 'HDMI1 connected'`
XCOM1=`xrandr --output HDMI1 --primary --mode 1920x1080 --output LVDS1 --mode 1366x768 --below HDMI1`
XCOM2=`xrandr --output LVDS1 --mode 1366x768`
# if the external monitor is connected, then we tell XRANDR to set up an extended desktop
if [ -n "$XCOM0" ] || [ ! "$XCOM0" = "" ]; then echo $XCOM1
# if the external monitor is disconnected, then we tell XRANDR to output only to the laptop screen
else echo $XCOM2
exit 0;

Workaround for bug – Slow Wifi connection speed on Intel Centrino Wireless –
Check your wireless connection information and note the name of the driver (in our case it’s iwlwifi)
If it’s iwlagn, then replace iwlwifi by iwlagn.
Open terminal and type:

sudo rmmod iwlwifi && sudo iwlwifi 11n_disable=1

This will desactivate your wifi connection and reactivate it.
Check if your connection is fast. If it is, then make these changes permanent by creating a file and appending a line on it. On Terminal type:

sudo gedit /etc/modprobe.d/options.conf 

This will open an empty text file. Then append the following line and save:

options iwlwifi 11n_disable=1

or (if you have a slightly different intel card and using another dirver)

<code>options iwlagn 11n_disable50=1</code>


Bumblebee: Please check this page for proper installation of Bumblebee: https://wiki.ubuntu.com/Bumblebee