Fix ERROR macros
This commit is contained in:
1 parent
34b55a222e
commit
ad68e324c6
5 files changed
+40
-37
No files matched your search
+10
-10
@@ -33,8 +33,8 @@
|
|||||||
#include "image.h"
|
#include "image.h"
|
||||||
#include "fiasco.h"
|
#include "fiasco.h"
|
||||||
|
|
||||||
#define FIASCO_READ_ERROR(fiasco, format, ...) do { ERROR(errno, format, ##__VA_ARGS__); fiasco_free(fiasco); return NULL; } while (0)
|
#define FIASCO_READ_ERROR(fiasco, ...) do { ERROR_INFO(__VA_ARGS__); fiasco_free(fiasco); return NULL; } while (0)
|
||||||
#define FIASCO_WRITE_ERROR(file, fd, format, ...) do { ERROR(errno, "%s: " format, file, ##__VA_ARGS__); if ( fd >= 0 ) close(fd); return -1; } while (0)
|
#define FIASCO_WRITE_ERROR(file, fd, ...) do { ERROR_INFO_STR(file, __VA_ARGS__); if ( fd >= 0 ) close(fd); return -1; } while (0)
|
||||||
#define READ_OR_FAIL(fiasco, buf, size) do { if ( read(fiasco->fd, buf, size) != size ) { FIASCO_READ_ERROR(fiasco, "Cannot read %d bytes", size); } } while (0)
|
#define READ_OR_FAIL(fiasco, buf, size) do { if ( read(fiasco->fd, buf, size) != size ) { FIASCO_READ_ERROR(fiasco, "Cannot read %d bytes", size); } } while (0)
|
||||||
#define READ_OR_RETURN(fiasco, buf, size) do { if ( read(fiasco->fd, buf, size) != size ) return fiasco; } while (0)
|
#define READ_OR_RETURN(fiasco, buf, size) do { if ( read(fiasco->fd, buf, size) != size ) return fiasco; } while (0)
|
||||||
#define WRITE_OR_FAIL(file, fd, buf, size) do { if ( ! simulate ) { if ( write(fd, buf, size) != size ) { FIASCO_WRITE_ERROR(file, fd, "Cannot write %d bytes", size); } } } while (0)
|
#define WRITE_OR_FAIL(file, fd, buf, size) do { if ( ! simulate ) { if ( write(fd, buf, size) != size ) { FIASCO_WRITE_ERROR(file, fd, "Cannot write %d bytes", size); } } } while (0)
|
||||||
@@ -77,7 +77,7 @@ struct fiasco * fiasco_alloc_from_file(const char * file) {
|
|||||||
|
|
||||||
fiasco->fd = open(file, O_RDONLY);
|
fiasco->fd = open(file, O_RDONLY);
|
||||||
if ( fiasco->fd < 0 ) {
|
if ( fiasco->fd < 0 ) {
|
||||||
ERROR(errno, "Cannot open file");
|
ERROR_INFO("Cannot open file");
|
||||||
fiasco_free(fiasco);
|
fiasco_free(fiasco);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,7 @@ struct fiasco * fiasco_alloc_from_file(const char * file) {
|
|||||||
|
|
||||||
/* Header of next image */
|
/* Header of next image */
|
||||||
if ( ! buf[0] == 0x54 && buf[2] == 0x2E && buf[3] == 0x19 && buf[4] == 0x01 && buf[5] == 0x01 && buf[6] == 0x00 ) {
|
if ( ! buf[0] == 0x54 && buf[2] == 0x2E && buf[3] == 0x19 && buf[4] == 0x01 && buf[5] == 0x01 && buf[6] == 0x00 ) {
|
||||||
ERROR(0, "Invalid next image header");
|
ERROR("Invalid next image header");
|
||||||
return fiasco;
|
return fiasco;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,7 +290,7 @@ int fiasco_write_to_file(struct fiasco * fiasco, const char * file) {
|
|||||||
if ( ! simulate ) {
|
if ( ! simulate ) {
|
||||||
fd = open(file, O_RDWR|O_CREAT|O_TRUNC, 0644);
|
fd = open(file, O_RDWR|O_CREAT|O_TRUNC, 0644);
|
||||||
if ( fd < 0 ) {
|
if ( fd < 0 ) {
|
||||||
ERROR(errno, "Cannot create file");
|
ERROR_INFO("Cannot create file");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -490,12 +490,12 @@ int fiasco_unpack(struct fiasco * fiasco, const char * dir) {
|
|||||||
memset(cwd, 0, sizeof(cwd));
|
memset(cwd, 0, sizeof(cwd));
|
||||||
|
|
||||||
if ( ! getcwd(cwd, sizeof(cwd)) ) {
|
if ( ! getcwd(cwd, sizeof(cwd)) ) {
|
||||||
ERROR(errno, "Cannot store current directory");
|
ERROR_INFO("Cannot store current directory");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( chdir(dir) < 0 ) {
|
if ( chdir(dir) < 0 ) {
|
||||||
ERROR(errno, "Cannot change current directory to %s", dir);
|
ERROR_INFO("Cannot change current directory to %s", dir);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -533,7 +533,7 @@ int fiasco_unpack(struct fiasco * fiasco, const char * dir) {
|
|||||||
|
|
||||||
fd = open(name, O_RDWR|O_CREAT|O_TRUNC, 0644);
|
fd = open(name, O_RDWR|O_CREAT|O_TRUNC, 0644);
|
||||||
if ( fd < 0 ) {
|
if ( fd < 0 ) {
|
||||||
ERROR(errno, "Cannot create output file %s", name);
|
ERROR_INFO("Cannot create output file %s", name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -553,7 +553,7 @@ int fiasco_unpack(struct fiasco * fiasco, const char * dir) {
|
|||||||
|
|
||||||
fd = open(layout_name, O_RDWR|O_CREAT|O_TRUNC, 0644);
|
fd = open(layout_name, O_RDWR|O_CREAT|O_TRUNC, 0644);
|
||||||
if ( fd < 0 ) {
|
if ( fd < 0 ) {
|
||||||
ERROR(errno, "Cannot create layout file %s", layout_name);
|
ERROR_INFO("Cannot create layout file %s", layout_name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -571,7 +571,7 @@ int fiasco_unpack(struct fiasco * fiasco, const char * dir) {
|
|||||||
|
|
||||||
if ( dir ) {
|
if ( dir ) {
|
||||||
if ( chdir(cwd) < 0 ) {
|
if ( chdir(cwd) < 0 ) {
|
||||||
ERROR(errno, "Cannot change current directory back to %s", cwd);
|
ERROR_INFO("Cannot change current directory back to %s", cwd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-4
@@ -10,11 +10,14 @@ extern int simulate;
|
|||||||
extern int noverify;
|
extern int noverify;
|
||||||
extern int verbose;
|
extern int verbose;
|
||||||
|
|
||||||
#define VERBOSE(format, ...) do { if ( verbose ) { fprintf(stderr, format, ##__VA_ARGS__); } } while (0)
|
#define VERBOSE(...) do { if ( verbose ) { fprintf(stderr, __VA_ARGS__); } } while (0)
|
||||||
#define ERROR(errno, format, ...) do { fprintf(stderr, "Error: "); fprintf(stderr, format, ##__VA_ARGS__); if ( errno ) fprintf(stderr, ": %s\n", strerror(errno)); else fprintf(stderr, "\n"); } while (0)
|
#define WARNING(...) do { fprintf(stderr, "Warning: "); fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n"); } while (0)
|
||||||
#define WARNING(format, ...) do { fprintf(stderr, "Warning: "); fprintf(stderr, format, ##__VA_ARGS__); fprintf(stderr, "\n"); } while (0)
|
#define ERROR_INFO_STR(str, ...) do { if ( str[0] ) fprintf(stderr, "Error: %s: ", str); else fprintf(stderr, "Error: "); fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n"); } while (0)
|
||||||
|
#define ERROR_STR(str, ...) do { errno = 0; ERROR_INFO_STR(str, __VA_ARGS__); } while (0)
|
||||||
|
#define ERROR_INFO(...) do { ERROR_INFO_STR("", __VA_ARGS__); } while (0)
|
||||||
|
#define ERROR(...) do { ERROR_STR("", __VA_ARGS__); } while (0)
|
||||||
|
|
||||||
#define ALLOC_ERROR() do { ERROR(0, "Cannot allocate memory"); } while (0)
|
#define ALLOC_ERROR() do { ERROR("Cannot allocate memory"); } while (0)
|
||||||
#define ALLOC_ERROR_RETURN(...) do { ALLOC_ERROR(); return __VA_ARGS__; } while (0)
|
#define ALLOC_ERROR_RETURN(...) do { ALLOC_ERROR(); return __VA_ARGS__; } while (0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+3
-3
@@ -198,7 +198,7 @@ struct image * image_alloc_from_file(const char * file, const char * type, const
|
|||||||
image->is_shared_fd = 0;
|
image->is_shared_fd = 0;
|
||||||
image->fd = open(file, O_RDONLY);
|
image->fd = open(file, O_RDONLY);
|
||||||
if ( image->fd < 0 ) {
|
if ( image->fd < 0 ) {
|
||||||
ERROR(errno, "Cannot open image file %s", file);
|
ERROR_INFO("Cannot open image file %s", file);
|
||||||
free(image);
|
free(image);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -234,7 +234,7 @@ struct image * image_alloc_from_shared_fd(int fd, size_t size, size_t offset, ui
|
|||||||
image_append(image, type, device, hwrevs, version, layout);
|
image_append(image, type, device, hwrevs, version, layout);
|
||||||
|
|
||||||
if ( ! noverify && image->hash != hash ) {
|
if ( ! noverify && image->hash != hash ) {
|
||||||
ERROR(0, "Image hash mishmash (counted %#04x, got %#04x)", image->hash, hash);
|
ERROR("Image hash mishmash (counted %#04x, got %#04x)", image->hash, hash);
|
||||||
image_free(image);
|
image_free(image);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -314,7 +314,7 @@ size_t image_read(struct image * image, void * buf, size_t count) {
|
|||||||
else
|
else
|
||||||
new_count = count - ret_count;
|
new_count = count - ret_count;
|
||||||
|
|
||||||
memset(buf+ret_count, 0xFF, new_count);
|
memset((unsigned char *)buf+ret_count, 0xFF, new_count);
|
||||||
ret_count += new_count;
|
ret_count += new_count;
|
||||||
image->acur += new_count;
|
image->acur += new_count;
|
||||||
|
|
||||||
|
|||||||
+14
-14
@@ -204,12 +204,12 @@ static void parse_image_arg(char * arg, struct image_list ** image_first) {
|
|||||||
off_t len;
|
off_t len;
|
||||||
int fd = open(layout_file, O_RDONLY);
|
int fd = open(layout_file, O_RDONLY);
|
||||||
if ( fd < 0 ) {
|
if ( fd < 0 ) {
|
||||||
ERROR(errno, "Cannot open layout file %s", layout_file);
|
ERROR_INFO("Cannot open layout file %s", layout_file);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
len = lseek(fd, 0, SEEK_END);
|
len = lseek(fd, 0, SEEK_END);
|
||||||
if ( len == (off_t)-1 ) {
|
if ( len == (off_t)-1 ) {
|
||||||
ERROR(errno, "Cannot get size of file %s", layout_file);
|
ERROR_INFO("Cannot get size of file %s", layout_file);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
lseek(fd, 0, SEEK_SET);
|
lseek(fd, 0, SEEK_SET);
|
||||||
@@ -219,7 +219,7 @@ static void parse_image_arg(char * arg, struct image_list ** image_first) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if ( read(fd, layout, len) != len ) {
|
if ( read(fd, layout, len) != len ) {
|
||||||
ERROR(errno, "Cannot read %lu bytes from layout file %s", len, layout_file);
|
ERROR_INFO("Cannot read %lu bytes from layout file %s", len, layout_file);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -230,7 +230,7 @@ static void parse_image_arg(char * arg, struct image_list ** image_first) {
|
|||||||
free(layout);
|
free(layout);
|
||||||
|
|
||||||
if ( ! image ) {
|
if ( ! image ) {
|
||||||
ERROR(0, "Cannot load image file %s", file);
|
ERROR("Cannot load image file %s", file);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -491,7 +491,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
/* load images from files */
|
/* load images from files */
|
||||||
if ( image_first && image_fiasco ) {
|
if ( image_first && image_fiasco ) {
|
||||||
ERROR(0, "Cannot specify normal and fiasco images together");
|
ERROR("Cannot specify normal and fiasco images together");
|
||||||
ret = 1;
|
ret = 1;
|
||||||
goto clean;
|
goto clean;
|
||||||
}
|
}
|
||||||
@@ -500,7 +500,7 @@ int main(int argc, char **argv) {
|
|||||||
if ( image_fiasco ) {
|
if ( image_fiasco ) {
|
||||||
fiasco_in = fiasco_alloc_from_file(image_fiasco_arg);
|
fiasco_in = fiasco_alloc_from_file(image_fiasco_arg);
|
||||||
if ( ! fiasco_in )
|
if ( ! fiasco_in )
|
||||||
ERROR(0, "Cannot load fiasco image file %s", image_fiasco_arg);
|
ERROR("Cannot load fiasco image file %s", image_fiasco_arg);
|
||||||
else
|
else
|
||||||
image_first = fiasco_in->first;
|
image_first = fiasco_in->first;
|
||||||
}
|
}
|
||||||
@@ -509,7 +509,7 @@ int main(int argc, char **argv) {
|
|||||||
if ( filter_type ) {
|
if ( filter_type ) {
|
||||||
enum image_type type = image_type_from_string(filter_type_arg);
|
enum image_type type = image_type_from_string(filter_type_arg);
|
||||||
if ( ! type ) {
|
if ( ! type ) {
|
||||||
ERROR(0, "Specified unknown image type for filtering: %s", filter_type_arg);
|
ERROR("Specified unknown image type for filtering: %s", filter_type_arg);
|
||||||
} else {
|
} else {
|
||||||
image_ptr = image_first;
|
image_ptr = image_first;
|
||||||
while ( image_ptr ) {
|
while ( image_ptr ) {
|
||||||
@@ -528,7 +528,7 @@ int main(int argc, char **argv) {
|
|||||||
if ( filter_device ) {
|
if ( filter_device ) {
|
||||||
enum device device = device_from_string(filter_device_arg);
|
enum device device = device_from_string(filter_device_arg);
|
||||||
if ( ! device ) {
|
if ( ! device ) {
|
||||||
ERROR(0, "Specified unknown device for filtering: %s", filter_device_arg);
|
ERROR("Specified unknown device for filtering: %s", filter_device_arg);
|
||||||
} else {
|
} else {
|
||||||
image_ptr = image_first;
|
image_ptr = image_first;
|
||||||
while ( image_ptr ) {
|
while ( image_ptr ) {
|
||||||
@@ -631,7 +631,7 @@ int main(int argc, char **argv) {
|
|||||||
fiasco_print_info(fiasco_in);
|
fiasco_print_info(fiasco_in);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
} else if ( ! image_first ) {
|
} else if ( ! image_first ) {
|
||||||
ERROR(0, "No image specified");
|
ERROR("No image specified");
|
||||||
ret = 1;
|
ret = 1;
|
||||||
goto clean;
|
goto clean;
|
||||||
}
|
}
|
||||||
@@ -672,7 +672,7 @@ int main(int argc, char **argv) {
|
|||||||
*(swver++) = 0;
|
*(swver++) = 0;
|
||||||
fiasco_out = fiasco_alloc_empty();
|
fiasco_out = fiasco_alloc_empty();
|
||||||
if ( ! fiasco_out ) {
|
if ( ! fiasco_out ) {
|
||||||
ERROR(0, "Cannot write images to fiasco file %s", fiasco_gen_arg);
|
ERROR("Cannot write images to fiasco file %s", fiasco_gen_arg);
|
||||||
} else {
|
} else {
|
||||||
if ( swver )
|
if ( swver )
|
||||||
strcpy(fiasco_out->swver, swver);
|
strcpy(fiasco_out->swver, swver);
|
||||||
@@ -690,21 +690,21 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
if ( dev_cold_flash ) {
|
if ( dev_cold_flash ) {
|
||||||
if ( have_2nd == 0 ) {
|
if ( have_2nd == 0 ) {
|
||||||
ERROR(0, "2nd image for Cold Flashing was not specified");
|
ERROR("2nd image for Cold Flashing was not specified");
|
||||||
ret = 1;
|
ret = 1;
|
||||||
goto clean;
|
goto clean;
|
||||||
} else if ( have_2nd == 2 ) {
|
} else if ( have_2nd == 2 ) {
|
||||||
ERROR(0, "More 2nd images for Cold Flashing was specified");
|
ERROR("More 2nd images for Cold Flashing was specified");
|
||||||
ret = 1;
|
ret = 1;
|
||||||
goto clean;
|
goto clean;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( have_secondary == 0 ) {
|
if ( have_secondary == 0 ) {
|
||||||
ERROR(0, "Secondary image for Cold Flashing was not specified");
|
ERROR("Secondary image for Cold Flashing was not specified");
|
||||||
ret = 1;
|
ret = 1;
|
||||||
goto clean;
|
goto clean;
|
||||||
} else if ( have_secondary == 2 ) {
|
} else if ( have_secondary == 2 ) {
|
||||||
ERROR(0, "More Secondary images for Cold Flashing was specified");
|
ERROR("More Secondary images for Cold Flashing was specified");
|
||||||
ret = 1;
|
ret = 1;
|
||||||
goto clean;
|
goto clean;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -34,7 +34,7 @@ static int prev = 0;
|
|||||||
#define PRINTF_ADD(format, ...) do { prev += printf(format, ##__VA_ARGS__); } while (0)
|
#define PRINTF_ADD(format, ...) do { prev += printf(format, ##__VA_ARGS__); } while (0)
|
||||||
#define PRINTF_LINE(format, ...) do { PRINTF_BACK(); PRINTF_ADD(format, ##__VA_ARGS__); fflush(stdout); } while (0)
|
#define PRINTF_LINE(format, ...) do { PRINTF_BACK(); PRINTF_ADD(format, ##__VA_ARGS__); fflush(stdout); } while (0)
|
||||||
#define PRINTF_END() do { if ( prev ) { printf("\n"); prev = 0; } } while (0)
|
#define PRINTF_END() do { if ( prev ) { printf("\n"); prev = 0; } } while (0)
|
||||||
#define PRINTF_ERROR(errno, format, ...) do { PRINTF_END(); ERROR(errno, format, ##__VA_ARGS__); } while (0)
|
#define PRINTF_ERROR(format, ...) do { PRINTF_END(); ERROR_INFO(format, ##__VA_ARGS__); } while (0)
|
||||||
|
|
||||||
static struct usb_flash_device usb_devices[] = {
|
static struct usb_flash_device usb_devices[] = {
|
||||||
{ 0x0421, 0x0105, 2, 1, -1, FLASH_NOLO, { DEVICE_SU_18, DEVICE_RX_44, DEVICE_RX_48, DEVICE_RX_51, 0 } },
|
{ 0x0421, 0x0105, 2, 1, -1, FLASH_NOLO, { DEVICE_SU_18, DEVICE_RX_44, DEVICE_RX_48, DEVICE_RX_51, 0 } },
|
||||||
@@ -43,7 +43,7 @@ static struct usb_flash_device usb_devices[] = {
|
|||||||
{ 0x0421, 0x01c8, -1, -1, -1, FLASH_MKII, { DEVICE_RX_51, 0 } },
|
{ 0x0421, 0x01c8, -1, -1, -1, FLASH_MKII, { DEVICE_RX_51, 0 } },
|
||||||
{ 0x0421, 0x0431, 0, -1, -1, FLASH_DISK, { DEVICE_SU_18, DEVICE_RX_34, 0 } },
|
{ 0x0421, 0x0431, 0, -1, -1, FLASH_DISK, { DEVICE_SU_18, DEVICE_RX_34, 0 } },
|
||||||
{ 0x0421, 0x3f00, 2, 1, -1, FLASH_NOLO, { DEVICE_RX_34, 0 } },
|
{ 0x0421, 0x3f00, 2, 1, -1, FLASH_NOLO, { DEVICE_RX_34, 0 } },
|
||||||
{ 0, 0, -1, -1, -1, 0, {} }
|
{ 0, }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char * usb_flash_protocols[] = {
|
static const char * usb_flash_protocols[] = {
|
||||||
@@ -92,7 +92,7 @@ static struct usb_device_info * usb_device_is_valid(struct usb_device * dev) {
|
|||||||
PRINTF_LINE("Opening USB...");
|
PRINTF_LINE("Opening USB...");
|
||||||
usb_dev_handle * udev = usb_open(dev);
|
usb_dev_handle * udev = usb_open(dev);
|
||||||
if ( ! udev ) {
|
if ( ! udev ) {
|
||||||
PRINTF_ERROR(errno, "usb_open failed");
|
PRINTF_ERROR("usb_open failed");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ static struct usb_device_info * usb_device_is_valid(struct usb_device * dev) {
|
|||||||
|
|
||||||
PRINTF_LINE("Claiming USB interface...");
|
PRINTF_LINE("Claiming USB interface...");
|
||||||
if ( usb_claim_interface(udev, usb_devices[i].interface) < 0 ) {
|
if ( usb_claim_interface(udev, usb_devices[i].interface) < 0 ) {
|
||||||
PRINTF_ERROR(errno, "usb_claim_interface failed");
|
PRINTF_ERROR("usb_claim_interface failed");
|
||||||
usb_close(udev);
|
usb_close(udev);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -111,7 +111,7 @@ static struct usb_device_info * usb_device_is_valid(struct usb_device * dev) {
|
|||||||
if ( usb_devices[i].alternate >= 0 ) {
|
if ( usb_devices[i].alternate >= 0 ) {
|
||||||
PRINTF_LINE("Setting alternate USB interface...");
|
PRINTF_LINE("Setting alternate USB interface...");
|
||||||
if ( usb_set_altinterface(udev, usb_devices[i].alternate) < 0 ) {
|
if ( usb_set_altinterface(udev, usb_devices[i].alternate) < 0 ) {
|
||||||
PRINTF_ERROR(errno, "usb_claim_interface failed");
|
PRINTF_ERROR("usb_claim_interface failed");
|
||||||
usb_close(udev);
|
usb_close(udev);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -120,7 +120,7 @@ static struct usb_device_info * usb_device_is_valid(struct usb_device * dev) {
|
|||||||
if ( usb_devices[i].configuration >= 0 ) {
|
if ( usb_devices[i].configuration >= 0 ) {
|
||||||
PRINTF_LINE("Setting USB configuration...");
|
PRINTF_LINE("Setting USB configuration...");
|
||||||
if ( usb_set_configuration(udev, usb_devices[i].configuration) < 0 ) {
|
if ( usb_set_configuration(udev, usb_devices[i].configuration) < 0 ) {
|
||||||
PRINTF_ERROR(errno, "usb_set_configuration failed");
|
PRINTF_ERROR("usb_set_configuration failed");
|
||||||
usb_close(udev);
|
usb_close(udev);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user