FreeBSD 10 on the Asus Zenbook UX31E

In hack on December 29, 2015 at 11:54

This laptop landed in my hands a couple weeks ago, and a quick check online suggested it was well supported by FreeBSD. So I gave it a try! It worked out of the box… nearly.


  • running FreeBSD 10.2-RELEASE
  • just works: accelerated graphics, USB, including cabled Ethernet dongle, sound
  • seems to just work: wifi, although this particular laptop tends to disassociate under heavy network load
  • works after loading a pre-installed module: special keys and backlight control
  • works after some tweaks: frequency and power management
  • works after back-porting a 11-CURRENT kernel patch: suspend/resume
  • works after back-porting a custom patch: multi-touch trackpad
  • may not work (unsure): webcam
  • not tested, should just work: integrated MMC card reader, Bluetooh


Using the default console driver, after the X server has started once the console becomes unusable (can’t restore text mode after graphics driver is initialized).

To fix this the following are needed in /boot/loader.conf [2]:

# load the kernel driver for integrated graphics
# use the new VT console driver ("newcons")
# ensure the console starts in graphics mode (should be default)
# set console resolution to match screen

Backlight control and special keys

Needs the pre-built module acpi_asus_wmi, add to /boot/loader.conf:


Tuning power consumption

See the guide in [2]. This involves:

  • enabling and configuring powerd in /etc/rc.conf:
    powerd_flags="-a hadp -b adp -i 50 -m 800 -M 1601 -n adp -p 250 -r 90"
  • adding some tweaks in /boot/loader.conf:
    ### power tuning by the book


The article in [2] suggests that suspend/resume works out of the box in FreeBSD 10. However this is not so, due to FreeBSD bug 194884: the USB devices are not set in the proper power state upon suspending.

This bug has been fixed in 11-CURRENT but I still want to use 10.2-RELEASE to benefit from freebsd-update. So I back-ported the patch:

        1. download the kernel sources from 10-STABLE
        2. apply the following patch:
          # cd /usr/src; svnlite diff
          Index: sys/dev/acpica/acpi.c
          --- sys/dev/acpica/acpi.c       (revision 292841)
          +++ sys/dev/acpica/acpi.c       (working copy)
          @@ -691,7 +691,7 @@
           static void
           acpi_set_power_children(device_t dev, int state)
          -       device_t child, parent;
          +       device_t child;
                  device_t *devlist;
                  struct pci_devinfo *dinfo;
                  int dstate, i, numdevs;
          @@ -703,13 +703,12 @@
                   * Retrieve and set D-state for the sleep state if _SxD is present.
                   * Skip children who aren't attached since they are handled separately.
          -       parent = device_get_parent(dev);
                  for (i = 0; i < numdevs; i++) {
                          child = devlist[i];
                          dinfo = device_get_ivars(child);
                          dstate = state;
                          if (device_is_attached(child) &&
          -                   acpi_device_pwr_for_sleep(parent, dev, &dstate) == 0)
          +                   acpi_device_pwr_for_sleep(dev, child, &dstate) == 0)
                                  acpi_set_powerstate(child, dstate);
                  free(devlist, M_TEMP);
          Index: sys/dev/pci/pci.c
          --- sys/dev/pci/pci.c   (revision 292841)
          +++ sys/dev/pci/pci.c   (working copy)
          @@ -3718,7 +3718,7 @@
                          child = devlist[i];
                          dstate = state;
                          if (device_is_attached(child) &&
          -                   PCIB_POWER_FOR_SLEEP(pcib, dev, &dstate) == 0)
          +                   PCIB_POWER_FOR_SLEEP(pcib, child, &dstate) == 0)
                                  pci_set_powerstate(child, dstate);
        3. build and install the kernel as usual
        4. add the following to /boot/loader.conf:
          # this is needed otherwise video may not resume:
          # this is needed otherwise the trackpad may hang after resume
        5. reboot

Trackpad is Elantech, not Synaptics

Although the trackpad is advertised as synaptics-compatible, neither of the following work as of December 2015:

        • adding hw.psm.synaptics_support=1 to /boot/loader.conf (the driver does not activate Synaptics support despite the hint)
        • forcing the Synaptics driver from package xf86-input-synaptics ( complains the Synaptics protocol is not recognized)

This is because the laptop has an Elantech trackpad, which is slightly incompatible with Synaptics.

Out of the box, the trackpad is recognized as a standard PS/2 mouse instead. In order to make it slightly less annoying you can start by enabling 3-button emulation in moused, for example in /etc/rc.conf:


However a proper fix is to add Elantech support to the psm(4) driver. I have filed this as FreeBSD bug 205690; the bug report contains a patch that you can use to add support for the trackpad in 10-STABLE. This will require a custom kernel build, and also installing the patched sys/mouse.h and moused(8).

With this installed I found the following settings in /boot/loader.conf to work best:

# disable two-finger scroll, instead the
# right area becomes a scrolling area

Note that the updated driver code has its own 3-button emulation, so be sure to remove the "-3" flag to moused if you have added it earlier.


[1] – a bit too terse to be useful, the remark on the x2apic setting may be outdated (seems to work fine without)




  1. “It worked out of the box… nearly.”

    Oh, if one only has to patch the kernel to make it work, I guess it’s ok then…

    More seriously, how much time did you spend figuring out all of this?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: