[Pkg-bitcoin-commits] [bfgminer] 01/01: Imported Upstream version 3.8.1
Dmitry Smirnov
onlyjob at moszumanska.debian.org
Sat Dec 14 18:17:27 UTC 2013
This is an automated email from the git hooks/post-receive script.
onlyjob pushed a commit to branch upstream
in repository bfgminer.
commit 8aa28ef (upstream)
Author: Dmitry Smirnov <onlyjob at member.fsf.org>
Date: Sat Dec 14 18:15:10 2013
Imported Upstream version 3.8.1
---
Makefile.am | 4 +-
NEWS | 24 ++++++
api-example.c | 5 ++
api.c | 6 +-
compat.h | 16 ++++
configure.ac | 29 +++----
debian/changelog | 6 ++
debian/control | 2 +-
driver-hashbuster2.c => driver-hashbusterusb.c | 100 ++++++++++++++-----------
lowl-vcom.c | 18 +++++
lowlevel.c | 2 +-
miner.c | 84 ++++++++++++++-------
openwrt/bfgminer/Makefile | 2 +-
13 files changed, 201 insertions(+), 97 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index f82a419..b03e4c5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -275,8 +275,8 @@ if USE_HASHBUSTER
bfgminer_SOURCES += driver-hashbuster.c
endif
-if USE_HASHBUSTER2
-bfgminer_SOURCES += driver-hashbuster2.c
+if USE_HASHBUSTERUSB
+bfgminer_SOURCES += driver-hashbusterusb.c
endif
endif
diff --git a/NEWS b/NEWS
index 84c8503..662d24f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,27 @@
+BFGMiner Version 3.8.1 - December 9, 2013
+
+- bfgminer-rpc: Catch error when server host fails to resolve to an IP
+- RPC: Remove unnecessary delay from RPC server startup
+- Call WSAStartup for our own needs independently of libcurl etc
+- hashbusterusb: Give more meaningful errors before serial number is known
+- hashbusterusb: Populate device_path with USB devid
+- Rename hashbuster2 to hashbusterusb (only a-z allowed in driver names)
+- Include libusb in options list, since it is no longer tied to specific drivers
+- Make hashbuster serial number output match formatting on physical board
+- Fix for hashbuster first init after power up
+- Workaround Microsoft's non-standard swprintf
+- vcom: Fabricate vcom devinfo for any existing paths specified to --scan, in
+case enumeration fails
+- Bugfix: hashbuster2: Check for errors setting up libusb handle
+- Bugfix: Draw statuswin in line order to ensure overflow is cutoff properly
+- Fixed one byte stack overflow in mcast recvfrom.
+- Bugfix: Let libc do any translation for %lc before adding wide characters to
+curses
+- Specifically handle mining.get_transactions failures so they get logged at the
+lower debug loglevel
+- Bugfix: lowlevel: Use LL_DELETE2 when cleaning up secondary list
+
+
BFGMiner Version 3.8.0 - December 1, 2013
- Bugfix: lowl-usb.h: Add missing includes for stdbool/stdint
diff --git a/api-example.c b/api-example.c
index 17d349f..a92c58d 100644
--- a/api-example.c
+++ b/api-example.c
@@ -200,6 +200,11 @@ int callapi(char *command, char *host, short int port)
SOCKETINIT;
ip = gethostbyname(host);
+ if (!ip)
+ {
+ printf("Failed to resolve host %s\n", host);
+ return 1;
+ }
sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock == INVSOCK) {
diff --git a/api.c b/api.c
index ed7fc5e..9b1d760 100644
--- a/api.c
+++ b/api.c
@@ -3947,7 +3947,7 @@ static void mcast()
count++;
came_from_siz = sizeof(came_from);
- if (SOCKETFAIL(rep = recvfrom(mcast_sock, buf, sizeof(buf),
+ if (SOCKETFAIL(rep = recvfrom(mcast_sock, buf, sizeof(buf) - 1,
0, (struct sockaddr *)(&came_from), &came_from_siz))) {
applog(LOG_DEBUG, "API mcast failed count=%d (%s) (%d)",
count, SOCKERRMSG, (int)mcast_sock);
@@ -4088,10 +4088,6 @@ void api(int api_thr_id)
}
}
- /* This should be done before curl in needed
- * to ensure curl has already called WSAStartup() in windows */
- cgsleep_ms(opt_log_interval*1000);
-
*apisock = socket(AF_INET, SOCK_STREAM, 0);
if (*apisock == INVSOCK) {
applog(LOG_ERR, "API1 initialisation failed (%s)%s", SOCKERRMSG, UNAVAILABLE);
diff --git a/compat.h b/compat.h
index 0575afd..0760ce4 100644
--- a/compat.h
+++ b/compat.h
@@ -22,6 +22,22 @@
// Missing from uthash before 1.9.7
+#define LL_DELETE2(head,del,next) \
+do { \
+ LDECLTYPE(head) _tmp; \
+ if ((head) == (del)) { \
+ (head)=(head)->next; \
+ } else { \
+ _tmp = head; \
+ while (_tmp->next && (_tmp->next != (del))) { \
+ _tmp = _tmp->next; \
+ } \
+ if (_tmp->next) { \
+ _tmp->next = ((del)->next); \
+ } \
+ } \
+} while (0)
+
#define LL_FOREACH2(head,el,next) \
for(el=head;el;el=(el)->next)
diff --git a/configure.ac b/configure.ac
index 3e8528c..6fa2624 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,7 +14,7 @@ dnl * any later version. See COPYING for more details.
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
m4_define([v_maj], [3])
m4_define([v_min], [8])
-m4_define([v_mic], [0])
+m4_define([v_mic], [1])
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
m4_define([v_ver], [v_maj.v_min.v_mic])
m4_define([lt_rev], m4_eval(v_maj + v_min))
@@ -501,6 +501,7 @@ AM_CONDITIONAL([HAS_MODMINER], [test x$modminer = xyes])
PKG_PROG_PKG_CONFIG()
+optlist="$optlist libusb"
libusb=no
libusb_include_path=""
AC_ARG_WITH([libusb],
@@ -798,29 +799,29 @@ fi
AM_CONDITIONAL([USE_HASHBUSTER], [test x$hashbuster = xyes])
-driverlist="$driverlist hashbuster2"
-AC_ARG_ENABLE([hashbuster2],
- [AC_HELP_STRING([--disable-hashbuster2],[Compile support for HashBuster Micro (default if libusb)])],
- [hashbuster2=$enableval],
- [hashbuster2=auto]
+driverlist="$driverlist hashbusterusb"
+AC_ARG_ENABLE([hashbusterusb],
+ [AC_HELP_STRING([--disable-hashbusterusb],[Compile support for HashBuster Micro (default if libusb)])],
+ [hashbusterusb=$enableval],
+ [hashbusterusb=auto]
)
-if test "x$hashbuster2$want_libusb" = xyesno; then
+if test "x$hashbusterusb$want_libusb" = xyesno; then
AC_MSG_ERROR([You disabled libusb, required for HashBuster Micro support])
-elif test "x$hashbuster2$libusb" = xyesno; then
+elif test "x$hashbusterusb$libusb" = xyesno; then
AC_MSG_ERROR([Could not find libusb, required for HashBuster Micro support])
-elif test "x$hashbuster2" = xauto; then
- hashbuster2="$libusb"
+elif test "x$hashbusterusb" = xauto; then
+ hashbusterusb="$libusb"
if test "x$libusb" = xno; then
AC_MSG_WARN([Could not find libusb, required for HashBuster Micro support])
- hashbuster2_enableaction="install libusb 1.0+"
+ hashbusterusb_enableaction="install libusb 1.0+"
fi
fi
-if test "x$hashbuster2" = xyes; then
- AC_DEFINE([USE_HASHBUSTER2], [1], [Defined to 1 if HashBuster Micro support is wanted])
+if test "x$hashbusterusb" = xyes; then
+ AC_DEFINE([USE_HASHBUSTERUSB], [1], [Defined to 1 if HashBuster Micro support is wanted])
need_lowl_usb=yes
has_asic=yes
fi
-AM_CONDITIONAL([USE_HASHBUSTER2], [test x$hashbuster2 = xyes])
+AM_CONDITIONAL([USE_HASHBUSTERUSB], [test x$hashbusterusb = xyes])
driverlist="$driverlist metabank"
diff --git a/debian/changelog b/debian/changelog
index 0fff708..658531f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+bfgminer (3.8.1-0precise1) precise; urgency=low
+
+ * Bug fixes only.
+
+ -- Luke Dashjr <luke+bfgminer at dashjr.org> Mon, 09 Dec 2013 03:19:55 -0000
+
bfgminer (3.8.0-0precise1) precise; urgency=low
* New driver for HashBuster Micro boards.
diff --git a/debian/control b/debian/control
index e9825c3..c2ac46e 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: bfgminer
Priority: optional
Section: misc
Maintainer: Luke Dashjr <luke_bfgminer at dashjr.org>
-Standards-Version: 3.8.0
+Standards-Version: 3.8.1
Build-Depends: build-essential, debhelper, autoconf, automake, libtool, libssl-dev, yasm, pkg-config, libudev-dev, libcurl4-openssl-dev, wget, unzip, libjansson-dev, libncurses5-dev, libudev-dev, libusb-1.0-0-dev, git, quilt, uthash-dev, libsensors4-dev
Package: bfgminer
diff --git a/driver-hashbuster2.c b/driver-hashbusterusb.c
similarity index 67%
rename from driver-hashbuster2.c
rename to driver-hashbusterusb.c
index 9e5f522..ad733ef 100644
--- a/driver-hashbuster2.c
+++ b/driver-hashbusterusb.c
@@ -27,10 +27,10 @@
#define HASHBUSTER_MAX_BYTES_PER_SPI_TRANSFER 61
-BFG_REGISTER_DRIVER(hashbuster2_drv)
+BFG_REGISTER_DRIVER(hashbusterusb_drv)
static
-bool hashbuster2_io(struct lowl_usb_endpoint * const h, unsigned char *buf, unsigned char *cmd)
+bool hashbusterusb_io(struct lowl_usb_endpoint * const h, unsigned char *buf, unsigned char *cmd)
{
char x[0x81];
@@ -58,40 +58,40 @@ bool hashbuster2_io(struct lowl_usb_endpoint * const h, unsigned char *buf, unsi
}
static
-bool hashbuster2_spi_config(struct lowl_usb_endpoint * const h, const uint8_t mode, const uint8_t miso, const uint32_t freq)
+bool hashbusterusb_spi_config(struct lowl_usb_endpoint * const h, const uint8_t mode, const uint8_t miso, const uint32_t freq)
{
uint8_t buf[0x40] = {'\x01', '\x01'};
- if (!hashbuster2_io(h, buf, buf))
+ if (!hashbusterusb_io(h, buf, buf))
return false;
return (buf[1] == '\x00');
}
static
-bool hashbuster2_spi_disable(struct lowl_usb_endpoint * const h)
+bool hashbusterusb_spi_disable(struct lowl_usb_endpoint * const h)
{
uint8_t buf[0x40] = {'\x01', '\x00'};
- if (!hashbuster2_io(h, buf, buf))
+ if (!hashbusterusb_io(h, buf, buf))
return false;
return (buf[1] == '\x00');
}
static
-bool hashbuster2_spi_reset(struct lowl_usb_endpoint * const h, uint8_t chips)
+bool hashbusterusb_spi_reset(struct lowl_usb_endpoint * const h, uint8_t chips)
{
uint8_t buf[0x40] = {'\x02', '\x00', chips};
- if (!hashbuster2_io(h, buf, buf))
+ if (!hashbusterusb_io(h, buf, buf))
return false;
return (buf[1] == '\x00');
}
static
-bool hashbuster2_spi_transfer(struct lowl_usb_endpoint * const h, void * const buf, const void * const data, size_t datasz)
+bool hashbusterusb_spi_transfer(struct lowl_usb_endpoint * const h, void * const buf, const void * const data, size_t datasz)
{
if (datasz > HASHBUSTER_MAX_BYTES_PER_SPI_TRANSFER)
return false;
uint8_t cbuf[0x40] = {'\x03', '\x00', datasz};
memcpy(&cbuf[3], data, datasz);
- if (!hashbuster2_io(h, cbuf, cbuf))
+ if (!hashbusterusb_io(h, cbuf, cbuf))
return false;
if (cbuf[2] != datasz)
return false;
@@ -100,21 +100,21 @@ bool hashbuster2_spi_transfer(struct lowl_usb_endpoint * const h, void * const b
}
static
-bool hashbuster2_spi_txrx(struct spi_port * const port)
+bool hashbusterusb_spi_txrx(struct spi_port * const port)
{
struct lowl_usb_endpoint * const h = port->userp;
const uint8_t *wrbuf = spi_gettxbuf(port);
uint8_t *rdbuf = spi_getrxbuf(port);
size_t bufsz = spi_getbufsz(port);
- hashbuster2_spi_disable(h);
- hashbuster2_spi_reset(h, 0x10);
+ hashbusterusb_spi_disable(h);
+ hashbusterusb_spi_reset(h, 0x10);
- hashbuster2_spi_config(h, port->mode, 0, port->speed);
+ hashbusterusb_spi_config(h, port->mode, 0, port->speed);
while (bufsz >= HASHBUSTER_MAX_BYTES_PER_SPI_TRANSFER)
{
- if (!hashbuster2_spi_transfer(h, rdbuf, wrbuf, HASHBUSTER_MAX_BYTES_PER_SPI_TRANSFER))
+ if (!hashbusterusb_spi_transfer(h, rdbuf, wrbuf, HASHBUSTER_MAX_BYTES_PER_SPI_TRANSFER))
return false;
rdbuf += HASHBUSTER_MAX_BYTES_PER_SPI_TRANSFER;
wrbuf += HASHBUSTER_MAX_BYTES_PER_SPI_TRANSFER;
@@ -123,7 +123,7 @@ bool hashbuster2_spi_txrx(struct spi_port * const port)
if (bufsz > 0)
{
- if (!hashbuster2_spi_transfer(h, rdbuf, wrbuf, bufsz))
+ if (!hashbusterusb_spi_transfer(h, rdbuf, wrbuf, bufsz))
return false;
}
@@ -131,13 +131,13 @@ bool hashbuster2_spi_txrx(struct spi_port * const port)
}
static
-bool hashbuster2_lowl_match(const struct lowlevel_device_info * const info)
+bool hashbusterusb_lowl_match(const struct lowlevel_device_info * const info)
{
return lowlevel_match_id(info, &lowl_usb, 0xFA04, 0x000D);
}
static
-bool hashbuster2_lowl_probe(const struct lowlevel_device_info * const info)
+bool hashbusterusb_lowl_probe(const struct lowlevel_device_info * const info)
{
struct cgpu_info *cgpu = NULL;
struct bitfury_device **devicelist, *bitfury;
@@ -149,42 +149,48 @@ bool hashbuster2_lowl_probe(const struct lowlevel_device_info * const info)
libusb_device_handle *h;
if (info->lowl != &lowl_usb)
- applogr(false, LOG_DEBUG, "%s: Matched \"%s\" serial \"%s\", but lowlevel driver is not usb_generic!",
- __func__, product, serial);
+ applogr(false, LOG_DEBUG, "%s: Matched \"%s\" %s, but lowlevel driver is not usb_generic!",
+ __func__, product, info->devid);
if (info->vid != 0xFA04 || info->pid != 0x000D)
applogr(false, LOG_DEBUG, "%s: Wrong VID/PID", __func__);
libusb_device *dev = info->lowl_data;
- libusb_open(dev, &h);
- libusb_set_configuration(h, 1);
- libusb_claim_interface(h, 0);
+ if ( (j = libusb_open(dev, &h)) )
+ applogr(false, LOG_ERR, "%s: Failed to open %s: %s",
+ __func__, info->devid, bfg_strerror(j, BST_LIBUSB));
+ if ( (j = libusb_set_configuration(h, 1)) )
+ applogr(false, LOG_ERR, "%s: Failed to set configuration 1 on %s: %s",
+ __func__, info->devid, bfg_strerror(j, BST_LIBUSB));
+ if ( (j = libusb_claim_interface(h, 0)) )
+ applogr(false, LOG_ERR, "%s: Failed to claim interface 0 on %s: %s",
+ __func__, info->devid, bfg_strerror(j, BST_LIBUSB));
struct lowl_usb_endpoint * const ep = usb_open_ep_pair(h, 0x81, 64, 0x01, 64);
usb_ep_set_timeouts_ms(ep, 100, 0);
unsigned char OUTPacket[64];
unsigned char INPacket[64];
OUTPacket[0] = 0xFE;
- hashbuster2_io(ep, INPacket, OUTPacket);
+ hashbusterusb_io(ep, INPacket, OUTPacket);
if (INPacket[1] == 0x18)
{
// Turn on miner PSU
OUTPacket[0] = 0x10;
OUTPacket[1] = 0x00;
OUTPacket[2] = 0x01;
- hashbuster2_io(ep, INPacket, OUTPacket);
+ hashbusterusb_io(ep, INPacket, OUTPacket);
}
OUTPacket[0] = '\x20';
- hashbuster2_io(ep, INPacket, OUTPacket);
+ hashbusterusb_io(ep, INPacket, OUTPacket);
if (!memcmp(INPacket, "\x20\0", 2))
{
- // 64-bit LE serial number
+ // 64-bit BE serial number
uint64_t sernum = 0;
- for (j = 2; j < 10; ++j)
- sernum = (sernum << 8) | INPacket[j];
+ for (j = 0; j < 8; ++j)
+ sernum |= (uint64_t)INPacket[j + 2] << (j * 8);
serial = malloc((8 * 2) + 1);
- sprintf(serial, "%08"PRIx64, sernum);
+ sprintf(serial, "%08"PRIX64, sernum);
}
else
serial = maybe_strdup(info->serial);
@@ -193,17 +199,22 @@ bool hashbuster2_lowl_probe(const struct lowlevel_device_info * const info)
port = malloc(sizeof(*port));
port->cgpu = &dummy_cgpu;
- port->txrx = hashbuster2_spi_txrx;
+ port->txrx = hashbusterusb_spi_txrx;
port->userp = ep;
- port->repr = hashbuster2_drv.dname;
+ port->repr = hashbusterusb_drv.dname;
port->logprio = LOG_DEBUG;
port->speed = 100000;
port->mode = 0;
chip_n = libbitfury_detectChips1(port);
+
+ if (unlikely(!chip_n))
+ chip_n = libbitfury_detectChips1(port);
+
if (unlikely(!chip_n))
{
- applog(LOG_WARNING, "%s: No chips found on %s", __func__, serial);
+ applog(LOG_WARNING, "%s: No chips found on %s (serial \"%s\")",
+ __func__, info->devid, serial);
fail:
usb_close_ep(ep);
free(port);
@@ -213,7 +224,7 @@ fail:
return false;
}
- if (bfg_claim_libusb(&hashbuster2_drv, true, dev))
+ if (bfg_claim_libusb(&hashbusterusb_drv, true, dev))
goto fail;
{
@@ -230,11 +241,12 @@ fail:
cgpu = malloc(sizeof(*cgpu));
*cgpu = (struct cgpu_info){
- .drv = &hashbuster2_drv,
+ .drv = &hashbusterusb_drv,
.procs = chip_n,
.device_data = devicelist,
.cutofftemp = 200,
.threads = 1,
+ .device_path = strdup(info->devid),
.dev_manufacturer = maybe_strdup(info->manufacturer),
.dev_product = maybe_strdup(product),
.dev_serial = serial,
@@ -246,7 +258,7 @@ fail:
}
static
-bool hashbuster2_init(struct thr_info * const thr)
+bool hashbusterusb_init(struct thr_info * const thr)
{
struct cgpu_info * const cgpu = thr->cgpu, *proc;
@@ -274,7 +286,7 @@ bool hashbuster2_init(struct thr_info * const thr)
}
static
-bool hashbuster2_get_stats(struct cgpu_info * const cgpu)
+bool hashbusterusb_get_stats(struct cgpu_info * const cgpu)
{
struct cgpu_info *proc;
if (cgpu != cgpu->device)
@@ -284,7 +296,7 @@ bool hashbuster2_get_stats(struct cgpu_info * const cgpu)
struct spi_port * const spi = bitfury->spi;
struct lowl_usb_endpoint * const h = spi->userp;
uint8_t buf[0x40] = {'\x04'};
- if (!hashbuster2_io(h, buf, buf))
+ if (!hashbusterusb_io(h, buf, buf))
return false;
if (buf[1])
{
@@ -294,13 +306,13 @@ bool hashbuster2_get_stats(struct cgpu_info * const cgpu)
return true;
}
-struct device_drv hashbuster2_drv = {
- .dname = "hashbuster2",
+struct device_drv hashbusterusb_drv = {
+ .dname = "hashbusterusb",
.name = "HBR",
- .lowl_match = hashbuster2_lowl_match,
- .lowl_probe = hashbuster2_lowl_probe,
+ .lowl_match = hashbusterusb_lowl_match,
+ .lowl_probe = hashbusterusb_lowl_probe,
- .thread_init = hashbuster2_init,
+ .thread_init = hashbusterusb_init,
.thread_disable = bitfury_disable,
.thread_enable = bitfury_enable,
.thread_shutdown = bitfury_shutdown,
@@ -311,7 +323,7 @@ struct device_drv hashbuster2_drv = {
.poll = bitfury_do_io,
.job_process_results = bitfury_job_process_results,
- .get_stats = hashbuster2_get_stats,
+ .get_stats = hashbusterusb_get_stats,
.get_api_extra_device_detail = bitfury_api_device_detail,
.get_api_extra_device_status = bitfury_api_device_status,
diff --git a/lowl-vcom.c b/lowl-vcom.c
index 56467d8..25835b1 100644
--- a/lowl-vcom.c
+++ b/lowl-vcom.c
@@ -643,6 +643,23 @@ extern void _vcom_devinfo_scan_querydosdevice(struct lowlevel_device_info **);
extern void _vcom_devinfo_scan_lsdev(struct lowlevel_device_info **);
#endif
+void _vcom_devinfo_scan_user(struct lowlevel_device_info ** const devinfo_list)
+{
+ struct string_elist *sd_iter, *sd_tmp;
+ DL_FOREACH_SAFE(scan_devices, sd_iter, sd_tmp)
+ {
+ const char * const dname = sd_iter->string;
+ const char * const colon = strpbrk(dname, ":@");
+ const char *dev;
+ if (!(colon && colon != dname))
+ dev = dname;
+ else
+ dev = &colon[1];
+ if (!access(dev, F_OK))
+ _vcom_devinfo_findorcreate(devinfo_list, dev);
+ }
+}
+
extern bool lowl_usb_attach_kernel_driver(const struct lowlevel_device_info *);
bool vcom_lowl_probe_wrapper(const struct lowlevel_device_info * const info, detectone_func_t detectone)
@@ -744,6 +761,7 @@ struct lowlevel_device_info *vcom_devinfo_scan()
#else
_vcom_devinfo_scan_lsdev(&devinfo_hash);
#endif
+ _vcom_devinfo_scan_user(&devinfo_hash);
// Convert hash to simple list
HASH_ITER(hh, devinfo_hash, devinfo, tmp)
diff --git a/lowlevel.c b/lowlevel.c
index 5165476..68b5e6a 100644
--- a/lowlevel.c
+++ b/lowlevel.c
@@ -77,7 +77,7 @@ void lowlevel_scan_free()
LL_DELETE(devinfo_list, info);
LL_FOREACH_SAFE2(info, info2, tmp2, same_devid_next)
{
- LL_DELETE(info, info2);
+ LL_DELETE2(info, info2, same_devid_next);
lowlevel_devinfo_free(info2);
}
}
diff --git a/miner.c b/miner.c
index ecfa0ee..fbf5380 100644
--- a/miner.c
+++ b/miner.c
@@ -3481,6 +3481,10 @@ static void text_print_status(int thr_id)
#ifdef HAVE_CURSES
static int attr_bad = A_BOLD;
+#ifdef WIN32
+#define swprintf snwprintf
+#endif
+
static
void bfg_waddstr(WINDOW *win, const char *s)
{
@@ -3536,7 +3540,6 @@ void bfg_waddstr(WINDOW *win, const char *s)
if (w > WCHAR_MAX || !iswprint(w))
w = '*';
default:
-#ifdef USE_UNICODE
if (w > WCHAR_MAX || !(iswprint(w) || w == '\n'))
{
#if REPLACEMENT_CHAR <= WCHAR_MAX
@@ -3547,13 +3550,15 @@ void bfg_waddstr(WINDOW *win, const char *s)
w = '?';
}
{
- wchar_t wc = w;
- waddnwstr(win, &wc, 1);
- }
+#ifdef USE_UNICODE
+ wchar_t wbuf[0x10];
+ int wbuflen = sizeof(wbuf) / sizeof(*wbuf);
+ wbuflen = swprintf(wbuf, wbuflen, L"%lc", (wint_t)w);
+ waddnwstr(win, wbuf, wbuflen);
#else
- // TODO: Maybe try using sprintf with %ls?
- waddch(win, '?');
+ wprintw(win, "%lc", (wint_t)w);
#endif
+ }
}
}
}
@@ -3617,12 +3622,26 @@ static void curses_print_status(const int ts)
);
}
wattroff(statuswin, A_BOLD);
- wmove(statuswin, 5, 1);
- bfg_waddstr(statuswin, statusline);
- wclrtoeol(statuswin);
+
+ wattron(statuswin, menu_attr);
+ cg_mvwprintw(statuswin, 1, 0, " [M]anage devices [P]ool management [S]ettings [D]isplay options [H]elp [Q]uit ");
+ wattroff(statuswin, menu_attr);
+ if ((pool_strategy == POOL_LOADBALANCE || pool_strategy == POOL_BALANCE) && total_pools > 1) {
+ cg_mvwprintw(statuswin, 2, 0, " Connected to multiple pools with%s block change notify",
+ have_longpoll ? "": "out");
+ } else if (pool->has_stratum) {
+ cg_mvwprintw(statuswin, 2, 0, " Connected to %s diff %s with stratum as user %s",
+ pool->sockaddr_url, pool->diff, pool->rpc_user);
+ } else {
+ cg_mvwprintw(statuswin, 2, 0, " Connected to %s diff %s with%s LP as user %s",
+ pool->sockaddr_url, pool->diff, have_longpoll ? "": "out", pool->rpc_user);
+ }
+ wclrtoeol(statuswin);
+ cg_mvwprintw(statuswin, 3, 0, " Block: %s Diff:%s (%s) Started: %s",
+ current_hash, block_diff, net_hashrate, blocktime);
+
income = total_diff_accepted * 3600 * block_subsidy / total_secs / current_diff;
-
char bwstr[12], incomestr[13];
format_unit3(incomestr, sizeof(incomestr), FUP_BTC, "BTC/hr", H2B_SHORT, income/1e8, -1);
cg_mvwprintw(statuswin, 4, 0, " ST:%d F:%d NB:%d AS:%d BW:[%s] E:%.2f I:%s BS:%s",
@@ -3638,19 +3657,10 @@ static void curses_print_status(const int ts)
incomestr,
best_share);
wclrtoeol(statuswin);
- if ((pool_strategy == POOL_LOADBALANCE || pool_strategy == POOL_BALANCE) && total_pools > 1) {
- cg_mvwprintw(statuswin, 2, 0, " Connected to multiple pools with%s block change notify",
- have_longpoll ? "": "out");
- } else if (pool->has_stratum) {
- cg_mvwprintw(statuswin, 2, 0, " Connected to %s diff %s with stratum as user %s",
- pool->sockaddr_url, pool->diff, pool->rpc_user);
- } else {
- cg_mvwprintw(statuswin, 2, 0, " Connected to %s diff %s with%s LP as user %s",
- pool->sockaddr_url, pool->diff, have_longpoll ? "": "out", pool->rpc_user);
- }
+
+ mvwaddstr(statuswin, 5, 0, " ");
+ bfg_waddstr(statuswin, statusline);
wclrtoeol(statuswin);
- cg_mvwprintw(statuswin, 3, 0, " Block: %s Diff:%s (%s) Started: %s",
- current_hash, block_diff, net_hashrate, blocktime);
logdiv = statusy - 1;
bfg_hline(statuswin, 6);
@@ -3670,10 +3680,6 @@ static void curses_print_status(const int ts)
mvwadd_wch(statuswin, logdiv, offset, WACS_BTEE);
}
#endif
-
- wattron(statuswin, menu_attr);
- cg_mvwprintw(statuswin, 1, 0, " [M]anage devices [P]ool management [S]ettings [D]isplay options [H]elp [Q]uit ");
- wattroff(statuswin, menu_attr);
}
static void adj_width(int var, int *length)
@@ -7739,9 +7745,16 @@ bool parse_stratum_response(struct pool *pool, char *s)
if (!json_is_integer(id_val)) {
if (json_is_string(id_val)
- && !strncmp(json_string_value(id_val), "txlist", 6)
- && !strcmp(json_string_value(id_val) + 6, pool->swork.job_id)
- && json_is_array(res_val)) {
+ && !strncmp(json_string_value(id_val), "txlist", 6))
+ {
+ const bool is_array = json_is_array(res_val);
+ applog(LOG_DEBUG, "Received %s for pool %u job %s",
+ is_array ? "transaction list" : "no-transaction-list response",
+ pool->pool_no, &json_string_value(id_val)[6]);
+ if (strcmp(json_string_value(id_val) + 6, pool->swork.job_id) || !is_array)
+ // We only care about a transaction list for the current job id
+ goto fishy;
+
// Check that the transactions actually hash to the merkle links
{
unsigned maxtx = 1 << pool->swork.merkles;
@@ -10022,6 +10035,10 @@ void _bfg_clean_up(bool restarting)
free(cpus);
curl_global_cleanup();
+
+#ifdef WIN32
+ WSACleanup();
+#endif
}
void _quit(int status)
@@ -10873,6 +10890,15 @@ int main(int argc, char *argv[])
setup_pthread_cancel_workaround();
#endif
+#ifdef WIN32
+ {
+ WSADATA wsa;
+ i = WSAStartup(MAKEWORD(2, 2), &wsa);
+ if (i)
+ quit(1, "Failed to initialise Winsock: %s", bfg_strerror(i, BST_SOCKET));
+ }
+#endif
+
/* This dangerous functions tramples random dynamically allocated
* variables so do it before anything at all */
if (unlikely(curl_global_init(CURL_GLOBAL_ALL)))
diff --git a/openwrt/bfgminer/Makefile b/openwrt/bfgminer/Makefile
index eb53791..48b3820 100644
--- a/openwrt/bfgminer/Makefile
+++ b/openwrt/bfgminer/Makefile
@@ -11,7 +11,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=bfgminer
PKG_TITLE:=BFGMiner
-PKG_VERSION:=3.8.0
+PKG_VERSION:=3.8.1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tbz2
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-bitcoin/bfgminer.git
More information about the Pkg-bitcoin-commits
mailing list