From 8bc7d1c9a0c8f74d20f8f739f648955b618eff52 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Thu, 5 Jul 2012 08:59:09 +1000 Subject: [PATCH 1/3] Only try to adjust dev width when curses is built in. --- cgminer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cgminer.c b/cgminer.c index 34612f96..29ffc38a 100644 --- a/cgminer.c +++ b/cgminer.c @@ -4979,7 +4979,9 @@ void enable_device(struct cgpu_info *cgpu) cgpu->deven = DEV_ENABLED; devices[cgpu->cgminer_id = cgminer_id_count++] = cgpu; mining_threads += cgpu->threads; +#ifdef HAVE_CURSES adj_width(mining_threads, &dev_width); +#endif #ifdef HAVE_OPENCL if (cgpu->api == &opencl_api) { gpu_threads += cgpu->threads; From 54f8554af46c6ea7e554f5e32a633347f3c0c64b Mon Sep 17 00:00:00 2001 From: Paul Sheppard Date: Wed, 4 Jul 2012 18:46:41 -0700 Subject: [PATCH 2/3] Ad fd check to clear buffer. --- driver-bitforce.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/driver-bitforce.c b/driver-bitforce.c index 27494c46..07ca9175 100644 --- a/driver-bitforce.c +++ b/driver-bitforce.c @@ -143,6 +143,9 @@ static void biforce_clear_buffer(struct cgpu_info *bitforce) int fdDev = bitforce->device_fd; char pdevbuf[0x100]; + if (!fdDev) + return; + applog(LOG_DEBUG, "BFL%i: Clearing read buffer", bitforce->device_id); mutex_lock(&bitforce->device_mutex); From 1ee191a72629c1e347b53d312b8eb451d2b0273b Mon Sep 17 00:00:00 2001 From: Paul Sheppard Date: Wed, 4 Jul 2012 23:31:42 -0700 Subject: [PATCH 3/3] limit clear buffer iterations. --- driver-bitforce.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/driver-bitforce.c b/driver-bitforce.c index fec6acc8..e73fa6c5 100644 --- a/driver-bitforce.c +++ b/driver-bitforce.c @@ -142,6 +142,7 @@ static void biforce_clear_buffer(struct cgpu_info *bitforce) { int fdDev = bitforce->device_fd; char pdevbuf[0x100]; + int count = 0; if (!fdDev) return; @@ -152,7 +153,7 @@ static void biforce_clear_buffer(struct cgpu_info *bitforce) do { pdevbuf[0] = '\0'; BFgets(pdevbuf, sizeof(pdevbuf), fdDev); - } while (pdevbuf[0]); + } while (pdevbuf[0] && (++count < 10)); mutex_unlock(&bitforce->device_mutex); }