Created
May 6, 2018 03:49
-
-
Save ka2n/8421db14b23a1638b80568dc864c97ad to your computer and use it in GitHub Desktop.
Parse 'HWV' and 'FMV' from Baikal edition's sgminer RPC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See https://github.com/ka2n/baikalver