This post serves mostly as a note to myself in case I need to reinstall FreeBSD on my Zenbook. Hopefully it can be of help to someone else on how to get FreeBSD working on their Asus Zenbook UX32VD. Some settings here are based on my own preference, such as keyboard layout and so on.
Graphics / video
The Zenbook has two graphics card, the integrated Intel card and a discrete nVidida GeForce 620M.
The discrete graphics card
I don’t use the discrete graphics card, and since FreeBSD dosen’t support Optimus, I shut it down to save battery power. This gives me roughly double the battery power.
acpi_call program is needed and installed with
acpi_call. Then we need a small script to shut down the GPU. The script is
turn_off_gpu.sh. Fetch it
Make it executable and place it in /etc/rc.local. If no /etc/rc.local exist, create it and make it executable.
Also make sure to put this line in /boot/loader.conf:
The Intel graphics card
The Intel card “just works”, after installing the xf86-video-intel package for
Xorg. Install it with
pkg install xf86-video-intel.
To get a higher resolution in the console, and enable some power savings, place these two lines in /boot/loader.conf:
To give your user permission to use accelerated graphics, for example libGL with Firefox, you also need to take the steps listed below:
- Add your user to the video and operator group with
pw groupmod video -m your-userand
pw groupmod operator -m your-user
echo "add path 'dri/*' mode 0666 group operator" >> /etc/devfs.rules
Screen & keyboard backlight
Start with adding these lines to /boot/loader.conf:
acpi_asus_wmi_load="YES" acpi_asus_load="YES" acpi_video_load="YES"
Reboot your machine and the keyboard backlight should be adjustable with the keys Fn+F3 and Fn+F4. The keys to adjust the screen backlight dosen’t work however, but there is a small program for this, called intel_backlight at Github.
Download it (Clone or download zip-file) and run the following commands as root.
cd intel_backlight_fbsd make make install
A setuid’d program called
intel_backlight is now installed and can be executed
as a regular user to adjust the screen backlight with
intel_backlight 35 to
set the screen brightness to 35%. To always start at 35% I placed this in
Getting two-finger scroll to work
As of FreeBSD 11.1-RELEASE there is support for the Elantech touchpad which is the touchpad that’s in the Zenbook. Add this line to /boot/loader.conf:
I noticed that you’ll also need to run the
moused daemon to get the touchpad
to work correctly so add this line to /etc/rc.conf:
Now you can reboot once again and two-finger scrolling among other things should now be working correctly.
More power savings
Add the following two lines to /etc/rc.conf to active
powerd daemon and to
enable power saving features on the Intel WLAN card. Note: change or skip the
WLAN country settings to your own preference. The important keyword for
powersave. This saves about 2W on my computer.
powerd_enable="YES" create_args_wlan0="country SE regdomain ETSI powersave"
All in all FreeBSD gives me about an extra hour of battery power compared to Debian Linux.
Suspend / resume
Suspend and resume works out of the box on my Zenbook, even with the Zz button (Fn+F1). If you want to suspend your laptop when you close the lid, you need to add the following to /etc/rc.conf:
I personally don’t use this, since I like to be able to close the lid without interupting the network and my VPN-tunnels.
Issues with suspend / resume
Even though suspend/resume works out of the box (FreeBSD 11.1), there is an
issue I haven’t yet been able to resolve. Once I have resumed my laptop, the
power consumption goes up about 5W, which is much. At first I thought it was the
discrete graphics card that woke up, so I’ve tried running
again and again, but to no avail.
The problem described above was in fact caused by the discrete graphics card
waking up after a resume. But to be able to turn it off again I first had to
turn it on and then off again with
acpi_call. I also noticed another problem;
after a resume the display brightness went up to 100%. This was fixed along with
the above problem.
If you have already run
turn_off_gpu.sh take a look at the saved method in
.gpu_method. The file most likely resides in either /root or / dependning
on whatever you have run it interactive as root or from /etc/rc.local.
Copy the method from that file, which is everything after the equal sign. Then
in /etc/rc.resume add these lines just before the
sleep 4 /usr/local/bin/intel_backlight 35 /usr/local/sbin/acpi_call -p "\_SB.PCI0.PEG0.PEGP._ON" -o i sleep 2 /usr/local/sbin/acpi_call -p "\_SB.PCI0.PEG0.PEGP._OFF" -o i
The first sleep is so that all devices has a chance to turn on. Then I lower the screen backlight to 35. The last three lines are to turn turn off the discrete graphics card (on and then off again).
Summary of all my config files
i915kms_load="YES" drm.i915.enable_rc6=7 acpi_call_load="YES" acpi_asus_wmi_load="YES" acpi_asus_load="YES" acpi_video_load="YES" hw.psm.elantech_support=1
hostname="elektra" keymap="se" wlans_iwn0="wlan0" ifconfig_wlan0="WPA DHCP" ifconfig_wlan0_ipv6="inet6 accept_rtadv" create_args_wlan0="country SE regdomain ETSI powersave" ifconfig_ue0="DHCP" ifconfig_ue0_ipv6="inet6 accept_rtadv" sshd_enable="YES" ntpd_enable="YES" dumpdev="AUTO" dbus_enable="YES" hald_enable="YES" moused_enable="YES" powerd_enable="YES"
#!/bin/sh /root/turn_off_gpu.sh /usr/local/bin/intel_backlight 35
# At the end of the file (leave original content as is) sleep 4 /usr/local/bin/intel_backlight 35 /usr/local/sbin/acpi_call -p "\_SB.PCI0.PEG0.PEGP._ON" -o i sleep 2 /usr/local/sbin/acpi_call -p "\_SB.PCI0.PEG0.PEGP._OFF" -o i exit 0
For swedish users
I live in Sweden and use UTF-8 as the default charset. In my /etc/login.conf I have added these two lines at the bottom of the default class:
You need to run
cap_mkdb /etc/login.conf for these changes to have any effect,
and either do a reboot and logout/login.
I use the Mate desktop and start X from the console with
startx. This is
what’s in my .xinitrc to set my keyboard layout to swedish and start Mate:
setxkbmap se & mate-session
I am really happy with this setup, and I hope this can help someone else to get FreeBSD running on their own Zenbook.
I’ve just ordered a new battery for my Asus Zenbook, since my old one had degraded to about 65% capacity. My new battery has a 99.9% capacity which is really good for a replacement battery!
With FreeBSD, the power saving options and my new battery, I get a whopping 6:43 hours of battery time! That’s the longest battery time I’ve ever had on my Zenbook. With Debian Linux, when my laptop was brand new, I got about 4:45 hours of battery life. Almost two hours longer on FreeBSD!
jake@elektra:~$ acpiconf -i0 Design capacity: 48248 mWh Last full capacity: 48181 mWh Technology: secondary (rechargeable) Design voltage: 7400 mV Capacity (warn): 4824 mWh Capacity (low): 481 mWh Low/warn granularity: 481 mWh Warn/full granularity: 481 mWh Model number: UX32-65 Serial number: Type: LIon OEM info: ASUSTeK State: discharging Remaining capacity: 100% Remaining time: 6:43 Present rate: 7170 mW Present voltage: 7400 mV