Skip to content

Microsoft Surface Pro - Not detecting the Battery #1612

@Peritia-System

Description

@Peritia-System

Hi there,

I can’t get the battery to show up on my Surface devices.
From my perspective the config should work, but it only detects the AC adapter.
I also tested on two different Surfaces, so it doesn’t seem to be hardware related.
I couldn't find an Issue related to this problem nor that it is known not to work.

Here the Code Snippets:

# hardware-configuration.nix
  boot.initrd.availableKernelModules = ["xhci_pci" "nvme"];
  boot.initrd.kernelModules = [];
  boot.kernelModules = ["kvm-intel"];
  boot.extraModulePackages = [];
 # rest of the Hardware configuration ....

I am using the kernelVersion = "stable";

# Additional-Hardware-config.nix
    hardware.microsoft-surface.kernelVersion = "stable";
    # boot.kernelPackages = pkgs.linuxPackages_6_6; # normally set by nixos-hardware

    # Extra kernel modules
    boot.kernelModules = [ "hid-microsoft" "battery" "ac" ];

    hardware.enableAllFirmware = true;
    # Initrd modules — required for Surface hardware to function
    boot.initrd.kernelModules = [
      # Surface Aggregator Module (SAM): buttons, sensors, keyboard
      "surface_aggregator"
      "surface_aggregator_registry"
      "surface_aggregator_hub"
      "surface_hid_core"
      "surface_hid"

      # Intel Low Power Subsystem (keyboard, I2C, etc.)
      "intel_lpss"
      "intel_lpss_pci"
      "8250_dw"
    ];

    environment.systemPackages = with pkgs; [
      #for camera
      libcamera

      # for Battery 
      tlp
      upower
      acpi
    ];

    # IPTSd not required — touchscreen and pen work via HID
    services.iptsd.enable = lib.mkForce false;

    services.thermald = {
      enable = true;
      configFile = ./thermal-conf.xml;
      # Example: extra options if needed
      # extraOptions = [
      #   "--adaptive"
      #   "--max-temperature=65"
      # ];
    };

here maybe some additional information:

dmesg | grep -i battery

… surface_acpi_notify … battery … surface_hid …

cat /sys/class/power_supply/*/uevent

DEVTYPE=power_supply
POWER_SUPPLY_NAME=ADP1
POWER_SUPPLY_TYPE=Mains
POWER_SUPPLY_ONLINE=0
POWER_SUPPLY_TYPE=Mains

upower -e

/org/freedesktop/UPower/devices/line_power_ADP1
/org/freedesktop/UPower/devices/DisplayDevice

acpi -V

Adapter 0: off-line
Cooling 0: Processor 0 of 10
…

upower -i /org/freedesktop/UPower/devices/battery_BAT0

native-path:          (null)
power supply:         no
updated:              Do 01 Jan 1970 01:00:00 CET
has history:          no
has statistics:       no
unknown
  warning-level:       unknown
  battery-level:       unknown
  percentage:          0% (should be ignored)
  icon-name:          '(null)'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions