Bitcoin Forum
April 25, 2014, 03:49:40 AM *
News: Due to the OpenSSL heartbleed bug, changing your forum password is recommended.
 
   Home   Help Search Donate Login Register  
Pages: 1 2 3 [4] 5 6 7 8 9  All
  Print  
Author Topic: COMPLETED: Request for an RPC capable fork of cgminer (155 BTC pledged and paid)  (Read 10268 times)
kano
Hero Member
*****
Offline Offline

Activity: 1008


Linux since 1997 RedHat 4


View Profile

Ignore
November 30, 2011, 04:09:18 PM
 #61

Firstly ... and just in case it isn't obvious ...
I'm not asking anyone to pay me the bounty now.
I just want feedback to ensure it is what's required or what needs changing.
Of course once it is what's required ... then yes I'll be chasing bounties Smiley

abracadabra, I'll respond to each of your points since I guess others may not
fully understand what it does and how it works.

However, some of your questions are due to not reading all my posts.
I have posted quite a bit so yes unfortunately you should read them all Smiley

Anyway ...

Kano, sorry haven't checked this thread recently, with Thanksgiving last week. Didn't realize someone was going to take this on so quickly (and cheaply  Grin j/k)

Anyways.. see my comments inline below.. please forgive the newbishness of some of my questions..

https://github.com/kanoi/cgminer

API v0.1

Includes a sample api-example.php


The .php would be run locally?
The point of an RPC interface is something you can access to get information from cgminer
Currently, you look at the screen and respond with keystrokes to what you see Smiley

I've added a socket interface that anyone can access with software and also given 2 sample
programs that do that - api-example.php and API.class (API.java)

How the interface works is you simply either just run cgminer as you always do,
or use one or two of the new options.
the new cgminer always has the RPC interface available but by default only listens
to commands sent from the same computer it is running on.
the --api-listen option changes that to allow any computer that has network access
to the miner computer to send it commands.

The point of the RPC interface is so that you can control cgminer via software instead
of only via the keyboard - thus as an example you could write a web page using php
that shows you the status of the miner and also has options to send it commands

e.g. the simple api-example.php shows the basic rules of how to do that and then you just
add your own web page design on top of that.

Quote
Quote
6 files added/changed from current ckolivas master:

main.c, miner.h, AUTHORS, api.c, api-example.php, Makefile.am

(also has the updated linux-usb-cgminer)

OK so this obviously isn't final (though it does work fine for me)

Anyone who can build their own cgminer and is interested could you have a look?

Not sure if this should have been mentioned earlier, but I need a windows version and unfortuantely I can't build from scratch.  Embarrassed
Yes as quoted by conman, there is a windows version to test it out

Quote
Quote
It currently has 3 API commands:
apiversion - returns a version string "0.1"
dev - returns a status string of all the devices (CPU and or GPU)
pool - returns a status string of all the pools

Do the status strings differentiate the data returned as to which "rig" and which GPU on said "rig"? ie.  Is the name of the "rig" returned with the status string? Or we have to remember which one were were just talking to when we got the status return?
The return data is from the rig you are talking to.
If you would like, I could add another option to cgminer --api-description that would be returned in the status section of the return data.
But of course, that would require you to specify that when you run cgminer.
Another option is I could return the hostname  or some windows equivalent, however that is not always useful unless you gave the computer a useful name when you set it up.
The --api-description idea is a very simple change so if that solves your problem, just say you want that.

Quote
Quote
The included PHP file (api-example.php) simply converts the returned string into a data structure
Very simple and very easy in PHP the way I've done it.

No I'm not expecting people to give me bitcoins yet ... Smiley

The 3 main questions I have are:
1) what other API commands do people want
2) what parameters should I add to cgminer: --api-port = 4028, --api-address = 127.0.0.1, --api-access = 192.168.5.* and anything else?

I'm assuming --api-port & --api-address is the port and address of the actual "rig" we are talking to? --api-access is the ip of the computer allowed to communicate with the rig?

Quote
the numbers shown are of course examples Smiley
(I haven't added any parameters yet)
3) what socket I/O do people want: by this I mean: default port and access restriction.
It currently runs on port 4028 and only listens on 127.0.0.1 - for security reasons of course.

I guess I don't get this.  I understand listening port, but what other ip would the "rig" running cgminer listen to other than it's own?
I updated that info later. Read past that post for the details of the 2 new cgminer options, however to explain the numbers:
It either listens on 127.0.0.1 or on 0.0.0.0
What 127.0.0.1 means is that it will only respond to a message sent from the mining computer to the address 127.0.0.1 - i.e. it is pretty secure.
What 0.0.0.0 means it will listen (and reply) to a message from any computer that has network access to it - i.e. this could be a security issue for some.
So the default is 127.0.0.1 (but --api-listen makes it the other)

Quote
Quote
Edit: it does no mutex locking access to the cpu/gpu/pool info since it would appear that is OK
(the current code doesn't appear to do that either)
ckolivas - does that sound correct to you?

No idea what this means.
ckolivas responded to that part of the post later.
I was simply verifying that what I thought was true was correct Smiley

Quote
Quote
Edit2: minor change - it wasn't closing the connection if an invalid command was sent

Edit3: added 'quit' and 'summary'

Do you have any screenshots of what frontend you have running for you right now?

Thanks!
I simply just run api-example.php at a termina/command prompt (or API.class)
So the last post where I posted all the output is what I see in my terminal excluding the reformatted data
(since it's the same data but just formatted neatly)
https://bitcointalk.org/index.php?topic=52466.msg634588#msg634588

Also, only 4 of the commands show anything on the cgminer screen:
cguenable|N, gpudisable|N, gpurestart|N, quit
The first 3 show as I said above in that link, and of course quit makes cgminer exit.

BTC: 1KanoiBupPiZfkwqB7rfLXAzPnoTshAVmb
CGMiner developer,  IRC FreeNode #cgminer kanoi
Help keep Bitcoin secure by mining on pools with Stratum, the best protocol to mine Bitcoins with ASIC hardware
1398397780
Hero Member
*
Offline Offline

Posts: 1398397780

View Profile Personal Message (Offline)

Ignore
1398397780
Reply with quote  #2

1398397780
Report to moderator
Unbeatable Service & Product Support
Grab Your Miners at GAWMiners.com
Order Before April 25th to receive
Double your Hashing Power for 1 week!

Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1398397780
Hero Member
*
Offline Offline

Posts: 1398397780

View Profile Personal Message (Offline)

Ignore
1398397780
Reply with quote  #2

1398397780
Report to moderator
1398397780
Hero Member
*
Offline Offline

Posts: 1398397780

View Profile Personal Message (Offline)

Ignore
1398397780
Reply with quote  #2

1398397780
Report to moderator
DeathAndTaxes
Donator
Hero Member
*
Offline Offline

Activity: 966



View Profile WWW

Ignore
November 30, 2011, 04:23:25 PM
 #62

Ok I lied about not testing.
I dropped a copy into a windows development box at work.

Tried using API.class to connect to cgminer.

Code:
C:\bitcoin\cgminer-2.0.8-remote>java API
Attempting to send 'summary' to 127.0.0.1:4028
java.net.SocketException: Software caused connection abort: recv failed

The RPC version is listening on 127.0.0.1 by default right? I shouldn't need to add anything to the config.

Gerald Davis  CEO, Tangible Cryptography Inc.
BitSimple. A simpler way to buy and sell bitcoins
kano
Hero Member
*****
Offline Offline

Activity: 1008


Linux since 1997 RedHat 4


View Profile

Ignore
November 30, 2011, 05:00:35 PM
 #63

Ok I lied about not testing.
I dropped a copy into a windows development box at work.

Tried using API.class to connect to cgminer.

Code:
C:\bitcoin\cgminer-2.0.8-remote>java API
Attempting to send 'summary' to 127.0.0.1:4028
java.net.SocketException: Software caused connection abort: recv failed

The RPC version is listening on 127.0.0.1 by default right? I shouldn't need to add anything to the config.
Sigh - that's depressing Sad
Maybe java on windows works differently on different versions of windows?

By default it listens on 127.0.0.1 (--api-listen means listen on 0.0.0.0)

But I'll state the obvious just in case ... cgminer should be saying 2.0.8w at the top of course.

What I've tried (and works fine for me):
php linux to linux miner
php linux to windows miner
java linux to linux miner
java linux to windows miner
java windows to windows miner
java windows to linux miner

So I have tried all combinations except php in windows.
My kids windows box is only WindowsXP Home (and it doesn't have php)

Maybe try to recompile the java? (javac API.java)
I 'compiled' the java on Linux FC12.

Googling I found comments of 'no idea' and 'possible networking problems'

Does the socket still exist? or has the socket thread crashed in cgminer?
(of course you can tell by simply trying again and see if it connects or not)

Which command did you send? Or is it all commands?

I'll write a little 'C' program tomorrow and compile it on windows also
so you can try that and see if it's windows or java
Also note if you run it with "--api-listen" you need to allow it in the firewall
(WindowsXP shows a popup to enable it in the firewall the first time you run it with --api-listen)
It's after 4am here so yeah I'm not gonna try writing any code this late Smiley

BTC: 1KanoiBupPiZfkwqB7rfLXAzPnoTshAVmb
CGMiner developer,  IRC FreeNode #cgminer kanoi
Help keep Bitcoin secure by mining on pools with Stratum, the best protocol to mine Bitcoins with ASIC hardware
DeathAndTaxes
Donator
Hero Member
*
Offline Offline

Activity: 966



View Profile WWW

Ignore
November 30, 2011, 05:12:45 PM
 #64

Does the socket still exist? or has the socket thread crashed in cgminer?
(of course you can tell by simply trying again and see if it connects or not)

Which command did you send? Or is it all commands?

Yes 2.08w is what is running.

Not sure if the socket still exists but subsequent commands give the same error.

The error occurs on all commands.  Well I only tested a half dozen but the simplest apiversion also gets the error.

Before you rip your hair out I am accessing the windows box (both cgminer & api.class are on the same box) via remote desktop from my work workstation.  Let me check when I get home it may be some "weirdness" w/ RDP.

Quote
It's after 4am here so yeah I'm not gonna try writing any code this late
Yeah no rush.  Get some sleep.

Gerald Davis  CEO, Tangible Cryptography Inc.
BitSimple. A simpler way to buy and sell bitcoins
lueo
Member
**
Offline Offline

Activity: 61


Bitcoin believer


View Profile WWW

Ignore
November 30, 2011, 05:47:48 PM
 #65

Dear DeathAndTaxes,

Thanks for your clarification. I will start up a new thread for my project. And, like I said, anyone who believe the bounty is fulfilled just go ahead.

Dear kano,

Yeah, you deserve the bounty according to the clarification. I really hope that JSON RPC could be added to cgminer, so that any GUI could call cgminer in a uniform way. For now we have to parse different output from different miners, it's painful.

A long post but I wanted to wrap up a couple of different issues all at once.

Very rapid development:
I also wasn't expecting such a rapid development, it kinda caught me off guard.  Not that this is a bad thing just unexpected.

Clarification of the bounty:
As I indicated in the thread my bounty is for a fork of cgminer or integration into cgminer mainline.  While maybe I was unclear (if so I apologize) I have no need/desire for a wrapper in an alternate language.  My experience in project development tells me that will make forward compatibility tough and likely require never ending "mainteance bounties" to keep current.  Sorry lueo you front end looks nice and people will need front ends so hopefully the front end work isn't wasted and can be adapted.  This bounty is for the cgminer modification but I am sure other projects/bounties will be required for the remote control application.

Speaking for others:
I can't speak for all of those pledging funds on if a wrapper is compatible w/ the goals of the project.  I am assuming (possibly incorrectly) they feel the same as me. To anyone pledging a clarification on if a wrapper is acceptable to the terms of the project would be appreciated.


Donation: 1M1mB5BQX5QthTojfHxXxJQJr8ro5xLcKR
Real-time LR <-> MTGOX exchange! http://goo.gl/gJqZS
Internet Marketing Q&A in Chinese: http://qa.webcash168.com/
ckolivas
Moderator
Hero Member
*
Offline Offline

Activity: 1036



View Profile WWW

Ignore
November 30, 2011, 10:50:33 PM
 #66

To YOU reading right now who haven't pledged (my soap box):
It makes me embarrassed by how little ckolivas has been compensated for all his hard work.  
Goddamnit that's the sum total of how much I've earned in donations in total for cgminer  Angry
If this project is interesting to you then here is a chance to make it right.  Pledge 1, 2 or 5 BTC towards the mainline integration "bonus" portion.  I have written shareware poker apps which generated 5 figures in revenue.  It is beyond sad that such an amazing project (which likely has required hundreds of hours) is so under-compensated.  If you don't support developers then don't complain when projects stall and die.  Saying "great work" is one thing putting your money where your mouth is means a lot more.  
Thanks very much for the sentiment. A few more people have donated, and some previous people have donated more since I made that comment. Indeed it was hundreds of hours as I spent the greater proportion of my time working on cgminer when I had 3 months off work.

Primary developer/maintainer for cgminer: https://bitcointalk.org/index.php?topic=28402.0  148KkS2vgVi4VzUi4JcKzM2PMaMVPi3nnq
ONLY ignoring luke-jr
-ck
DeathAndTaxes
Donator
Hero Member
*
Offline Offline

Activity: 966



View Profile WWW

Ignore
December 01, 2011, 07:06:11 PM
 #67

Ok I lied about not testing.
I dropped a copy into a windows development box at work.

Tried using API.class to connect to cgminer.

Code:
C:\bitcoin\cgminer-2.0.8-remote>java API
Attempting to send 'summary' to 127.0.0.1:4028
java.net.SocketException: Software caused connection abort: recv failed

The RPC version is listening on 127.0.0.1 by default right? I shouldn't need to add anything to the config.

So I never got it working under Windows even when on machine locally so it wasn't any weirdness w/ RDP.

Now I added the following to me config file.

Code:
"api-listen" : true,
"api-port" : "44444"

And it works. Even when connecting to 127.0.0.1.

If I take this out (which if I am understanding this right should still work connecting from local machine) then I get nothing (same error messages).

One change I would recommend (to assist w/ integration into mainline) is to have RPC turned off by default.  Not sure how you want to handle that (RPC off, local connection only, remote connection) but I think it would be best to have RPC disabled until explicitly enabled.  Not a huge issue but something to think about.

Still I have no idea why I can't connect from the same machine without adding the above to my config.  Didn't have much time to experiment but it looks good.


Some RPC calls
Code:
C:\bitcoin\cgminer-2.0.8-remote>java API apiversion 127.0.0.1 44444
Attempting to send 'apiversion' to 127.0.0.1:44444
Answer='0.3 '
[0.3 ] =>
(
   [0] => 0.3
)

C:\bitcoin\cgminer-2.0.8-remote>java API summary 127.0.0.1 44444
Attempting to send 'summary' to 127.0.0.1:44444
Answer='STATUS=S,CODE=11,MSG=Summary|SUMMARY=all,EL=492,ALGO=sse2_32,MHS=2277.80
,SOL=0,Q=286,A=263,R=0,HW=0,U=32.10,DW=4,ST=0,GF=0,LW=0,RO=0,BC=1| '
[STATUS] =>
(
   [STATUS] => S
   [CODE] => 11
   [MSG] => Summary
)
[SUMMARY] =>
(
   [SUMMARY] => all
   [EL] => 492
   [ALGO] => sse2_32
   [MHS] => 2277.80
   [SOL] => 0
   [Q] => 286
   [A] => 263
   [R] => 0
   [HW] => 0
   [U] => 32.10
   [DW] => 4
   [ST] => 0
   [GF] => 0
   [LW] => 0
   [RO] => 0
   [BC] => 1
)

C:\bitcoin\cgminer-2.0.8-remote>java API devs 127.0.0.1 44444
Attempting to send 'devs' to 127.0.0.1:44444
Answer='STATUS=S,CODE=9,MSG=6 GPU(s) - 0 CPU(s)|GPU=0,GT=0.00,FR=0,FP=0,EN=Y,STA
=ALIVE,MHS=387.40,A=38,R=0,HW=0,U=4.54,I=9|GPU=1,GT=0.00,FR=0,FP=0,EN=Y,STA=ALIV
E,MHS=387.13,A=44,R=0,HW=0,U=5.26,I=9|GPU=2,GT=0.00,FR=0,FP=0,EN=Y,STA=ALIVE,MHS
=373.15,A=44,R=0,HW=0,U=5.26,I=9|GPU=3,GT=0.00,FR=0,FP=0,EN=Y,STA=ALIVE,MHS=372.
62,A=42,R=0,HW=0,U=5.02,I=9|GPU=4,GT=0.00,FR=0,FP=0,EN=Y,STA=ALIVE,MHS=367.08,A=
44,R=0,HW=0,U=5.26,I=D|GPU=5,GT=0.00,FR=0,FP=0,EN=Y,STA=ALIVE,MHS=384.05,A=54,R=
0,HW=0,U=6.46,I=9| '
[STATUS] =>
(
   [STATUS] => S
   [CODE] => 9
   [MSG] => 6 GPU(s) - 0 CPU(s)
)
[GPU0] =>
(
   [GPU] => 0
   [GT] => 0.00
   [FR] => 0
   [FP] => 0
   [EN] => Y
   [STA] => ALIVE
   [MHS] => 387.40
   [A] => 38
   [R] => 0
   [HW] => 0
   [U] => 4.54
   [I] => 9
)
[GPU1] =>
(
   [GPU] => 1
   [GT] => 0.00
   [FR] => 0
   [FP] => 0
   [EN] => Y
   [STA] => ALIVE
   [MHS] => 387.13
   [A] => 44
   [R] => 0
   [HW] => 0
   [U] => 5.26
   [I] => 9
)
[GPU2] =>
(
   [GPU] => 2
   [GT] => 0.00
   [FR] => 0
   [FP] => 0
   [EN] => Y
   [STA] => ALIVE
   [MHS] => 373.15
   [A] => 44
   [R] => 0
   [HW] => 0
   [U] => 5.26
   [I] => 9
)
[GPU3] =>
(
   [GPU] => 3
   [GT] => 0.00
   [FR] => 0
   [FP] => 0
   [EN] => Y
   [STA] => ALIVE
   [MHS] => 372.62
   [A] => 42
   [R] => 0
   [HW] => 0
   [U] => 5.02
   [I] => 9
)
[GPU4] =>
(
   [GPU] => 4
   [GT] => 0.00
   [FR] => 0
   [FP] => 0
   [EN] => Y
   [STA] => ALIVE
   [MHS] => 367.08
   [A] => 44
   [R] => 0
   [HW] => 0
   [U] => 5.26
   [I] => D
)
[GPU5] =>
(
   [GPU] => 5
   [GT] => 0.00
   [FR] => 0
   [FP] => 0
   [EN] => Y
   [STA] => ALIVE
   [MHS] => 384.05
   [A] => 54
   [R] => 0
   [HW] => 0
   [U] => 6.46
   [I] => 9
)

C:\bitcoin\cgminer-2.0.8-remote>
[/code][/code]

Gerald Davis  CEO, Tangible Cryptography Inc.
BitSimple. A simpler way to buy and sell bitcoins
kano
Hero Member
*****
Offline Offline

Activity: 1008


Linux since 1997 RedHat 4


View Profile

Ignore
December 02, 2011, 02:25:29 AM
 #68

OK, I'll put in permanent debug so it can be checked with the --debug option if ever needed (and needed now)

hmm maybe MS have done something strange about port numbers?
What Windows OS are you running on?
It really should just be 0-1024 is restricted but all the rest should work the same.
Since I use 4028 by default - could you try that with the config file and see if it is simply just the port number?
I don't know what DTServer is - but: http://tcp-udp-ports.com/port-4028.htm
(though a bit of googling found one app that uses the webcam on that port)

I've written the .c api interface example, works fine on linux but having trouble with it on windows ...
I'll sort that out tonight and also correct all the socket error message code on windows then too.

RPC off by default ... I guess I could do that by giving "--api-listen" 3 options: 'off' (default), 'network' or 'local'
(so without it, it defaults to 'off')
That sound OK - or got another preference?

BTC: 1KanoiBupPiZfkwqB7rfLXAzPnoTshAVmb
CGMiner developer,  IRC FreeNode #cgminer kanoi
Help keep Bitcoin secure by mining on pools with Stratum, the best protocol to mine Bitcoins with ASIC hardware
DeathAndTaxes
Donator
Hero Member
*
Offline Offline

Activity: 966



View Profile WWW

Ignore
December 02, 2011, 02:43:32 AM
 #69

OK, I'll put in permanent debug so it can be checked with the --debug option if ever needed (and needed now)

hmm maybe MS have done something strange about port numbers?
What Windows OS are you running on?
It really should just be 0-1024 is restricted but all the rest should work the same.
Since I use 4028 by default - could you try that with the config file and see if it is simply just the port number?
I don't know what DTServer is - but: http://tcp-udp-ports.com/port-4028.htm
(though a bit of googling found one app that uses the webcam on that port)

Well nobody has reported it yet but me so it may be an issue w/ my system.  I am running Windows 7 Professional x64.  Unless someone else reports an issue I would chalk it up to a system specific bug.  I am leaving for my cruise tomorrow (woot) so I won't be able to do any more testing for a week.  I like what I see so far, seems very solid.  Once I manually enabled api-listen and set a port I haven't encountered any errors, bugs, or unexpected results.  No crashes or instability on the miner side either.

Quote
RPC off by default ... I guess I could do that by giving "--api-listen" 3 options: 'off' (default), 'network' or 'local'
(so without it, it defaults to 'off')
That sound OK - or got another preference?

That works for me.  At this point it doesn't matter so much but IMHO it makes for a better design (and easier integration to the mainline) if a potential attack vector must be explicitly enabled.

Anyways can't wait to see what it looks like in a week.

Gerald Davis  CEO, Tangible Cryptography Inc.
BitSimple. A simpler way to buy and sell bitcoins
kano
Hero Member
*****
Offline Offline

Activity: 1008


Linux since 1997 RedHat 4


View Profile

Ignore
December 02, 2011, 01:56:01 PM
 #70

Added another commit of the api-example.c that works in both windows and linux
https://github.com/kanoi/cgminer/commit/c33553d5a65556a4802bea6ec251e7aa80b809d5
and the downloads includes the windows binary api-example.exe

Made a few other changes not yet up in the git:
I've fixed the windows socket error messages and ended up making the api options a bit different again ...
This seems to be the easiest:
 --api-listen (boolean - default is off which means the api thread doesn't wait for connections, specifying it means to turn on the api socket)
 --api-network (boolean - default is off which means only 127.0.0.1 can connect it if is listening, specifying it means anything with netowrk access can connect to cgminer)

Added debug to be able to see what's happening with sends/recvs

Next change - I'll enhance the apiversion command (and just rename it to 'version')
It will return the api version and the cgminer version

Lastly I think I'll change all the field names to actual names - e.g. like for a GPU, instead of "R=0" it will say something like "Rejected=0"
That way everyone isn't trying to translate the codes, cgminer will do it correctly already (also the data quantity is quite small ...)

Lastly, I'll add an identifier to the [STATUS] section (as stated above) --api-description (defaults to "cgminer" or some such)
So if you specify --api-description "7990" it will return that at the bottom of every status section reply

BTC: 1KanoiBupPiZfkwqB7rfLXAzPnoTshAVmb
CGMiner developer,  IRC FreeNode #cgminer kanoi
Help keep Bitcoin secure by mining on pools with Stratum, the best protocol to mine Bitcoins with ASIC hardware
gigavps
VIP
Hero Member
*
Offline Offline

Activity: 1022



View Profile

Ignore
December 02, 2011, 02:18:50 PM
 #71

Added another commit of the api-example.c that works in both windows and linux
https://github.com/kanoi/cgminer/commit/c33553d5a65556a4802bea6ec251e7aa80b809d5
and the downloads includes the windows binary api-example.exe

Made a few other changes not yet up in the git:
I've fixed the windows socket error messages and ended up making the api options a bit different again ...
This seems to be the easiest:
 --api-listen (boolean - default is off which means the api thread doesn't wait for connections, specifying it means to turn on the api socket)
 --api-network (boolean - default is off which means only 127.0.0.1 can connect it if is listening, specifying it means anything with netowrk access can connect to cgminer)

Added debug to be able to see what's happening with sends/recvs

Next change - I'll enhance the apiversion command (and just rename it to 'version')
It will return the api version and the cgminer version

Lastly I think I'll change all the field names to actual names - e.g. like for a GPU, instead of "R=0" it will say something like "Rejected=0"
That way everyone isn't trying to translate the codes, cgminer will do it correctly already (also the data quantity is quite small ...)

Lastly, I'll add an identifier to the [STATUS] section (as stated above) --api-description (defaults to "cgminer" or some such)
So if you specify --api-description "7990" it will return that at the bottom of every status section reply

Kano, thank you for all of your hard work on this feature.
kano
Hero Member
*****
Offline Offline

Activity: 1008


Linux since 1997 RedHat 4


View Profile

Ignore
December 03, 2011, 01:41:55 PM
 #72

My git ( https://github.com/kanoi/cgminer ) has been updated with the changes:
(called it 2.0.8x)

Renamed the 'apiversion' command to just 'version' and it now returns a structure like the rest - now with 2 fields:
   [CGMiner] => 2.0.8x
   [API] => 0.5

Changed all the return field names everywhere to be descriptions (except 2: URL, MHS)

Added all the other ADL GPU properties that cgminer knows to the GPU status fields
(GPU Clock, Memory Clock, GPU Voltage, GPU Activity, Powertune)
Not sure why I forgot them before Tongue

Added a new cgminer option: --api-description
This is added to the end of the STATUS section of all replies as [Description] => string
(default is the software version, currently cgminer 2.0.8x)

In the downloads section on my git I've uploaded the cgminer-2.0.8x version of the Linux executable (replacing the cgminer-2.0.8w version)

I'll try to make a windows binary tomorrow.

BTC: 1KanoiBupPiZfkwqB7rfLXAzPnoTshAVmb
CGMiner developer,  IRC FreeNode #cgminer kanoi
Help keep Bitcoin secure by mining on pools with Stratum, the best protocol to mine Bitcoins with ASIC hardware
kano
Hero Member
*****
Offline Offline

Activity: 1008


Linux since 1997 RedHat 4


View Profile

Ignore
December 04, 2011, 01:02:42 PM
 #73

OK windows binary 2.0.8x in my git download now also https://github.com/kanoi/cgminer/downloads
Use the two 2.0.8w DLLs there if you don't already have them.

All source updated in my GIT also https://github.com/kanoi/cgminer

Made one extra change that removes the need for the 2 extra inet_* functions I added coz they were missing from windows, but there are others that do the same job that do exist in windows (and linux of course)
and I also found that the code might? have been causing issues with connecting so that may have been DeathAndTaxes problem also - though it worked fine on my XP-Home before so I'm not exactly sure if that was the cause

This is now ready as far as I can tell.
Anything else missing?

The last thing left for me to do is update the doc files - but I'll do that when it's clear it's got all the required code done.

BTC: 1KanoiBupPiZfkwqB7rfLXAzPnoTshAVmb
CGMiner developer,  IRC FreeNode #cgminer kanoi
Help keep Bitcoin secure by mining on pools with Stratum, the best protocol to mine Bitcoins with ASIC hardware
kano
Hero Member
*****
Offline Offline

Activity: 1008


Linux since 1997 RedHat 4


View Profile

Ignore
December 07, 2011, 10:59:22 AM
 #74

Sheesh there really isn't much interest?

Anyway - rather than just having an API I decided to write a PHP web page that uses the API
Very simple (though of course I may make some minor future changes)
Main reason was so I could actually look at it via a web page Tongue

It's in my git: miner.php ( https://github.com/kanoi/cgminer/blob/master/miner.php )

Now some help to actually use it Smiley

Firstly I'll assume you are using xubuntu and my linux install script.
If not, well then wipe your miner and start again with my install script Cheesy Cheesy
Or work it out yourself but it should be similar.

Anyway, with xubuntu 11.04:

start cgminer with the extra red options:
 cgminer -c kanocoin.conf --auto-cpu --auto-gpu -I 9 --api-listen --api-description "My Miner PC"
(of course you can call it whatever you like ...)

(this takes up about 50Mb of USB space)
 sudo apt-get install apache2
 sudo apt-get install php5
 sudo /etc/init.d/apache2 reload

Then copy miner.php into /var/www/
something like:
 sudo cp miner.php /var/www/
From the directory wherever you managed to copy miner.php

Then view the page with something like: http://computerIP/miner.php
(where computerIP is of course the IP address of the miner computer)

If you were wondering what the actual IP address of the miner is:
 sudo ifconfig
It should usually be the 2nd line of 'eth0' after it says 'inet addr:'

You can of course also use the miner.php running on any computer on your network that has apache and php ...
as long as you also add --api-network to cgminer when you run it.
Then also set the '$miner' variable at the top of miner.php to the address of the PC running cgminer

Free extra Smiley YMMV

Edit: hmm I think I need to revise the "MHS" fields in the API output.
I'll change them soon - to show/add "MHS av" and "MHS 5s"  wherever possible

BTC: 1KanoiBupPiZfkwqB7rfLXAzPnoTshAVmb
CGMiner developer,  IRC FreeNode #cgminer kanoi
Help keep Bitcoin secure by mining on pools with Stratum, the best protocol to mine Bitcoins with ASIC hardware
Red Emerald
Hero Member
*****
Offline Offline

Activity: 728



View Profile WWW

Ignore
December 07, 2011, 07:32:16 PM
 #75

Looking great.  When I get a chance (probably this weekend), I will get it running on my miner.

I'm assuming we pay the bounty once its stable?

kano
Hero Member
*****
Offline Offline

Activity: 1008


Linux since 1997 RedHat 4


View Profile

Ignore
December 07, 2011, 09:06:13 PM
 #76

As soon as you like Cheesy Cheesy

But yeah I'll make one more change myself as I said above (the MHS fields need 'adjusting')

Of course it won't get into the main git until it's ready to go there so the sooner everyone actually checks it and says nothing is missing the sooner everyone can pay the first part of the bounty and thus the sooner I can pass it onto ckolivas to add it to his git and then you can pay him too Smiley

Just noticed in the first post - it's 125 BTC + 30 BTC not 120+30 Smiley

BTC: 1KanoiBupPiZfkwqB7rfLXAzPnoTshAVmb
CGMiner developer,  IRC FreeNode #cgminer kanoi
Help keep Bitcoin secure by mining on pools with Stratum, the best protocol to mine Bitcoins with ASIC hardware
kano
Hero Member
*****
Offline Offline

Activity: 1008


Linux since 1997 RedHat 4


View Profile

Ignore
December 08, 2011, 12:47:57 PM
 #77

Adjusted MHS version (2.0.8y) now in my git downloads:
https://github.com/kanoi/cgminer/downloads

(source in the git as usual)

This shows the MHS fields as "MHS av" for SUMMARY
For CPU and GPU it shows "MHS av" and "MHS 5s"
(though the '5' in '5s' is actually whatever the "--log|-l <arg>" is set to - it defaults to 5)

Also the API version is 0.6 for 2.0.8y

I've put up 3 versions downloadable:
linux 2.0.8y GPU miner
windows 2.0.8y GPU miner
windows 2.0.8y CPU miner (this is the one I test, the above one is just this with GPU enabled that I can't test)

BTC: 1KanoiBupPiZfkwqB7rfLXAzPnoTshAVmb
CGMiner developer,  IRC FreeNode #cgminer kanoi
Help keep Bitcoin secure by mining on pools with Stratum, the best protocol to mine Bitcoins with ASIC hardware
abracadabra
Hero Member
*****
Offline Offline

Activity: 877



View Profile

Ignore
December 10, 2011, 05:24:12 PM
 #78

kano,

I'm going to start installing this on a few of my rigs.  I should have some feedback for you soon Smiley

runeks
Hero Member
*****
Offline Offline

Activity: 812



View Profile WWW

Ignore
December 11, 2011, 11:08:17 AM
 #79

What would be a good way of connecting to cgminer in Python code? I tried using this example from the Bitcoin client. But I get a "Connection reset by peer" error:

Code:
>>> from jsonrpc import ServiceProxy
>>> access = ServiceProxy("http://127.0.0.1:4028")
>>> access.getinfo()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "jsonrpc/proxy.py", line 42, in __call__
    respdata = urllib.urlopen(self.__serviceURL, postdata).read()
  File "/usr/lib/python2.7/urllib.py", line 86, in urlopen
    return opener.open(url, data)
  File "/usr/lib/python2.7/urllib.py", line 207, in open
    return getattr(self, name)(url, data)
  File "/usr/lib/python2.7/urllib.py", line 343, in open_http
    errcode, errmsg, headers = h.getreply()
  File "/usr/lib/python2.7/httplib.py", line 1099, in getreply
    response = self._conn.getresponse()
  File "/usr/lib/python2.7/httplib.py", line 1027, in getresponse
    response.begin()
  File "/usr/lib/python2.7/httplib.py", line 407, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python2.7/httplib.py", line 365, in _read_status
    line = self.fp.readline()
  File "/usr/lib/python2.7/socket.py", line 430, in readline
    data = recv(1)
IOError: [Errno socket error] [Errno 104] Connection reset by peer
>>> access = ServiceProxy("http://127.0.0.1:4028")

cgminer 2.0.8y is running and it says "API running in restricted access mode" in the log. "netstat -n|grep 4028" doesn't show any output (should it?).

My address: 1runeksijzfVxyrpiyCY2LCBvYsSiFsCm
ASICMiner solo hashrate: http://runeks.me/bitcoin/
kano
Hero Member
*****
Offline Offline

Activity: 1008


Linux since 1997 RedHat 4


View Profile

Ignore
December 11, 2011, 11:20:52 AM
 #80

It's a socket, not a web server Smiley

http://docs.python.org/howto/sockets.html

If you look at the php, java or C code, you'll see that it's a simple TCP socket you connect to, send one string (the command), receive a reply and then close the socket.
Very quick and very simple.
That link above should help you with the 4 commands necessary to do that.
(plus one to initialise the socket)

On the miner
 sudo netstat -na | grep 4028
should give 2 different responses if you used --api-listen

1) If you have also used --api-network:
  tcp        0      0 0.0.0.0:4028            0.0.0.0:*               LISTEN

2) If you haven't also used --api-network:
  tcp        0      0 127.0.0.1:4028          0.0.0.0:*               LISTEN

BTC: 1KanoiBupPiZfkwqB7rfLXAzPnoTshAVmb
CGMiner developer,  IRC FreeNode #cgminer kanoi
Help keep Bitcoin secure by mining on pools with Stratum, the best protocol to mine Bitcoins with ASIC hardware
Pages: 1 2 3 [4] 5 6 7 8 9  All
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!