Class: Yast::HwStatusClass

Inherits:
Module
  • Object
show all
Defined in:
library/system/src/modules/HwStatus.rb

Instance Method Summary collapse

Instance Method Details

#Get(id) ⇒ Symbol

Get() get status for device



62
63
64
# File 'library/system/src/modules/HwStatus.rb', line 62

def Get(id)
  Ops.get(@statusmap, id, :unknown)
end

#mainObject



40
41
42
43
44
# File 'library/system/src/modules/HwStatus.rb', line 40

def main
  # status map for devices, key is "unique id", value is symbol (`yes, `no)

  @statusmap = {}
end

#SaveObject

Save() save stati for all devices



68
69
70
71
72
73
74
75
# File 'library/system/src/modules/HwStatus.rb', line 68

def Save
  Builtins.foreach(@statusmap) do |id, stat|
    Builtins.y2milestone("Setting status of %1 as %2", id, stat)
    SCR.Write(path(".probe.status.configured"), id, stat)
  end

  nil
end

#Set(id, stat) ⇒ Object

Set set status for a hardware device



51
52
53
54
55
# File 'library/system/src/modules/HwStatus.rb', line 51

def Set(id, stat)
  Ops.set(@statusmap, id, stat)

  nil
end

#UpdateObject

Update() set stati for all devices



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'library/system/src/modules/HwStatus.rb', line 79

def Update
  # probe all pci and isapnp devices once
  # so they have a defined status after update
  SCR.Read(path(".probe.pci"))
  SCR.Read(path(".probe.isapnp"))

  # build relation between old keys and new UDIs (bug #104676)
  command = "hwinfo --pci --block --mouse --save-config=all"
  Builtins.y2milestone("Running %1", command)
  cmdret = Convert.to_map(SCR.Execute(path(".target.bash_output"), command))
  exit = Ops.get_integer(cmdret, "exit", -1)
  Builtins.y2milestone(
    "Command retval: %1",
    Ops.get_integer(cmdret, "exit", -1)
  )
  if exit != 0
    Builtins.y2error("Command output: %1", cmdret)
  else
    Builtins.y2debug("Command output: %1", cmdret)
  end

  nil
end