Commit d4a8dd80 authored by Henrik Nordstrom's avatar Henrik Nordstrom
Browse files

fel: Improve error reporting a bit

parent 17fb268e
...@@ -27,12 +27,9 @@ ...@@ -27,12 +27,9 @@
#include <ctype.h> #include <ctype.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <errno.h>
#include "endian_compat.h" #include "endian_compat.h"
int errno;
struct aw_usb_request { struct aw_usb_request {
char signature[8]; char signature[8];
uint32_t length; uint32_t length;
...@@ -55,8 +52,7 @@ void usb_bulk_send(libusb_device_handle *usb, int ep, const void *data, int leng ...@@ -55,8 +52,7 @@ void usb_bulk_send(libusb_device_handle *usb, int ep, const void *data, int leng
while (length > 0) { while (length > 0) {
rc = libusb_bulk_transfer(usb, ep, (void *)data, length, &sent, timeout); rc = libusb_bulk_transfer(usb, ep, (void *)data, length, &sent, timeout);
if (rc != 0) { if (rc != 0) {
errno = EIO; fprintf(stderr, "libusb usb_bulk_send error %d\n", rc);
perror("usb send");
exit(2); exit(2);
} }
length -= sent; length -= sent;
...@@ -70,8 +66,7 @@ void usb_bulk_recv(libusb_device_handle *usb, int ep, void *data, int length) ...@@ -70,8 +66,7 @@ void usb_bulk_recv(libusb_device_handle *usb, int ep, void *data, int length)
while (length > 0) { while (length > 0) {
rc = libusb_bulk_transfer(usb, ep, data, length, &recv, timeout); rc = libusb_bulk_transfer(usb, ep, data, length, &recv, timeout);
if (rc != 0) { if (rc != 0) {
errno = EIO; fprintf(stderr, "usb_bulk_recv error %d\n", rc);
perror("usb recv");
exit(2); exit(2);
} }
length -= recv; length -= recv;
...@@ -283,8 +278,7 @@ int main(int argc, char **argv) ...@@ -283,8 +278,7 @@ int main(int argc, char **argv)
handle = libusb_open_device_with_vid_pid(NULL, 0x1f3a, 0xefe8); handle = libusb_open_device_with_vid_pid(NULL, 0x1f3a, 0xefe8);
if (!handle) { if (!handle) {
errno = ENODEV; fprintf(stderr, "A10 USB FEL device not found!");
perror("A10 USB FEL device not found!");
exit(1); exit(1);
} }
rc = libusb_claim_interface(handle, 0); rc = libusb_claim_interface(handle, 0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment