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


60
61
62
# File 'library/system/src/modules/HwStatus.rb', line 60

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

#mainObject


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

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


  @statusmap = {}
end

#SaveObject

Save() save stati for all devices


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

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


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

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

  nil
end

#UpdateObject

Update() set stati for all devices


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

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 = "/usr/sbin/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