mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-10 14:04:16 +00:00
Merge pull request #355 from denis2342/ztex
libztex: avoid the use of libusb_error_name()
This commit is contained in:
commit
7d14572973
14
libztex.c
14
libztex.c
@ -69,7 +69,7 @@ static int libztex_get_string_descriptor_ascii(libusb_device_handle *dev, uint8_
|
|||||||
LIBUSB_REQUEST_GET_DESCRIPTOR, (LIBUSB_DT_STRING << 8) | 0,
|
LIBUSB_REQUEST_GET_DESCRIPTOR, (LIBUSB_DT_STRING << 8) | 0,
|
||||||
0x0000, buf, sizeof(buf), 1000);
|
0x0000, buf, sizeof(buf), 1000);
|
||||||
if (cnt < 0) {
|
if (cnt < 0) {
|
||||||
applog(LOG_ERR, "%s: Failed to read LANGIDs: %s", __func__, libusb_error_name(cnt));
|
applog(LOG_ERR, "%s: Failed to read LANGIDs: %d", __func__, cnt);
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ static int libztex_get_string_descriptor_ascii(libusb_device_handle *dev, uint8_
|
|||||||
LIBUSB_REQUEST_GET_DESCRIPTOR, (LIBUSB_DT_STRING << 8) | desc_index,
|
LIBUSB_REQUEST_GET_DESCRIPTOR, (LIBUSB_DT_STRING << 8) | desc_index,
|
||||||
langid, buf, sizeof(buf), 1000);
|
langid, buf, sizeof(buf), 1000);
|
||||||
if (cnt < 0) {
|
if (cnt < 0) {
|
||||||
applog(LOG_ERR, "%s: Failed to read string descriptor: %s", __func__, libusb_error_name(cnt));
|
applog(LOG_ERR, "%s: Failed to read string descriptor: %d", __func__, cnt);
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ static bool libztex_firmwareReset(struct libusb_device_handle *hndl, bool enable
|
|||||||
int cnt = libusb_control_transfer(hndl, 0x40, 0xA0, 0xE600, 0, &reset, 1, 1000);
|
int cnt = libusb_control_transfer(hndl, 0x40, 0xA0, 0xE600, 0, &reset, 1, 1000);
|
||||||
if (cnt < 0)
|
if (cnt < 0)
|
||||||
{
|
{
|
||||||
applog(LOG_ERR, "Ztex reset %d failed: %s", libusb_error_name(cnt), enable);
|
applog(LOG_ERR, "Ztex reset %d failed: %d", enable, cnt);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ static enum check_result libztex_checkDevice(struct libusb_device *dev)
|
|||||||
|
|
||||||
err = libusb_open(dev, &hndl);
|
err = libusb_open(dev, &hndl);
|
||||||
if (err != LIBUSB_SUCCESS) {
|
if (err != LIBUSB_SUCCESS) {
|
||||||
applog(LOG_ERR, "%s: Can not open ZTEX device: %s", __func__, libusb_error_name(err));
|
applog(LOG_ERR, "%s: Can not open ZTEX device: %d", __func__, err);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ static enum check_result libztex_checkDevice(struct libusb_device *dev)
|
|||||||
int k = libusb_control_transfer(hndl, 0x40, 0xA0, i, 0, fw_buf + i, numbytes, 1000);
|
int k = libusb_control_transfer(hndl, 0x40, 0xA0, i, 0, fw_buf + i, numbytes, 1000);
|
||||||
if (k < numbytes)
|
if (k < numbytes)
|
||||||
{
|
{
|
||||||
applog(LOG_ERR, "Ztex device: Failed to write firmware at %d with: %s", i, libusb_error_name(k));
|
applog(LOG_ERR, "Ztex device: Failed to write firmware at %d with err: %d", i, k);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -589,7 +589,7 @@ int libztex_prepare_device(struct libusb_device *dev, struct libztex_device** zt
|
|||||||
|
|
||||||
err = libusb_open(dev, &newdev->hndl);
|
err = libusb_open(dev, &newdev->hndl);
|
||||||
if (err != LIBUSB_SUCCESS) {
|
if (err != LIBUSB_SUCCESS) {
|
||||||
applog(LOG_ERR, "%s: Can not open ZTEX device: %s", __func__, libusb_error_name(err));
|
applog(LOG_ERR, "%s: Can not open ZTEX device: %d", __func__, err);
|
||||||
return CHECK_ERROR;
|
return CHECK_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -734,7 +734,7 @@ int libztex_scanDevices(struct libztex_dev_list*** devs_p)
|
|||||||
err = libztex_checkDevice(list[i]);
|
err = libztex_checkDevice(list[i]);
|
||||||
switch (err) {
|
switch (err) {
|
||||||
case CHECK_ERROR:
|
case CHECK_ERROR:
|
||||||
applog(LOG_ERR, "Ztex: Can not check device: %s", libusb_error_name(err));
|
applog(LOG_ERR, "Ztex: Can not check device: %d", err);
|
||||||
continue;
|
continue;
|
||||||
case CHECK_IS_NOT_ZTEX:
|
case CHECK_IS_NOT_ZTEX:
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user