summaryrefslogtreecommitdiff
path: root/razer-bw-te-ctl.c
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2024-11-25 05:24:02 +0100
committerPřemysl Eric Janouch <p@janouch.name>2024-11-25 05:46:26 +0100
commitb5dec466c6d5c4678f332e8ec75f32bed51730c3 (patch)
treeb0e4aa11cc5c44bbcea803b5e03ccf523038405d /razer-bw-te-ctl.c
parent0283189070f577e77d8f6a41c00d7cd69709ce14 (diff)
downloadusb-drivers-b5dec466c6d5c4678f332e8ec75f32bed51730c3.tar.gz
usb-drivers-b5dec466c6d5c4678f332e8ec75f32bed51730c3.tar.xz
usb-drivers-b5dec466c6d5c4678f332e8ec75f32bed51730c3.zip
Support cross-compiling for Windows
Diffstat (limited to 'razer-bw-te-ctl.c')
-rw-r--r--razer-bw-te-ctl.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/razer-bw-te-ctl.c b/razer-bw-te-ctl.c
index 58afec7..b56136c 100644
--- a/razer-bw-te-ctl.c
+++ b/razer-bw-te-ctl.c
@@ -309,7 +309,7 @@ apply_options(libusb_device_handle *device,
return 0;
}
-#define ERROR(label, ...) \
+#define FAIL(label, ...) \
do { \
fprintf(stderr, "Error: " __VA_ARGS__); \
status = 1; \
@@ -326,7 +326,7 @@ main(int argc, char *argv[])
int result, status = 0;
if ((result = libusb_init(NULL)))
- ERROR(error_0, "libusb initialisation failed: %s\n",
+ FAIL(error_0, "libusb initialisation failed: %s\n",
libusb_error_name(result));
result = 0;
@@ -334,10 +334,10 @@ main(int argc, char *argv[])
find_device(USB_VENDOR_RAZER, USB_PRODUCT_RAZER_BW_TE, &result);
if (!device) {
if (result)
- ERROR(error_1, "couldn't open device: %s\n",
+ FAIL(error_1, "couldn't open device: %s\n",
libusb_error_name(result));
else
- ERROR(error_1, "no suitable device found\n");
+ FAIL(error_1, "no suitable device found\n");
}
bool reattach_driver = false;
@@ -348,29 +348,29 @@ main(int argc, char *argv[])
case 1:
reattach_driver = true;
if ((result = libusb_detach_kernel_driver(device, BW_CTL_IFACE)))
- ERROR(error_2, "couldn't detach kernel driver: %s\n",
+ FAIL(error_2, "couldn't detach kernel driver: %s\n",
libusb_error_name(result));
break;
default:
- ERROR(error_2, "coudn't detect kernel driver presence: %s\n",
+ FAIL(error_2, "coudn't detect kernel driver presence: %s\n",
libusb_error_name(result));
}
if ((result = libusb_claim_interface(device, BW_CTL_IFACE)))
- ERROR(error_3, "couldn't claim interface: %s\n",
+ FAIL(error_3, "couldn't claim interface: %s\n",
libusb_error_name(result));
if ((result = apply_options(device, &options, &new_config)))
- ERROR(error_4, "operation failed: %s\n",
+ FAIL(error_4, "operation failed: %s\n",
libusb_error_name (result));
error_4:
if ((result = libusb_release_interface(device, BW_CTL_IFACE)))
- ERROR(error_3, "couldn't release interface: %s\n",
+ FAIL(error_3, "couldn't release interface: %s\n",
libusb_error_name(result));
error_3:
if (reattach_driver) {
if ((result = libusb_attach_kernel_driver(device, BW_CTL_IFACE)))
- ERROR(error_2, "couldn't reattach kernel driver: %s\n",
+ FAIL(error_2, "couldn't reattach kernel driver: %s\n",
libusb_error_name(result));
}