Code Monkey home page Code Monkey logo

surface-control's Introduction

Linux Surface

Linux running on the Microsoft Surface devices. Follow the instructions below to install the latest kernel.

Announcements and Updates | Upstream Status

Why / About this Project

These days, Linux supports a lot of devices out-of-the-box. As a matter of fact, this includes a good portion of the Microsoft Surface devices—for most parts at least. So why would you need a special kernel for Surface devices? In short, for the parts that are not supported upstream yet.

Unfortunately, Surface devices tend to be a bit special. This is mostly because some hardware choices Microsoft made are rarely (if at all) used by other, more "standard", devices. For example:

  • Surface devices (4th generation and later) use their own embedded controller (the Surface Aggregator Module, or SAM). In contrast to other devices, however, some newer Surface devices route their keyboard and touchpad input via this controller. Unfortunately, every new Surface device requires some (usually small) patch to enable support for it, since devices managed by SAM are generally not auto-discoverable.
  • Surface devices (4th generation and later, excluding the Go series) use a rather special system for touch and pen input. In short, this requires user-space processing of touch and pen data to enable multitouch support and has not been upstreamed yet.
  • Surface devices rely on Intel's ISP for camera image processing. This means that the webcam also requires some user-space processing. While patches are being upstreamed, not all devices are supported (even with this project), and more work remains to be done.

We aim to send all the changes we make here upstream, but this may take time. This kernel allows us to ship new features faster, as we do not have to adhere to the upstream release schedule (and, for better or worse, code standards). We also rely on it to test and prototype patches before sending them upstream, which is crucial because we maintainers cannot test on all Surface devices (which also means we may break things along the way).

So should you install this custom kernel and the associated packages? It depends: We generally recommend you try your standard distribution kernel first. If that works well for you, great! But if you're missing any features or experiencing issues, take a look at our feature matrix and give our kernel and packages a try. If your device is not listed as supported yet, feel free to open an issue.

Supported Devices

  • Surface Book
  • Surface Book 2
  • Surface Book 3
  • Surface 3
  • Surface Go
  • Surface Go 2
  • Surface Go 3
  • Surface Laptop
  • Surface Laptop 2
  • Surface Laptop 3
  • Surface Laptop 4
  • Surface Laptop 5
  • Surface Laptop Go
  • Surface Laptop Go 2
  • Surface Laptop Studio
  • Surface Pro 1
  • Surface Pro 3
  • Surface Pro 4
  • Surface Pro (5th Gen) / Surface Pro 2017
  • Surface Pro 6
  • Surface Pro 7
  • Surface Pro 7+
  • Surface Pro 8
  • Surface Pro 9
  • Surface Studio

Features / What's Working

See the feature matrix for more information about each device.

Disclaimer

  • For the most part, things are tested on a Surface Book 2. While most things are reportedly fully working on other devices, your mileage may vary. Please look at the issues list for possible exceptions.

Installation and Setup

We provide package repositories for the patched kernel and other utilities. Please refer to the detailed installation and setup guide. There, you may also find device-specific caveats. In case you have disk encryption set up or plan to use it, take care to follow the respective instructions in the installation guide and have a look at the respective wiki page. After installation, you may want to have a look at the wiki and the contrib/ directory for useful tweaks.

If you want to compile the kernel yourself (e.g. if your distribution is not supported), please have a look at the wiki.

Additional Information

Notes

  • If you are getting stuck at boot when loading the ramdisk, you need to install the Processor Microcode Firmware for Intel CPUs (usually found under Additional Drivers in Software and Updates).
  • Using TLP can cause slowdowns, laggy performance, and occasional hangs if not configured properly! You have been warned.
  • If you want to use hibernate instead of suspend, you need to create a swap partition or file, please follow your distribution's instructions (or here).

Support

If you have questions or need support, please join our Matrix Space! This space contains

License

This repository contains patches, which are either derivative work targeting a specific already licensed source, i.e. parts of the Linux kernel, or introduce new parts to the Linux kernel. These patches fall thus, if not explicitly stated otherwise, under the license of the source they are targeting, or if they introduce new code, the license they explicitly specify inside of the patch. Please refer to the specific patch and source in question for further information. License texts can be obtained at https://github.com/torvalds/linux/tree/master/LICENSES.

surface-control's People

Contributors

danielzgtg avatar fabwu avatar qzed avatar stolld avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

surface-control's Issues

Udev rules are for old performance mode driver

The udev rules that allow normal users to change the mode are still for the old performance driver /sys/bus/surface_aggregator/devices/01:03:01:00:01/perf_mode

I have tried an updated rules set (below), but unfortunately I can't get it to work, I have never had much success getting my head around udev.

ACTION=="add" KERNEL=="acpi" RUN+="/usr/bin/chmod 664 /sys/firware/acpi/platform_profile"
ACTION=="add" KERNEL=="acpi" RUN+="/usr/bin/chown root:surface-control /sys/firware/acpi/platform_profile"

SB2 (13") surface performance : device not found

When I issue :

surface performance get

I receive

Error : cannot access device
Surface performance-mode device not found

In /sys/devices/platform/MSHW0107\:00 I just have :

driver_override  modalias   uevent driver                    firmware_node    subsystem

But all surface_* modules are currently loaded in the surface kernel 4.19.146

Am I missing something ?

Regards

surface dgpu set no longer working

Hi I recently reinstalled my setup and noticed that sudo surface dgpu get was no longer working. (An error about file not found).

According to the wiki on the surface aggregator module, this is no longer supported in the latest kernels. Could I just verify that this is the case?

Checked /sys/devices/platform/MSHW0153:00 and noticed that there is no dgpu_power there.

Edit:
Kernel: 5.9.6-arch-surface

Building is not deterministic - ordering of subcommands

Hi, I am building from source and noticed that repeated builds are not identical.

Steps to reproduce:

Run cargo run -- --help twice (or more).
The order the subcommands appear in is different and seems random

This also affects the generated shell completion files which also depend on the same ordering.

Could we force an ordering of the subcommands (i.e. alphabetically by their name)?

2 outputs of ` cargo run`
Commands:
  dgpu     Control the discrete GPU
  profile  Control or query the current platform profile
  status   Show an overview of the current system status
  dtx      Control the latch/dtx-system on the Surface Book 2
  help     Print this message or the help of the given subcommand(s)

Commands:
  profile  Control or query the current platform profile
  status   Show an overview of the current system status
  dtx      Control the latch/dtx-system on the Surface Book 2
  dgpu     Control the discrete GPU
  help     Print this message or the help of the given subcommand(s)

No perf_mode file in sysfs [Surface Pro 2017 - m3 7Y30 4GB]

Running surface performance get yields:

Error: Failed to get current performance mode

Caused by:
    0: Could not access device "/sys/bus/surface_aggregator/devices/01:03:01:00:01/perf_mode"
    1: No such file or directory (os error 2)

running surface-kernel with Arch Linux:

% uname -r
5.12.2-arch1-3-surface

I just installed Arch with the surface-kernel and thought it should work like this.
Did I do something wrong?

SB3 - Could not access device

performance modes don't appear to be working on the SB3, I can query the status with surface status but I'm unable to set performance modes

$ surface performance set 4
Error: Failed to get current performance mode

Caused by:
    0: Could not access device "/sys/bus/surface_aggregator/devices/01:03:01:00:01/perf_mode"
    1: No such file or directory (os error 2)

Device '01:03:01:00:01' is inaccessible on SB3

Hello to whoever sees this,
Whenever I want to set the performance mode for my Surface Book 3, it outputs [Could not access device "/sys/bus/surface_aggregator/devices/01:03:01:00:01/perf_mode"].
Whenever I go to the folder and try to create the perf_mode file as root, it does not allow me. How can i fix this (i am using Linux Mint by the way)?
A screenshot is attached below.
Screenshot from 2021-12-13 16-19-01
.

Error: No devices found -- Cannot seem to edit performance mode or profile or read status

Hello. I am using a Surface Pro 4. I installed Regolith linux (ubuntu derivative) and then the lts of linux-surface kernel as specified in that repo's wiki. Now though I do not seem to be able to edit the performance mode or even get status. Can you please advise next steps? I am happy to provide any missing info. If you think this belongs in issues for another repo I am happy to move it. Below I include some info that I hope will be useful. Thank you.

c@c-Surface-Pro-4:~$ surface -V
surface 0.4.1
c@c-Surface-Pro-4:~$ surface status
Error: No devices found
c@c-Surface-Pro-4:~$ surface pe get
Error: Failed to open performance mode device

Caused by:
    0: Could not access device "/sys/bus/surface_aggregator/devices/01:03:01:00:01"
    1: No such file or directory
c@c-Surface-Pro-4:~$ surface pr list
Error: Failed to open platform profile device

Caused by:
    0: Could not access device "/sys/firmware/acpi/"
    1: No platform profile support found
c@c-Surface-Pro-4:~$ uname -a
Linux c-Surface-Pro-4 5.14.6-surface #1 SMP Mon Sep 20 14:48:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Also maybe relevant:

c@c-Surface-Pro-4:~$ find /sys/bus/surface_aggregator/
/sys/bus/surface_aggregator/
/sys/bus/surface_aggregator/uevent
/sys/bus/surface_aggregator/drivers_autoprobe
/sys/bus/surface_aggregator/devices
/sys/bus/surface_aggregator/drivers_probe
/sys/bus/surface_aggregator/drivers
/sys/bus/surface_aggregator/drivers/surface_aggregator_base_hub
/sys/bus/surface_aggregator/drivers/surface_aggregator_base_hub/uevent
/sys/bus/surface_aggregator/drivers/surface_aggregator_base_hub/bind
/sys/bus/surface_aggregator/drivers/surface_aggregator_base_hub/unbind
/sys/bus/surface_aggregator/drivers/surface_aggregator_base_hub/module

How to change the default settings for the dgpu

Whenever I reboot, the dgpu turns off and I would have to manually switch it up again. I'm suspecting this is causing some issue with loading NVIDIA/CUDA libraries.

I'm wondering if there is an option to keep the dgpu in an 'on' status by default.

SB3 13" - Error: Failed to get current performance mode

Fresh install of the latest surface kernel and surface-control (via the AUR).

Typing the following command yields the subsequent response:

**sudo surface performance set 2**
Error: Failed to get current performance mode

Caused by:
    0: Could not access device "/sys/bus/surface_aggregator/devices/01:03:01:00:01/perf_mode"
    1: No such file or directory (os error 2)

It may be simply the SB3 is unsupported, but I am unsure how to control dGPU otherwise. Similarly, dtx functions are not working.

surface: command not found

Hi, qzed!
First, thank you for your hard work to provide us this convenient command line tool!
I want to try it so I downloaded it and build from source on my surfacebook2. However, I'm not familiar with cargo and rust, I followed the instructions in the README file, and get this output:

...
Finished dev [unoptimized + debuginfo] target(s) in 16.19s                  
     Running `target/debug/surface`

surface 0.2.1
Maximilian Luz <[email protected]>
Control various aspects of Microsoft Surface devices

USAGE:
    surface [FLAGS] <SUBCOMMAND>

FLAGS:
    -h, --help       Prints help information
    -q, --quiet      Keep output quiet
    -V, --version    Prints version information

SUBCOMMANDS:
    dgpu           Control or query the dGPU power state on the Surface Book 2
    help           Prints this message or the help of the given subcommand(s)
    latch          Control the latch/dtx-system on the Surface Book 2
    performance    Control or query the current performance-mode
    status         Query the current system status

But when I tried to type some commands to see whether it works, I got the "surface: command not found" information. I'm not very clear about how to set it up. Would you please help me with it? Thanks~

Android x86

I'm trying to add surface-control to my Android x86 device, but I get no such file or directory when I try to run it on kernel 5.8 with all the patches applied. (it does exist in /bin and it's executable). Are there any dependencies I might be missing?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.