github.com/zaolin/u-root@v0.0.0-20200428085104-64aaafd46c6d/pkg/ipmi/ipmi_linux.go (about)

     1  // Copyright 2019 the u-root Authors. All rights reserved
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package ipmi
     6  
     7  import (
     8  	"fmt"
     9  	"os"
    10  )
    11  
    12  func Open(devnum int) (*IPMI, error) {
    13  	d := fmt.Sprintf("/dev/ipmi%d", devnum)
    14  
    15  	f, err := os.OpenFile(d, os.O_RDWR, 0)
    16  	if err != nil {
    17  		return nil, err
    18  	}
    19  
    20  	return &IPMI{File: f}, nil
    21  }