mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-12-15 11:03:37 +03:00
demo: Enable adbd in burn tool
This commit is contained in:
parent
0815a83dcf
commit
c15460b6d4
@ -7,39 +7,40 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkMerge mkOrder;
|
||||
device_info = config.mobile.device.info;
|
||||
in
|
||||
{
|
||||
config = mkMerge [
|
||||
{
|
||||
# Ensures we don't quit stage-1
|
||||
mobile.boot.stage-1.shell.enable = true;
|
||||
{
|
||||
# Ensures we don't quit stage-1
|
||||
mobile.boot.stage-1.shell.enable = true;
|
||||
# Only enable `adb` if we know how to.
|
||||
# FIXME: relies on implementation details. Poor separation of concerns.
|
||||
mobile.adbd.enable = (config.mobile.system.type == "android") &&
|
||||
(config.mobile.usb.mode != "gadgetfs" || device_info.gadgetfs.functions ? ffs)
|
||||
;
|
||||
|
||||
# Enables networking and ssh in stage-1 !
|
||||
mobile.boot.stage-1.networking.enable = true;
|
||||
mobile.boot.stage-1.ssh.enable = true;
|
||||
mobile.boot.stage-1.fbterm.enable = true;
|
||||
mobile.boot.stage-1.tasks = [
|
||||
(pkgs.writeText "adjust-brightness-task.rb" ''
|
||||
class Tasks::AdjustBrightness < SingletonTask
|
||||
def initialize()
|
||||
add_dependency(:Target, :Environment)
|
||||
add_dependency(:Target, :Graphics)
|
||||
end
|
||||
# Enables networking and ssh in stage-1 !
|
||||
mobile.boot.stage-1.networking.enable = true;
|
||||
mobile.boot.stage-1.ssh.enable = true;
|
||||
mobile.boot.stage-1.fbterm.enable = true;
|
||||
mobile.boot.stage-1.tasks = [
|
||||
(pkgs.writeText "adjust-brightness-task.rb" ''
|
||||
class Tasks::AdjustBrightness < SingletonTask
|
||||
def initialize()
|
||||
add_dependency(:Target, :Environment)
|
||||
add_dependency(:Target, :Graphics)
|
||||
end
|
||||
|
||||
def run()
|
||||
["lcd-backlight", "wled"].each do |file|
|
||||
# This can fail to write, ignore...
|
||||
begin
|
||||
max = File.read("/sys/class/leds/#{file}/max_brightness").to_i
|
||||
File.write("/sys/class/leds/#{file}/brightness", (max * 0.1).to_i)
|
||||
rescue
|
||||
end
|
||||
end
|
||||
def run()
|
||||
["lcd-backlight", "wled"].each do |file|
|
||||
# This can fail to write, ignore...
|
||||
begin
|
||||
max = File.read("/sys/class/leds/#{file}/max_brightness").to_i
|
||||
File.write("/sys/class/leds/#{file}/brightness", (max * 0.1).to_i)
|
||||
rescue
|
||||
end
|
||||
end
|
||||
'')
|
||||
];
|
||||
}
|
||||
end
|
||||
end
|
||||
'')
|
||||
];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user