From afe6a93eb75f8f98ae3e46cc4f5d818102690312 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Wed, 3 Apr 2024 14:10:02 +0200 Subject: [PATCH] better err msg --- src/main.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main.c b/src/main.c index 6847971..0eeed27 100644 --- a/src/main.c +++ b/src/main.c @@ -6,25 +6,28 @@ int main(void) { char device_path[2048]; + int min_len = 10; // Try wired find_device_path(USB_DEVICE_ID_RAZER_VIPER_ULTIMATE_WIRED, device_path); - if (strlen(device_path) < 10) { + if (strlen(device_path) < min_len) { // Try wireless find_device_path(USB_DEVICE_ID_RAZER_VIPER_ULTIMATE_WIRELESS, device_path); - if (strlen(device_path) < 10) { - fprintf_s(stderr, "Can't find any compatible device.\n"); + if (strlen(device_path) < min_len) { + fprintf_s(stderr, "Can't find the Razer Viper Ultimate mouse.\n"); + return 1; } } - printf("Device: %s\n", device_path); + printf("Mouse found: %s\n", device_path); bool is_charging; int battery_level; if ((battery_level = get_battery_level(device_path, &is_charging)) < 0) { fprintf_s(stderr, "Failed to get battery level.\n"); + return 1; }