Skip to content
This repository has been archived by the owner on Apr 24, 2022. It is now read-only.

Commit

Permalink
Api: Add miner_setverbosity().
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanOberhumer committed Jul 25, 2018
1 parent 027d822 commit e5d3f00
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Replaced opencl kernel with opensource jawawawa opencl kernel
- Added support for jawawawa AMD binary kernels
- AMD auto kernel selection. Try bin first, if not fall back to opencl.
- API: New method `miner_setverbosity`. [#1382](https://github.com/ethereum-mining/ethminer/pull/1382).

## 0.15.0rc1

Expand Down
26 changes: 26 additions & 0 deletions docs/API_DOCUMENTATION.md
Expand Up @@ -20,6 +20,7 @@
* [miner_getscramblerinfo](#miner_getscramblerinfo)
* [miner_setscramblerinfo](#miner_setscramblerinfo)
* [miner_pausegpu](#miner_pausegpu)
* [miner_setverbosity](#miner_setverbosity)

## Introduction

Expand Down Expand Up @@ -566,3 +567,28 @@ and expect a result like this:

which confirms the action has been performed.
Again: This ONLY (re)starts mining if GPU was paused via a previous API call and not if GPU pauses for other reasons.

### miner_setverbosity

Set the verbosity level of ethminer.

```json
{
"id": 1,
"jsonrpc": "2.0",
"method": "miner_setverbosity",
"data": {
"verbosity": 9
}
}
```

and expect a result like this:

```json
{
"id": 1,
"jsonrpc": "2.0",
"result": true
}
```
24 changes: 24 additions & 0 deletions libapicore/ApiServer.cpp
Expand Up @@ -624,6 +624,30 @@ void ApiConnection::processRequest(Json::Value& jRequest, Json::Value& jResponse
jResponse["result"] = true;
}

else if (_method == "miner_setverbosity")
{
if (!checkApiWriteAccess(m_readonly, jResponse))
return;

Json::Value jRequestParams;
if (!getRequestValue("params", jRequestParams, jRequest, false, jResponse))
return;

unsigned verbosity;
if (!getRequestValue("verbosity", verbosity, jRequestParams, false, jResponse))
return;

if (verbosity > 9)
{
jResponse["error"]["code"] = -422;
jResponse["error"]["message"] = "Verbosity out of bounds (0-9)";
return;
}
cnote << "Setting verbosity level to " << verbosity;
g_logVerbosity = verbosity;
jResponse["result"] = true;
}

else
{
// Any other method not found
Expand Down

0 comments on commit e5d3f00

Please sign in to comment.