blob: 724fd75614682fc5c32544c98e281b2f2b24d8e2 [file] [log] [blame]
Lorenz Brunbffdda82023-01-10 05:00:36 +00001package scsi
2
3import "errors"
4
5type InformationalExceptions struct {
6 InformationalSenseCode AdditionalSenseCode
7 Temperature uint8
8}
9
10func (d *Device) GetInformationalExceptions() (*InformationalExceptions, error) {
11 raw, err := d.LogSenseParameters(LogSenseRequest{PageCode: 0x0b})
12 if err != nil {
13 return nil, err
14 }
15 if len(raw[0x1]) == 0 {
16 return nil, errors.New("mandatory parameter 0001h missing")
17 }
18 param1 := raw[0x01][0]
19 if len(param1.Data) < 3 {
20 return nil, errors.New("parameter 0001h too short")
21 }
22 return &InformationalExceptions{
23 InformationalSenseCode: AdditionalSenseCode(uint16(param1.Data[0])<<8 | uint16(param1.Data[1])),
24 Temperature: param1.Data[2],
25 }, nil
26}