OpenBSD on the Microsoft Surface Go

By joshua stein

For some reason I like small laptops and the constraints they place on me (as long as they're still usable). I used a Dell Mini 9 for a long time back in the netbook days and was recently using an 11" MacBook Air as my primary development machine for many years. Recently Microsoft announced a smaller, cheaper version of its Surface tablets called Surface Go which piqued my interest.

Hardware

The Surface Go is available in two hardware configurations: one with 4Gb of RAM and a 64Gb eMMC, and another with 8Gb of RAM with a 128Gb NVMe SSD. (I went with the latter.) Both ship with an Intel Pentium Gold 4415Y processor which is not very fast, but it's certainly usable.

The tablet measures 9.65" across, 6.9" tall, and 0.3" thick. Its 10" diagonal 3:2 touchscreen is covered with Gorilla Glass and has a resolution of 1800x1200. The bezel is quite large, especially for such a small screen, but it makes sense on a device that is meant to be held, to avoid accidental screen touches.

The keyboard and touchpad are located on a separate, removable slab called the Surface Go Signature Type Cover which is sold separately. I opted for the "cobalt blue" cover which has a soft, cloth-like alcantara material. The cover attaches magnetically along the bottom edge of the device and presents USB-attached keyboard and touchpad devices. When the cover is folded up against the screen, it sends an ACPI sleep signal and is held to the screen magnetically. During normal use, the cover can be positioned flat on a surface or slightly raised up about 3/4" near the screen for better ergonomics. When using the device as a tablet, the cover can be rotated behind the screen which causes it to automatically stop sending keyboard and touchpad events until it is rotated back around.

The keyboard has a decent amount of key travel and a good layout, with Home/End/Page Up/Page Down being accessible via Fn+Left/Right/Up/Down but also dedicated Home/End/Page Up/Page Down keys on the F9-F12 keys which I find quite useful since the keyboard layout is somewhat small. By default, the F1-F12 keys do not send F1-F12 key codes and Fn must be used, either held down temporarily or Fn pressed by itself to enable Fn-lock which annoyingly keeps the bright Fn LED illuminated. The keys are backlit with three levels of adjustment, handled by the keyboard itself with the F7 key.

The touchpad on the Type Cover is a Windows Precision Touchpad connected via USB HID. It has a decent click feel but when the cover is angled up instead of flat on a surface, it sounds a bit hollow and cheap.

The touchscreen is powered by an Elantech chip connected via HID-over-i2c, which also supports pen input. A Surface Pen digitizer is available separately from Microsoft and comes in the same colors as the Type Covers. The pen works without any pairing necessary, though the top button on it works over Bluetooth so it requires pairing to use. The Surface Pen can attach magnetically to the left side of the screen when not in use.

A kickstand can swing out behind the display to use the tablet in a laptop form factor, which can adjust to any angle up to about 170 degrees. The kickstand stays firmly in place wherever it is positioned, which also means it requires a bit of force to pull it out when initially placing the Surface Go on a desk.

Along the top of the display are a power button and physical volume rocker buttons. Along the right side are the 3.5mm headphone jack, USB-C port, power port, and microSD card slot located behind the kickstand.

Charging can be done via USB-C or the dedicated charge port, which accomodates a magnetically-attached, thin barrel similar to Apple's first generation MagSafe adapter. The charging cable has a white LED that glows when connected, which is kind of annoying since it's near the mid-line of the screen rather than down by the keyboard. Unlike Apple's MagSafe, the indicator light does not indicate whether the battery is charged or not. The barrel charger plug can be placed up or down, but in either direction I find it puts an awkward strain on the power cable coming out of it due to the vertical position of the port.

Wireless connectivity is provided by a Qualcomm Atheros QCA6174 802.11ac chip which also provides Bluetooth connectivity.

Most of the sensors on the device such as the gyroscope and ambient light sensor are connected behind an Intel Sensor Hub PCI device, which provides some power savings as the host CPU doesn't have to poll the sensors all the time.

Firmware

The Surface Go's BIOS/firmware menu can be entered by holding down the Volume Up button, then pressing and releasing the Power button, and releasing Volume Up when the menu appears. Secure Boot as well as various hardware components can be disabled in this menu. Boot order can also be adjusted. A temporary boot menu can be brought up the same way but using Volume Down instead.

Installing OpenBSD

Installation was very easy, with the Type Cover keyboard working out of the box and most of the hardware being standard PC components.

To boot the OpenBSD installer, dd the install64.fs image to a USB disk, enter the BIOS as noted above and disable Secure Boot, then set the USB device as the highest boot priority.

When partitioning the 128Gb SSD, one can safely delete the Windows Recovery partition which takes up 1Gb, as it can't repair a totally deleted Windows partition anyway and a full recovery image can be downloaded from Microsoft's website and copied to a USB disk.

After installing OpenBSD but before rebooting, mount the EFI partition (sd0i) and delete the /EFI/Microsoft directory. Without that, it may try to boot the Windows Recovery loader. OpenBSD's EFI bootloader at /EFI/Boot/BOOTX64.EFI will otherwise load by default.

Note: If the touchpad is touched or F1-F6 keys are pressed during installation, the Type Cover will detach all of its USB devices and then reattach them, which can be annoying. This happens because the ramdisk does not contain touchpad drivers or anything to support the USB HID consumer controls for F1-F6, so the USB pipes for those devices are not open, so nothing responds to the Type Cover when it has data to send on them. Presumably the Type Cover is restarting itself in this situation as a failsafe to force it to reattach, rather than requiring the user to detach the cover and reattach it.

This won't happen for the touchpad once the normal kernel is booted since it contains the umt driver. See my notes below for using usbhidcontrol to respond to the F1-F6 keys which will keep the proper USB pipe open to prevent the detach/reattach when using these keys.

OpenBSD Support

Status is relative to OpenBSD-current as of 2018-08-31.

Component Works? Notes
AC adapter Yes Supported via acpiac and status available via apm and hw.sensors, also supports charging via USB-C.
Ambient light sensor No Connected behind a PCI Intel Sensor Hub device which requires a new driver.
Audio Yes HDA audio with a Realtek 298 codec supported by azalia.
Battery status Yes Supported via acpibat and status available via apm and hw.sensors.
Bluetooth No Atheros device, shows up as a ugen device but OpenBSD does not support Bluetooth. Can be disabled in the BIOS.
Cameras No There are apparently front, rear, and IR cameras, none of which are supported (nor desired). Can be disabled in the BIOS.
Gyroscope No Connected behind a PCI Intel Sensor Hub device which requires a new driver which could feed our sensor framework and then tell xrandr to rotate the screen.
Hibernation Yes Works fine from ZZZ.
MicroSD slot Yes Realtek RTS522A, supported by rtsx.
SSD Yes Toshiba NVMe device accessible via nvme.
Surface Pen Yes Works on the touchscreen via ims. The button on the top of the pen requires Bluetooth support so it is not supported. Due to dwiic still requiring polling for these chipsets, drawing with the pen is not as smooth as it could be with proper interrupts.
Suspend/resume Yes Works fine from zzz and by closing the Type Cover against the screen. It does not wake up automatically when the Type Cover is removed, but pressing the power button will wake it up.
Touchscreen Yes HID-over-I2C, supported by imt in my tree as it's not a Windows Precision Touchpad device but does support similar multitouch packets. I still need to figure out how to properly integrate support for these devices into imt/umt.
Type Cover Keyboard Yes USB, supported by ukbd. 3 levels of backlight control are adjustable by the keyboard itself with F7. F1-F6 key actions come through on report 3 and can be responded to with usbhidaction -u 045e:096f -r 3.
Type Cover Touchpad Yes USB, supported by my new umt driver for 5-finger multitouch, two-finger scrolling, hysteresis, and to be able to disable tap-to-click.
USB Yes The USB-C port works fine for data and charging.
Video Yes inteldrm has Kaby Lake support adding accelerated video, DPMS, gamma control, integrated backlight control, and proper S3 resume.
Volume buttons Yes Intel 5-button array, supported by my new acpihid driver not yet imported upstream.
Wireless No Qualcomm Atheros QCA6174 802.11ac wireless chip, not supported. FreeBSD has a work-in-progress port of ath10k from Linux (ISC licensed) which may be possible to port. I'm currently using a tiny USB-A wireless adapter which is made less-tiny by a USB-A to USB-C adapter.