XPS13 - 9333

Here a simple pages with some useful configuration for this laptop, useful especially for those of you who don't want to use the official Ubuntu images.
Nearly everything works out of the box, but few things required a manual configuration.

I'm using Debian, so some of what written below might not be applicable directly to your distro.

If you have suggestions or something to ask, mail me at You must enable JavaScript to see the address.

Last update: 17 September 14

Index

Note: commands starting with # has to be ran with root privildges (sudo or su), commands starting with $ as user.

Init script

This a simple init script to performs some actions on boot. By default, it does nothing, see Light sensor, Battery life, SSD Performance, Headset/headphones background noise and Build kernel modules for more info.

Create /etc/init.d/xps, make it executable and create System V style init script links: Run the last command when you change the header of the script.

Ambient Light sensor

The Ambient Light Sensor of this laptop follows the ACPI specification. It correctly reports the ambient light illuminance, the light temperature and also the recommended polling frequency. No light color chromaticity and response though. (see the ACPI specification for more info).
There's no official driver that support it yet, but there's one which works, you can find it here. I modified it to also report the light temperature, here the patch.

Download the code and build it: Then create /etc/udev/rules.d/90-als.rules and /usr/local/bin/als.sh (21 May 14: script updated to be more power efficient): Make the script executable running the following command with root permissions: Finally, reload the rules with the following command:
Move the module to automatically load it on boot through /etc/init.d/xps (see here): This has to be done for every major kernel release.
The script to control the backlight is configurable, here a sample config file: You can easily test your configuration running as root: where LUX is a number and represents the ambient light you want to test.

You also may noticed that the ambient light sensor controlles the keyboard backlight, but only if you never manually change the brightness. After that, only a reboot could re-enable the automatic keyboard backlight.

Video tearing

The intel driver has an option (TearFree) to prevent video tearing, but it's disabled by default.

To know whether the option is enabled or not, run the following command: If it's not enabled, create /etc/X11/xorg.conf.d/10-intel.conf: and restart X or reboot.

Brightness keys

With some kernel versions they work out of the box, with some others you need to add an argument to the kernel command line.

To make them work with v3.13, edit and add to GRUB_CMDLINE_LINUX video.use_native_backlight=1. For example Then update GRUB running as root: and reboot.

Touchpad

If you are used to regular touchpads with physical buttons, you'll maybe find using a trackpad a bit troubling. Resting your fingers on the bottom is not possible. The latest versions of the driver have a better support of trackpads, so I suggest you to try them (v1.7.99.1 or newer). I still can't rest my fingers on the bottom and normally use the touchpad, but at least I don't have unexpected jumps when I try to click while moving the pointer.
Another solution would be using AreaBottomEdge (man synaptics) doesn't work as expected (see comment #5 for a patch) and it makes coasting hardly usable when scrolling down.
Take a look at this patch to prevent cursor jumps while using two fingers. (17 September 14) A much better fix is now upstream.

Finger width and palm detection

(17 September 14) upstream driver no longer requires patches for kernel 3.16+ using the RMI4 driver
If you are not using kernel v3.16 or newer with the new Synaptics driver, the kernel driver doesn't send the with of the fingers, necessary for the palm detection.
The new driver send the width of the fingers, but patching the xorg driver is still required.

For kernel older than 3.16, I wrote this patch that makes the driver rely only on the pressure for the palm detection. I didn't fix the code in a proper way handling our case as a special one, I simply got rid of the code which breaks the functionality on this laptop.
Alternatively, you can apply this kernel patch that makes the driver send the width of the fingers.
For newer kernels (3.16+), this is the patch. (17 September 14) Patch no longer required for 3.16+, the upstream code is fixed.

Follow only one of these guides.

Build and patch upstream driver

Building the upstream driver is quite simple (see below to build the driver provided by your distro).

Uninstall the current driver (reinstall it in case of problems). In this way your patched driver won't be removed during updates. Note: the following command remove also xserver-xorg-input-all: Install the needed dependecies (add the needed deb-src if not available): If you want to install the upstream driver, download the sources with the following command (see below otherwise): Apply the following patch: Build and install the driver: Create /etc/X11/xorg.conf.d/20-synaptics.conf (adjust the values) and restart X: Find the optimal value for PalmMinZ using synclient and update 20-synaptics.conf accordingly: In case of problems with this self-built driver, reinstall the original driver with:

Build and patch Debian driver

These are instructions to patch and build the driver used by your distro. The final result will be a deb that you can install.

Download the source code with: Apply the patch: Build the deb: and install it.
You can also build this driver with the same commands used to build the upstream driver, but you won't obtain a deb.

Disable touchpad while typing

If you don't want to build anything, you can try to use to use syndaemon which allows to disable the touchpad while typing.

Run as user the following command (it can't be added to /etc/init.d/xps to execute it on boot):

Keep it in mind when you enable the two finger emulation and set EmulateTwoFingerMinW to zero.

Touchpad gestures

(13 June 14) Here you can instead find a patch to add the support to three finger swipes to the synaptics driver.
If you are interested in defining simple gestures, you could try to replace synaptics with mtrack or you could try xSwipe. It works quite well, however it could cause some lags.
There are high chances you are using a recent version of synaptics and hence you need a patched driver. You can find it here. Follow the above instructions to build it or patch the upstream driver.

Touchpad and touchscreen conflicts

If your touchpad is recognized as generic pointing device, you might try blacklisting i2c-hid. This shouldn't disable the touchscreen, but it happened to some users.

Battery life

powertop is a powerful tool. Use it to find what could be changed to improve the battery life. Running it everytime could be tiresome though, so you could use a couple of scripts to do everything automatically.

(9 August 14): pm-utils no longer executes the scripts in /etc/pm/ with upower 0.99+. Create a udev rule to bring this functionality back:

(9 August 14): added command for bluetooth power saving mode in 10-power_script

Create /etc/pm/power.d/10-power_script and /etc/pm/sleep.d/10-run_power_script (25 June 14: white_noise_fix.py is run on resume, see Headset/headphones background noise) and make them executable: The second script is used to re-run the first script when the laptop is resumed from suspend.

Take also a look at the P state driver options for a more aggressive power save.

Note: The touchscreen becomes less reactive if not used for a while and sometimes it stops working completely.
Use powertop to re-enable it immediately. Consider to comment out the related line from the script to prevent this issue.

Note: Enable SATA link power Managmenet for host2 could cause weird keyboard lags. If it happens to you, comment it out in the script.

SSD Performance

Trim / periodically to maintain the performance of the SSD or add the discard flag to your fstab. Read this page on Wikipedia for more info.

For some reason, anacron is not doing its job on my system, so I'm using /etc/init.d/xps (see here) to trim more or less daily. All you have to do is to uncomment the relative line in the script. It is assumed that the laptop is turned off at least once per day.

To use anacron to trim / daily, use this simple script: You can also uncomment the last line of the script to have a simple log and see if / is trimmed.

Intel Rapid Start Technology

The driver for this feature has been around for a while now, but it's not always enabled.
A special partition is required for this to work, read the post linked. The regular version of the XPS 13 comes with the partition, I'm not sure the dev edition has it.

To know if the driver is available, run the following command: If you don't get any output or the result is: then you have to manually build the driver.
Note that the driver is needed to change the timeout. If you have the needed partition, the BIOS will automatically enable Intel Rapid Start (unless differently specified in the BIOS) with a timeout of 120 minutes.

I noticed however that the laptop takes quite a while to resume. A resume from a manual hibernation is way faster.
(21 August 2014) After some tests I found that the firmware will write to disk all the non-zero bytes of the RAM.
Unfortunately, right a reboot the RAM is not zero-filled. That means the firmware will write to disk several useless megabytes, making the suspension really slow.
For this reason I wrote a simple C programs which zero-fills the free RAM. Here the binary and here the source code.
Running it once after a reboot is enough to improve the speed, but you could also make it run automatically everytime the laptop is suspended. If you are using systemd, you can do that creating /lib/systemd/system-sleep/irs.sh

Build the module

First, follow the steps of Build kernel modules. After that, enable the build of the driver (it's preferable to use make menuconfig for this): Build the modules: Load the module: Move the module to automatically load it on boot through /etc/init.d/xps (see here): This has to be done for each major kernel release.

Intel Smart Connect

Here the help of INTEL_SMARTCONNECT which quickly what it is and what the kernel can do:

Intel Smart Connect is a technology intended to permit devices to
update state by resuming for a short period of time at regular
intervals. If a user enables this functionality under Windows and
then reboots into Linux, the system may remain configured to resume
on suspend. In the absence of any userspace to support it, the system
will then remain awake until something triggers another suspend.

This driver checks to determine whether the device has Intel Smart
Connect enabled, and if so disables it.

You can disable this feature from the BIOS or if you want to use it from Windows, follow the instructions here below.

To know if you have the driver is available, run: If you don't get any output or the result is: then you have to manually build the driver.
First, follow the steps of Build kernel modules. After that, enable the build of the driver (it's preferable to use make menuconfig for this): Build the modules: Load the module: Move the modules to automatically load it on boot through /etc/init.d/xps (see here): This has to be done for each major kernel release.

Keyboard backlight

There are three different illumination modes available: on, off and auto.
auto is the default mode and set the illumination in base of the ambient light. This mode is disabled once the backlight is manually changed with Fn+F6, which switches to either on or off.
libsmbios allows you to switch mode from the command line, however setting auto has no effect and a reboot is required.

Install libsmbios: smbios-token-ctl is not properly working on my system, here a patch, which can be applied on the fly with: From the output of: you can see the three different modes for the keyboard backlight: To change mode, you have to run, for example:

(13 August 14) From Windows you have the possibility to set the keyboard backlight to auto, change it to manual and control the intensity without touching the Fn keys.
Moreover, you are allowed to set the backlight timeout.
I wrote four simple ACPI methods you can inject and a simple driver that exposes a sysfs interface to control both the timeout and the backlight intensity. The keyboard backlight timeout stick across reboots. There's no way to set the keyboard backlight to auto.
Here the AML code of the methods and the driver to control the backlight. Read this to know how to add the custom methods.

Headset/headphones background noise

Kernel v3.16+

No changes required. Revert all the previous changes you may have done:

If you want to backport the kernel patches, pick the followings: 5e6db669 033b0a7c. These patches will allow you to keep the power saving mode enabled.

Older kernels

When headphones are used, a constant white noise can be heard. A simple script can fix the problem.

Create /usr/local/bin/white_noise_fix.py After that, disable the power saving mode of the audio card to prevent pop noises, electrical noises and, more importantly, the white noise, which otherwise will come back: and to make the changes effective without a reboot: If you created /etc/init.d/xps (see here), then the script is automatically run on boot (update the script if you downloaded it before 15 May 14).

In /etc/init.d/xps there's also a line which unloads snd_hda_intel right before the machine is turned off. This will avoid a pop noise which can be heard as soon as the computer turns off (there's still a pop noise though).

Unsolved issues

Electrical noises

This laptop is known for the elec noises it makes. Unfortunately, there are no known solutions. I can hear two different kind of noises. One is an high pitched noise, which usually goes away turning either on or off the backlight keyboard. It seems that plugging/unplugging the AC and changing the keyboard backlight changes the state in which the noise is heard (backlight on or off).
It seems that Dell acknowledged this issue and is working on a remodeled board. More info here.

The other noise seems to be related to the CPU and it's not as loud as the other. I can hear it only when plugged in and it follows my actions. Forcing specific C state causes that noise, for example (run as root):

and to restore everything:

Slow brightness keys

My Fn brightness keys works, I can change the brightness, however they are pretty slow. If I keep Fn+F5 (brightness up) for a while and immediately after that Fn+F4 (brightness down), the brightness will decrease after a while, only after all the Fn+F5 previously sent and slowly processed are finished.

I noticed that something weird happens also with Windows. If I increase the brightness and quickly decrease it, what happens is that initially the brightness increases as expected, as soon as I decrease it, the brightness decreases, but immediatel after that it increases once and then decreases again.

Misc

Build kernel modules

Here a small guide to build kernel modules. The following steps has to be done only once. After that, whenever these steps are mentioned, simply 'cd' into the kernel source tree and skipt all the steps here below.

Make sure the kernel headers are available: Download the kernel source code (it will be saved in your current directory): Copy the headers: Prepare for build:

Heat/Noise

In general this laptop is quiet and runs cool, but you can do some changes to better fit your needs.

There's a kernel module which allows you to control the speed of the fan, but unfortunately it only allows you to set three different speeds when in reality there are many more speeds available. The modules is i8k and must be forcefully loaded. I also suggest to pass another parameter to get a more realistic fan speed (I don't know the correct factor):

Take a look at i8kutils to easily control the speed of the fan. Note that often it's packaged with a daemon that will take control of the fan

However, I suggest you to take a look at thermald which takes advantage of the various features of the CPU.
With a proper config you can keep the laptop below a certain temperature without having the fan spinning at its max speed.