readResult is the firmware-side reader. Fills a buffer until the last two bytes are "\r\n". Kept distinct from ReadResponse because the firmware upgrade flow has been validated against this exact behavior on real hardware; do not redirect callers without re-validating.
()
| 242 | // upgrade flow has been validated against this exact behavior on real |
| 243 | // hardware; do not redirect callers without re-validating. |
| 244 | func (m *Mac) readResult() (string, error) { |
| 245 | var r int |
| 246 | buff := make([]byte, 4101) |
| 247 | for { |
| 248 | n, err := m.Read(buff[r:]) |
| 249 | if err != nil { |
| 250 | return "", err |
| 251 | } |
| 252 | |
| 253 | if n == 0 { |
| 254 | break |
| 255 | } |
| 256 | r += n |
| 257 | |
| 258 | if bytes.Equal(buff[r-2:r], []byte("\r\n")) { |
| 259 | break |
| 260 | } |
| 261 | } |
| 262 | return string(buff[:r-2]), nil |
| 263 | } |
| 264 | |
| 265 | // WaitBoot waiting for boot logo to show |
| 266 | func (m *Mac) WaitBoot() error { |
no test coverage detected