Lorenz Brun | bffdda8 | 2023-01-10 05:00:36 +0000 | [diff] [blame] | 1 | package scsi |
| 2 | |
| 3 | import "errors" |
| 4 | |
| 5 | type InformationalExceptions struct { |
| 6 | InformationalSenseCode AdditionalSenseCode |
| 7 | Temperature uint8 |
| 8 | } |
| 9 | |
| 10 | func (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 | } |