How to Get Everything Working Nicely in FreeBSD on the UX31E including Suspend/Resume

FreeBSD on the Zenbook UX31E

Current Status

The UX31E is useable with minor effort in FreeBSD 10.2.  I will update this page with new information if an when I get some of the broken things working.

What Works?

  • Wireless
  • Audio
  • Suspend / Resume
  • Some Function Hot-Keys
    • Sleep
    • Brightness Up / Down
    • Monitor Off
    • Volume Up / Down (Requires acpi_asus_wmi kernel module)
  • All keystroke combinations that send normal keyboard output
    • e.g. [fn + Left] for [Home], [fn + Right] = [End], etc.

What Doesn't Work?

  • Some Function Hot-Keys
    • Toggle WiFi LED
      • LED is inverted for on / off states without acpi_asus_wmi.
      • LED is always off when acpi_asus_wmi is loaded.
    • Toggle Touchpad

Annoyances

The touchpad is recognized as generic ps/2 mouse by the psm driver.  This is a known problem with Elantech (Synaptics compatible) touchpads, and I have yet to find a real solution to get multitouch working.  The psm driver seems to ignore any of the hardware's output that can't be mapped to a normal mouse.  For instance: having two fingers on the touchpad results in no data being sent from psm to the OS.  This has been a known issue since 2012, but I don't know if anyone is working to correct it.

Things I Haven't Tested

  • Web Cam
  • Bluetooth
  • Card Reader

You should use vt / Newcons if you plan to use Xorg.

If you are using Syscons, you won't be able to get graphics card output on the console after starting Xorg.  You won't recognize the problem right away, but if you exit Xorg, or try to switch back to a virtual terminal with [Alt+F2] (or similar), you will see only a black screen.  A that point you would either have to reboot the laptop via the keyboard with no visual queues ... or you could hold down the power button until it shuts off.  It presents a rather serious hurdle to usability, so recommend enabling vt.

The vt project (formerly Newcons) was started to provide unicode and graphics support to virtual terminals on the console in FreeBSD.  It is not enabled by default.  You will need to add the following lines to /boot/loader.conf.

i915kms_load="YES"
kern.vty=vt
hw.vga.textmode=0
kern.vt.fb.default_mode="1600x900"

The first line loads the i915kms graphics driver.  This is the driver for the UX31E's integrated intel graphics on its ivybridge processor. Line two (kern.vty=vt) simply tells the system to use the new vt console driver.  The third line (hw.vga.textmode=0) tells vt to use graphics mode instead of text mode. That should be the default, so it may not need to be set manually.  However, I prefer to keep things explicit just in case the defaults change after a system update.  Line four (kern.vt.fb.default_mode="1600x900") sets the default resolution on the console to match the UX31E's screen at 1600x900.  You will need to reboot the system as the settings on the last three lines can only be changed at boot time.

(You might want to hold off on rebooting if you are following this step by step.  This is the not the last task listed that will require a reboot.)

Getting Suspend and Resume to Work

I had tried getting proper suspend working in earlier versions of FreeBSD. In 10.0, I was able to get it to work on the console only - If you tried to suspend while Xorg was running, the video card failed and I also ran into trouble with USB. I tried again shortly after the release of 10.2 and was pleasantly surprised (I'm lying, I actually got really excited).  "Out of the box" with 10.2, suspend and resume works from both the console and from Xorg with only one caveat.  Upon resume, the touchpad stops working.  This is easily corrected by adding the following line to /boot/loader.conf.

hint.psm.0.flags="0x6000"

Tuning Power Consumption

Without tuning for power consumption, our ability run on battery will become limited and defeat the purpose of using an ultraportable like the UX31E.  You will also find tha the aluminum chassis will run hot until you start to tackle the issue.  There have been lots of good articles on the web about Tuning power consumption in freebsd - a quick google search pulls up the popular ones:

I will be documenting my efforts and their results here.

Without making any changes, the zenbook seems to constantly draw 11 to 11.2 watts from the battery.  Let's see if we can reduce that figure. Let's start with powerd.

Let's enable and configure powerd by putting the following into /etc/rc.conf.

### enable Powerd and set C states ###
powerd_enable="YES"
powerd_flags="-a hadp -b adp -i 50 -m 800 -M 1601 -n adp -p 250 -r 90"
performance_cx_lowest="Cmax"
economy_cx_lowest="Cmax"

I also went with the following lines added to /boot/loader.conf based on suggestions from the power tuning guides listed above.

### power tuning by the book
hint.p4tcc.0.disabled=1
hint.acpi_throttle.0.disabled=1
drm.i915.enable_rc6=7
hw.pci.do_power_nodriver=3
hw.snd.latency=7

These efforts, combined, brought idle power consumption down to 7.6 - 7.8 watts (30% less power usage).  Next we'll see where else we can find power savings.  Maybe we can turn off some unused components.

To be Continued ...

This is a work in progress - more information will be added as time permits.