Skip to content

Instantly share code, notes, and snippets.

@ka2n
Created May 6, 2018 03:49
Show Gist options
  • Save ka2n/8421db14b23a1638b80568dc864c97ad to your computer and use it in GitHub Desktop.
Save ka2n/8421db14b23a1638b80568dc864c97ad to your computer and use it in GitHub Desktop.
Parse 'HWV' and 'FMV' from Baikal edition's sgminer RPC
package main
import (
"fmt"
"strconv"
)
var models = map[uint8]string{
0x11: "Mini",
0x12: "Giant",
0x20: "Cube",
0x21: "Cube",
0x22: "Giant+",
0x71: "GX10",
0x51: "GN20",
0x52: "GN40",
0x91: "GB",
}
func main() {
// Inputs
hwv := "29297"
fwv := "7500055"
var hwvU uint8
var fwvU uint8
hwvI, err := strconv.Atoi(hwv)
if err != nil {
panic(err)
}
fwvI, err := strconv.Atoi(fwv)
if err != nil {
panic(err)
}
hwvU = uint8(hwvI)
fwvU = uint8(fwvI)
fmt.Printf("Model: %s\n", models[hwvU])
fmt.Printf("Version: %d.%d\n", fwvU >> 4 & 255, fwvU & 15)
}
@ka2n
Copy link
Author

ka2n commented May 6, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment