Hardware/Microsoft/Surface Go 2: Difference between revisions

From NixOS Wiki
Onny (talk | contribs)
Inital page
 
Onny (talk | contribs)
mNo edit summary
 
(6 intermediate revisions by the same user not shown)
Line 5: Line 5:
!colspan="2" class="title"|Microsoft Surface Go 2
!colspan="2" class="title"|Microsoft Surface Go 2
|-
|-
|colspan="2"|[[File:Pinebook-a64-11-glamour.jpg|frameless|256px|A Pinebook 11".]]
|colspan="2"|[[File:Microsoft surface go 2.jpg|frameless|256x256px|A Pinebook 11".]]
|-
|-
!Manufacturer
!Manufacturer
Line 14: Line 14:
|-
|-
!Bootloader
!Bootloader
|34-bit GRUB
|64-bit GRUB
|-
|-
!Maintainer
!Maintainer
Line 25: Line 25:
== Setup ==
== Setup ==


Support for webcam and LTE modem requires a custom kernel from the linux-surface project. Add following lines to your flake.nix of your system configuration
Support for webcam and LTE modem requires a custom kernel from the [https://github.com/linux-surface/linux-surface linux-surface] project. Adapt the <code>flake.nix</code> of your system configuration to include the [https://github.com/NixOS/nixos-hardware nixos-hardware repository] and the specific module for your device: <code>nixos-hardware.nixosModules.microsoft-surface-go</code>.<syntaxhighlight lang="nix">
{
  description = "NixOS configuration with flakes";
  inputs.nixos-hardware.url = "github:NixOS/nixos-hardware/master";
 
  outputs = { self, nixpkgs, nixos-hardware }: {
    # replace <your-hostname> with your actual hostname
    nixosConfigurations.<your-hostname> = nixpkgs.lib.nixosSystem {
      # ...
      modules = [
        # ...
        nixos-hardware.nixosModules.microsoft-surface-go
      ];
    };
  };
}
</syntaxhighlight>After that rebuild your system and reboot the machine.
 
If the LTE modem does not appear in your network manager directly, a [https://github.com/linux-surface/linux-surface/wiki/Surface-Go-2#enabling-the-lte-modem small workaround script] is required. Add this to your system configuration<syntaxhighlight lang="nix">
systemd.services.lte_modem_fix = let
  modemFixScript = pkgs.writeScriptBin "fix_lte_modem" ''
    #!${pkgs.stdenv.shell}
    echo -n 16383 > /sys/bus/usb/devices/2-3:1.0/net/wwp0s20f0u3/cdc_ncm/rx_max
    echo -n 16383 > /sys/bus/usb/devices/2-3:1.0/net/wwp0s20f0u3/cdc_ncm/tx_max
    echo -n 16384 > /sys/bus/usb/devices/2-3:1.0/net/wwp0s20f0u3/cdc_ncm/rx_max
    echo -n 16384 > /sys/bus/usb/devices/2-3:1.0/net/wwp0s20f0u3/cdc_ncm/tx_max
  '';
in {
  wantedBy = ["multi-user.target"];
  serviceConfig = {
    Type = "oneshot";
    ExecStart = "${modemFixScript}/bin/fix_lte_modem";
  };
};
systemd.services.ModemManager.wantedBy = ["multi-user.target"];
</syntaxhighlight>It will take a couple of seconds for the modem to appear.

Latest revision as of 15:07, 15 May 2024

Microsoft Surface Go 2
A Pinebook 11".
Manufacturer Microsoft
Architecture x86_64
Bootloader 64-bit GRUB
Maintainer onny

The Surface Go 2 is a portable 2-in-1 detachable tablet computer by Microsoft, featuring a 10.5-inch PixelSense Display, Intel® Pentium® Gold or Pentium® M processors, and optional LTE connectivity.

Setup

Support for webcam and LTE modem requires a custom kernel from the linux-surface project. Adapt the flake.nix of your system configuration to include the nixos-hardware repository and the specific module for your device: nixos-hardware.nixosModules.microsoft-surface-go.

{
  description = "NixOS configuration with flakes";
  inputs.nixos-hardware.url = "github:NixOS/nixos-hardware/master";

  outputs = { self, nixpkgs, nixos-hardware }: {
    # replace <your-hostname> with your actual hostname
    nixosConfigurations.<your-hostname> = nixpkgs.lib.nixosSystem {
      # ...
      modules = [
        # ...
        nixos-hardware.nixosModules.microsoft-surface-go
      ];
    };
  };
}

After that rebuild your system and reboot the machine. If the LTE modem does not appear in your network manager directly, a small workaround script is required. Add this to your system configuration

systemd.services.lte_modem_fix = let
  modemFixScript = pkgs.writeScriptBin "fix_lte_modem" ''
    #!${pkgs.stdenv.shell}
    echo -n 16383 > /sys/bus/usb/devices/2-3:1.0/net/wwp0s20f0u3/cdc_ncm/rx_max
    echo -n 16383 > /sys/bus/usb/devices/2-3:1.0/net/wwp0s20f0u3/cdc_ncm/tx_max
    echo -n 16384 > /sys/bus/usb/devices/2-3:1.0/net/wwp0s20f0u3/cdc_ncm/rx_max
    echo -n 16384 > /sys/bus/usb/devices/2-3:1.0/net/wwp0s20f0u3/cdc_ncm/tx_max
  '';
in {
  wantedBy = ["multi-user.target"];
  serviceConfig = {
    Type = "oneshot";
    ExecStart = "${modemFixScript}/bin/fix_lte_modem";
  };
};
systemd.services.ModemManager.wantedBy = ["multi-user.target"];

It will take a couple of seconds for the modem to appear.