mirror of
https://github.com/taigrr/gopher-os
synced 2025-01-18 04:43:13 -08:00
Each driver should manually register a probe function for use by hal
This commit removes the HWProbes() function from the console and tty packages and replaces it with a global ProbeFuncs slice which is fetched by the hal package when the hardware autodetection code runs. Each driver should provide an init() function that appends a probe function to the global ProbeFuncs slice. This approach allows us to support conditional compilation of drivers in the future (e.g. using build tags)
This commit is contained in:
@@ -23,12 +23,12 @@ func ActiveTTY() tty.Device {
|
||||
// DetectHardware probes for hardware devices and initializes the appropriate
|
||||
// drivers.
|
||||
func DetectHardware() {
|
||||
consoles := probe(console.HWProbes())
|
||||
consoles := probe(console.ProbeFuncs)
|
||||
if len(consoles) != 0 {
|
||||
devices.activeConsole = consoles[0].(console.Device)
|
||||
}
|
||||
|
||||
ttys := probe(tty.HWProbes())
|
||||
ttys := probe(tty.ProbeFuncs)
|
||||
if len(ttys) != 0 {
|
||||
devices.activeTTY = ttys[0].(tty.Device)
|
||||
devices.activeTTY.AttachTo(devices.activeConsole)
|
||||
|
||||
Reference in New Issue
Block a user