mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-12-15 11:03:37 +03:00
initrd: System.write for USB gadget tasks
This commit is contained in:
parent
67f907c952
commit
4289996f3c
@ -5,7 +5,7 @@ module System::ConfigFSUSB
|
||||
module Quirks
|
||||
def self.gsi_rndis()
|
||||
# Activate the IPA stuff... ugh.
|
||||
File.write("/dev/ipa", 1)
|
||||
System.write("/dev/ipa", 1)
|
||||
end
|
||||
end
|
||||
|
||||
@ -56,11 +56,11 @@ module System::ConfigFSUSB
|
||||
|
||||
def set_id(kind, value)
|
||||
value = ["0", value.sub(/^0x/, "")].join("x")
|
||||
File.write(File.join(path_prefix, kind), value)
|
||||
System.write(File.join(path_prefix, kind), value)
|
||||
end
|
||||
|
||||
def set_string(name, value)
|
||||
File.write(File.join(path_prefix, STRINGS_SUFFIX, name), value)
|
||||
System.write(File.join(path_prefix, STRINGS_SUFFIX, name), value)
|
||||
end
|
||||
|
||||
def activate!()
|
||||
@ -68,7 +68,7 @@ module System::ConfigFSUSB
|
||||
# First, "document" features.
|
||||
config_dir = File.join(path_prefix, "configs/c.1")
|
||||
FileUtils.mkdir_p(File.join(config_dir, STRINGS_SUFFIX))
|
||||
File.write(File.join(config_dir, STRINGS_SUFFIX, "configuration"), features.join(","))
|
||||
System.write(File.join(config_dir, STRINGS_SUFFIX, "configuration"), features.join(","))
|
||||
|
||||
# Then activate features.
|
||||
features.each do |feature|
|
||||
@ -93,7 +93,7 @@ module System::ConfigFSUSB
|
||||
# Equivalent to:
|
||||
# (cd /sys/class/udc; echo *) > g1/UDC
|
||||
# The idea is to give a controller name taken from the filesystem.
|
||||
File.write(
|
||||
System.write(
|
||||
File.join(path_prefix, "UDC"),
|
||||
Dir.children("/sys/class/udc").first
|
||||
)
|
||||
@ -135,19 +135,19 @@ class System::AndroidUSB
|
||||
|
||||
def set_id(kind, value)
|
||||
value = ["0", value.sub(/^0x/, "")].join("x")
|
||||
File.write(File.join(path_prefix, kind), value)
|
||||
System.write(File.join(path_prefix, kind), value)
|
||||
end
|
||||
|
||||
def set_string(name, value)
|
||||
File.write(File.join(path_prefix, name), value)
|
||||
System.write(File.join(path_prefix, name), value)
|
||||
end
|
||||
|
||||
def activate!()
|
||||
File.write(File.join(path_prefix, "enable"), "0")
|
||||
File.write(File.join(path_prefix, "bDeviceClass"), "0")
|
||||
File.write(File.join(path_prefix, "functions"), @features.join(","))
|
||||
System.write(File.join(path_prefix, "enable"), "0")
|
||||
System.write(File.join(path_prefix, "bDeviceClass"), "0")
|
||||
System.write(File.join(path_prefix, "functions"), @features.join(","))
|
||||
sleep(0.1)
|
||||
File.write(File.join(path_prefix, "enable"), "1")
|
||||
System.write(File.join(path_prefix, "enable"), "1")
|
||||
sleep(0.1)
|
||||
end
|
||||
end
|
||||
@ -208,7 +208,7 @@ class Tasks::SetupFFSAlias < SingletonTask
|
||||
|
||||
def run()
|
||||
if @with_ffs and File.exist?(ALIASES_PATH)
|
||||
File.write(ALIASES_PATH, "adb")
|
||||
System.write(ALIASES_PATH, "adb")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user