Commit febcc53d9973d6b7c380f6b03b98999d172e4861

Kano 2013-08-23T16:34:42

Update the API Multicast documentation

diff --git a/API-README b/API-README
index fe8f638..04c85b6 100644
--- a/API-README
+++ b/API-README
@@ -32,6 +32,10 @@ Using the "--api-allow" option overides the "--api-network" option if they
 are both specified
 With "--api-allow", 127.0.0.1 is not by default given access unless specified
 
+If you start cgminer also with the "--api-mcast" option, it will listen for
+a multicast message and reply to it with a message containing it's API port
+number, but only if the IP address of the sender is allowed API access
+
 More groups (like the privileged group W:) can be defined using the
 --api-groups command
 Valid groups are only the letters A-Z (except R & W are predefined) and are
@@ -461,6 +465,12 @@ miner.php - an example web page to access the API
 Feature Changelog for external applications using the API:
 
 
+API V1.29 (cgminer v3.4.1)
+
+Muticast identification added to the API
+
+----------
+
 API V1.28 (cgminer v3.3.4)
 
 Modified API commands:
@@ -906,6 +916,22 @@ to
 See --api-network or --api-allow for more access details
 and how to give write access
 
+You can however, also tell miner.php to find your cgminer rigs automatically
+on the local subnet
+
+Add the following to each cgminer:
+
+ --api-mcast
+
+or in your cgminer.conf
+
+ "api-mcast" : true,
+
+And in miner.php set $mcast = true;
+
+This will ignore the value of $rigs and overwrite it with the list of zero or
+more rigs found on the network in the timout specified
+
 ---------
 
 Once you have a web server with PHP running
@@ -1141,6 +1167,54 @@ e.g. $rigs = array('127.0.0.1:4028','myrig.com:4028:Sugoi');
 ---------
 
 Default:
+ $mcast = false;
+
+Set $mcast to true to look for your rigs and ignore $rigs
+
+---------
+
+Default:
+ $mcastaddr = '224.0.0.75';
+
+API Multicast address all cgminers are listening on
+
+---------
+
+Default:
+ $mcastport = 4028;
+
+API Multicast UDP port all cgminers are listening on
+
+---------
+
+Default:
+ $mcastcode = 'FTW';
+
+The code all cgminers expect in the Multicast message sent
+The message sent is "cgm-code-listport"
+Don't use the '-' character if you change it
+
+---------
+
+Default:
+ $mcastlistport = 4027;
+
+UDP port number that is added to the broadcast message sent
+that specifies to the cgminers the port to reply on
+
+---------
+
+Default:
+ $mcasttimeout = 1.5;
+
+Set $mcasttimeout to the number of seconds (floating point)
+to wait for replies to the Multicast message
+N.B. the accuracy of the timing used to wait for the replies is
+~0.1s so there's no point making it more than one decimal place
+
+---------
+
+Default:
  $rigipsecurity = true;
 
 Set $rigipsecurity to false to show the IP/Port of the rig
diff --git a/README b/README
index 975c37d..bb68af0 100644
--- a/README
+++ b/README
@@ -195,6 +195,11 @@ Options for both config file and command line:
                     By default any command that does not just display data returns access denied
                     See --api-allow to overcome this
 --api-network       Allow API (if enabled) to listen on/for any address (default: only 127.0.0.1)
+--api-mcast         Enable API Multicast listener, (default: disabled)
+                    The listener will only run if the API is also enabled
+--api-mcast-addr    API Multicast listen address, (default: 224.0.0.75)
+--api-mcast-code    Code expected in the API Multicast message, don't use '-' (default: "FTW")
+--api-mcast-port    API Multicast listen port, (default: 4028)
 --api-port          Port number of miner API (default: 4028)
 --auto-fan          Automatically adjust all GPU fan speeds to maintain a target temperature
 --auto-gpu          Automatically adjust all GPU engine clock speeds to maintain a target temperature
diff --git a/cgminer.c b/cgminer.c
index 1552d2c..a07b2ca 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -969,10 +969,10 @@ static struct opt_table opt_config_table[] = {
 		     "API Multicast listen address"),
 	OPT_WITH_ARG("--api-mcast-code",
 		     set_api_mcast_code, NULL, NULL,
-		     "Code expected in the API Multicast"),
+		     "Code expected in the API Multicast message, don't use '-'"),
 	OPT_WITH_ARG("--api-mcast-port",
 		     set_int_1_to_65535, opt_show_intval, &opt_api_mcast_port,
-		     "Port number of miner API Multicast listener"),
+		     "API Multicast listen port"),
 	OPT_WITHOUT_ARG("--api-network",
 			opt_set_bool, &opt_api_network,
 			"Allow API (if enabled) to listen on/for any address, default: only 127.0.0.1"),