mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-10-10 08:03:04 -04:00
utils/ingenic_tools: correct return check of libusb_control_transfer in usbboot
libusb_control_transfer returns <0 for errors, 0 is success without any bytes, read and ret >0 is the amount if bytes read. Tested command: sudo ./usbboot --vid 0xa108 --pid 0x1000 --cpuinfo Before: Can't get CPU info: 8 After: CPU info: X1000_v1 Change-Id: Ied6d430406239ea4f99e7c83274d99ae4c555899
This commit is contained in:
parent
dd164cadb1
commit
0a0b877dc2
1 changed files with 2 additions and 2 deletions
|
|
@ -103,7 +103,7 @@ void jz_get_cpu_info(void)
|
|||
int ret = libusb_control_transfer(g_usb_dev,
|
||||
LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE,
|
||||
VR_GET_CPU_INFO, 0, 0, buf, 8, 1000);
|
||||
if(ret != 0)
|
||||
if(ret < 0)
|
||||
die("Can't get CPU info: %d", ret);
|
||||
|
||||
buf[8] = 0;
|
||||
|
|
@ -172,7 +172,7 @@ void jz_download(const char* filename)
|
|||
int ret = libusb_control_transfer(g_usb_dev, \
|
||||
LIBUSB_ENDPOINT_OUT|LIBUSB_REQUEST_TYPE_VENDOR|LIBUSB_RECIPIENT_DEVICE, \
|
||||
VR_##type, param >> 16, param & 0xffff, NULL, 0, 1000); \
|
||||
if(ret != 0) \
|
||||
if(ret < 0) \
|
||||
die("Request " #type " failed: %d", ret); \
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue