Skip to content

AntMinerV2020 Pause::pause does not support older stock set_miner_conf.cgi payload shape #245

@DanNicolau

Description

@DanNicolau

Summary

AntMinerV2020::pause() currently sends a partial JSON payload to /cgi-bin/set_miner_conf.cgi, but at least some older
Bitmain stock firmware versions require the browser/UI-style full config payload with Content-Type: text/ plain;charset=UTF-8.

As a result, pause() returns false or times out, and the miner does not enter sleep mode.

Current behavior

For stock Antminer firmware, Pause::pause() reads /cgi-bin/get_miner_conf.cgi, then sends one of these partial JSON
payloads:

{"miner-mode":"1"}

or:

  {"bitmain-work-mode":"1"}

via AntMinerWebAPI::set_miner_conf.

On the affected firmware, this does not change the mode. get_miner_conf.cgi continues to report:

  "bitmain-work-mode": "0"

Affected device / firmware

Observed on:

Antminer S19j Pro
Linux 4.9.113 #1 SMP PREEMPT Mon Dec 26 17:29:52 CST 2022
system_filesystem_version: Mon Dec 26 17:10:01 CST 2022
firmware_type: Release

Browser behavior that works

The stock web UI sends a full config payload to the same endpoint:

POST /cgi-bin/set_miner_conf.cgi
Content-Type: text/plain;charset=UTF-8
X-Requested-With: XMLHttpRequest
Accept: application/json, text/javascript, /; q=0.01

Example body:

  {
    "bitmain-fan-ctrl": false,
    "bitmain-fan-pwm": "100",
    "miner-mode": 1,
    "freq-level": "100",
    "pools": [
      {
        "url": "stratum+tcp://example:3334",
        "user": "user1",
        "pass": ""
      },
      {
        "url": "stratum+tcp://example:3334",
        "user": "user2",
        "pass": ""
      },
      {
        "url": "stratum+tcp://example:443",
        "user": "user3",
        "pass": ""
      }
    ]
  }

Notable differences from the current asic-rs request:

  • Content-Type is text/plain;charset=UTF-8, not application/json
  • the body is the full miner config, not only the mode key
  • the UI uses miner-mode: 1 as a number
  • the UI includes existing pool/fan/frequency fields

Expected behavior

AntMinerV2020::pause() should support this older stock UI payload shape, or fall back to it when the partial JSON update
does not apply.

A possible approach:

  1. Read get_miner_conf.cgi
  2. Try the current partial JSON behavior
  3. Re-read config and verify sleep mode
  4. If unchanged, send a full UI-style config payload using text/plain;charset=UTF-8
  5. Confirm either miner-mode == 1 or bitmain-work-mode == 1

Why this matters

Consumers of Pause::pause() expect a successful result to mean the miner is actually entering sleep mode. On this
firmware, the current call can fail or time out without changing the miner state, preventing safe workflows that need
mining stopped before installation or maintenance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions