Browse Source

drv_set_defaults2 function to work with set_device_funcs

Luke Dashjr 12 years ago
parent
commit
85e519fe7e
2 changed files with 17 additions and 0 deletions
  1. 16 0
      miner.c
  2. 1 0
      miner.h

+ 16 - 0
miner.c

@@ -9839,6 +9839,22 @@ void drv_set_defaults(const struct device_drv * const drv, char *(*set_func)(str
 	cgpu_set_defaults(&dummy_cgpu);
 	cgpu_set_defaults(&dummy_cgpu);
 }
 }
 
 
+void drv_set_defaults2(const struct device_drv * const drv, const struct bfg_set_device_definition *setfuncs, void *userp)
+{
+	struct device_drv dummy_drv = *drv;
+	struct cgpu_info dummy_cgpu = {
+		.drv = &dummy_drv,
+		.device = &dummy_cgpu,
+		.device_id = -1,
+		.proc_id = -1,
+		.device_data = userp,
+		.set_device_funcs = setfuncs,
+	};
+	strcpy(dummy_cgpu.proc_repr, drv->name);
+	dummy_drv.set_device = NULL;
+	cgpu_set_defaults(&dummy_cgpu);
+}
+
 /* Makes sure the hashmeter keeps going even if mining threads stall, updates
 /* Makes sure the hashmeter keeps going even if mining threads stall, updates
  * the screen at regular intervals, and restarts threads if they appear to have
  * the screen at regular intervals, and restarts threads if they appear to have
  * died. */
  * died. */

+ 1 - 0
miner.h

@@ -1046,6 +1046,7 @@ extern void reinit_device(struct cgpu_info *cgpu);
 
 
 extern void cgpu_set_defaults(struct cgpu_info *);
 extern void cgpu_set_defaults(struct cgpu_info *);
 extern void drv_set_defaults(const struct device_drv *, char *(*set_func)(struct cgpu_info *, char *, char *, char *), void *userp);
 extern void drv_set_defaults(const struct device_drv *, char *(*set_func)(struct cgpu_info *, char *, char *, char *), void *userp);
+extern void drv_set_defaults2(const struct device_drv *, const struct bfg_set_device_definition *, void *userp);
 
 
 #ifdef HAVE_ADL
 #ifdef HAVE_ADL
 extern bool gpu_stats(int gpu, float *temp, int *engineclock, int *memclock, float *vddc, int *activity, int *fanspeed, int *fanpercent, int *powertune);
 extern bool gpu_stats(int gpu, float *temp, int *engineclock, int *memclock, float *vddc, int *activity, int *fanspeed, int *fanpercent, int *powertune);