Skip to content

Commit

Permalink
Better device matching for Vnish devices
Browse files Browse the repository at this point in the history
  • Loading branch information
dmp1ce committed Nov 20, 2019
1 parent 2821407 commit 16e9d49
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog for check_cgminer

## 0.7.5.0

- Better device matching for vnish devices

## 0.7.4.0

- Add support for S17 devices with Vnish firmware
Expand Down
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: check-cgminer
version: 0.7.4.0
version: 0.7.5.0
github: "dmp1ce/check_cgminer"
license: PublicDomain
author: "David Parrish"
Expand Down
7 changes: 5 additions & 2 deletions src/CgminerApi.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module CgminerApi where

import GHC.Generics (Generic)
import Data.Text (Text)
import Data.List (isPrefixOf)
import Data.Aeson ( ToJSON, FromJSON, toEncoding, genericToEncoding
, defaultOptions
, decode
Expand Down Expand Up @@ -98,14 +99,16 @@ getStats reply = flip parseEither reply $ \r -> do
case mMinerType of
Just (String "Antminer S9 SE") -> parseS9seStats AntminerS9SE rawStats
Just (String "Antminer S9k") -> parseS9kStats AntminerS9k rawStats
Just (String "Antminer S17 (vnish 0.9.2-alpha)") -> parseS17VnishStats AntminerS17Vnish rawStats
Just (String "Antminer S17 Pro") -> parseS17Stats AntminerS17Pro rawStats
Just (String "Antminer S17") -> parseS17Stats AntminerS17 rawStats
Just (String "Antminer S15") -> parseS15Stats AntminerS15 rawStats
Just (String "Antminer DR5") -> parseDR5Stats AntminerDR5 rawStats
Just (String "Antminer Z9-Mini") -> parseZ9miniStats AntminerZ9Mini rawStats
Just (String "braiins-am1-s9") -> parseS9Stats AntminerS9 rawStats
Just (String s') -> fail $ "Unexpected miner type: '" ++ T.unpack s' ++ "'"
Just (String s') ->
if isPrefixOf "Antminer S17 (vnish" (T.unpack s')
then parseS17VnishStats AntminerS17Vnish rawStats
else fail $ "Unexpected miner type: '" ++ T.unpack s' ++ "'"
Just s' -> fail $ "Unexpected miner type: " ++ show s'
-- Matches S9 miner case
Nothing -> parseS9Stats AntminerS9 rawStats
Expand Down

0 comments on commit 16e9d49

Please sign in to comment.