Drillbit: Remove default config in cgminer, rely on defaults in firmware
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
diff --git a/driver-drillbit.c b/driver-drillbit.c
index 894c45f..282b858 100644
--- a/driver-drillbit.c
+++ b/driver-drillbit.c
@@ -106,17 +106,6 @@ typedef struct {
UT_hash_handle hh;
} config_setting;
-/* Comparatively modest default settings */
-static config_setting default_settings = {
- key: { 0 },
- config: {
- core_voltage: 850,
- clock_freq: 200,
- use_ext_clock: 0,
- clock_div2: 0,
- },
-};
-
static config_setting *settings;
/* Return a pointer to the chip_info structure for a given chip id, or NULL otherwise */
@@ -322,11 +311,17 @@ static config_setting *find_settings(struct cgpu_info *drillbit)
config_setting *setting;
char search_key[9];
- // Search by serial (8 character hex string)
- sprintf(search_key, "%08x", info->serial);
+ if(!settings) {
+ drvlog(LOG_INFO, "Keeping onboard defaults for device %s (serial %08x)",
+ info->product, info->serial);
+ return NULL;
+ }
+
+ // Search by serial
+ sprintf(search_key, "%08x", drillbit->serial);
HASH_FIND_STR(settings, search_key, setting);
if (setting) {
- drvlog(LOG_INFO, "Using unit-specific settings for serial %s", search_key);
+ drvlog(LOG_INFO, "Using serial specific settings for serial %s", search_key);
return setting;
}
@@ -353,12 +348,18 @@ static config_setting *find_settings(struct cgpu_info *drillbit)
return setting;
}
- // Failing that, return default/generic config (null key)
+ // Check for a generic/catchall drillbit-options argument (key set to NULL)
search_key[0] = 0;
HASH_FIND_STR(settings, search_key, setting);
- drvlog(LOG_INFO, "Using non-specific settings for device %s (serial %08x)", info->product,
- info->serial);
- return setting;
+ if (setting) {
+ drvlog(LOG_INFO, "Using non-specific settings for device %s (serial %08x)", info->product,
+ info->serial);
+ return setting;
+ }
+
+ drvlog(LOG_WARNING, "Keeping onboard defaults for device %s (serial %08x)",
+ info->product, info->serial);
+ return NULL;
}
static void drillbit_send_config(struct cgpu_info *drillbit)
@@ -373,6 +374,8 @@ static void drillbit_send_config(struct cgpu_info *drillbit)
// Find the relevant board config
setting = find_settings(drillbit);
+ if(!setting)
+ return; // Don't update board config from defaults
drvlog(LOG_NOTICE, "Config: %s:%d:%d:%d Serial: %08x",
setting->config.use_ext_clock ? "ext" : "int",
setting->config.clock_freq,
@@ -467,9 +470,6 @@ static bool drillbit_parse_options(struct cgpu_info *drillbit)
if (settings != NULL)
return true; // Already initialised
- // Start with the system-wide defaults
- HASH_ADD_STR(settings, key, (&default_settings));
-
char *next_opt = opt_drillbit_options;
while (next_opt && strlen(next_opt)) {
BoardConfig parsed_config;