-
Notifications
You must be signed in to change notification settings - Fork 26
/
cmd_get_chassis_capabilities.go
72 lines (55 loc) · 1.82 KB
/
cmd_get_chassis_capabilities.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package ipmi
import "context"
// 28.1 Get Chassis Capabilities Command
type GetChassisCapabilitiesRequest struct {
// no request data
}
type GetChassisCapabilitiesResponse struct {
ProvidePowerInterlock bool
ProvideDiagnosticInterrupt bool
ProvideFrontPanelLockout bool
ProvideIntrusionSensor bool
// Chassis FRU Device
FRUDeviceAddress uint8
SDRDeviceAddress uint8
SELDeviceAddress uint8
SystemManagementDeviceAddress uint8
// If this field is not provided, the address is assumed to be the BMC address (20h).
BridgeDeviceAddress uint8
}
func (req *GetChassisCapabilitiesRequest) Pack() []byte {
return []byte{}
}
func (req *GetChassisCapabilitiesRequest) Command() Command {
return CommandGetChassisCapabilities
}
func (res *GetChassisCapabilitiesResponse) CompletionCodes() map[uint8]string {
return map[uint8]string{}
}
func (res *GetChassisCapabilitiesResponse) Unpack(msg []byte) error {
if len(msg) < 5 {
return ErrUnpackedDataTooShortWith(len(msg), 5)
}
b1, _, _ := unpackUint8(msg, 0)
res.ProvidePowerInterlock = isBit3Set(b1)
res.ProvideDiagnosticInterrupt = isBit2Set(b1)
res.ProvideFrontPanelLockout = isBit1Set(b1)
res.ProvideIntrusionSensor = isBit0Set(b1)
res.FRUDeviceAddress, _, _ = unpackUint8(msg, 1)
res.SDRDeviceAddress, _, _ = unpackUint8(msg, 2)
res.SELDeviceAddress, _, _ = unpackUint8(msg, 3)
res.SystemManagementDeviceAddress, _, _ = unpackUint8(msg, 4)
if len(msg) == 6 {
res.BridgeDeviceAddress, _, _ = unpackUint8(msg, 5)
}
return nil
}
func (res *GetChassisCapabilitiesResponse) Format() string {
return "todo"
}
func (c *Client) GetChassisCapabilities(ctx context.Context) (response *GetChassisCapabilitiesResponse, err error) {
request := &GetChassisCapabilitiesRequest{}
response = &GetChassisCapabilitiesResponse{}
err = c.Exchange(ctx, request, response)
return
}