Commit 9c1cfbc7f17f5a2940715792f8fe1c1df896c689

Angus Gratton 2013-12-14T13:47:57

Allow chosing device settings based on 'short' product names shown in status line

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/driver-drillbit.c b/driver-drillbit.c
index 662bd18..6accc81 100644
--- a/driver-drillbit.c
+++ b/driver-drillbit.c
@@ -339,6 +339,14 @@ static config_setting *find_settings(struct cgpu_info *drillbit)
                 return setting;
         }
 
+        // Search by "short" product name
+        snprintf(search_key, 9, "%c%d", info->product[0], info->num_chips);
+        HASH_FIND_STR(settings, search_key, setting);
+        if(setting) {
+                drvlog(LOG_INFO, "Using product-specific settings for device %s", info->product);
+                return setting;
+        }
+
         // Failing that, return default/generic config (null key)
         search_key[0] = 0;
         HASH_FIND_STR(settings, search_key, setting);