better err msg
This commit is contained in:
parent
074c8ceb1d
commit
afe6a93eb7
1 changed files with 7 additions and 4 deletions
11
src/main.c
11
src/main.c
|
@ -6,25 +6,28 @@
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
char device_path[2048];
|
char device_path[2048];
|
||||||
|
int min_len = 10;
|
||||||
|
|
||||||
// Try wired
|
// Try wired
|
||||||
find_device_path(USB_DEVICE_ID_RAZER_VIPER_ULTIMATE_WIRED, device_path);
|
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
|
// Try wireless
|
||||||
find_device_path(USB_DEVICE_ID_RAZER_VIPER_ULTIMATE_WIRELESS, device_path);
|
find_device_path(USB_DEVICE_ID_RAZER_VIPER_ULTIMATE_WIRELESS, device_path);
|
||||||
|
|
||||||
if (strlen(device_path) < 10) {
|
if (strlen(device_path) < min_len) {
|
||||||
fprintf_s(stderr, "Can't find any compatible device.\n");
|
fprintf_s(stderr, "Can't find the Razer Viper Ultimate mouse.\n");
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("Device: %s\n", device_path);
|
printf("Mouse found: %s\n", device_path);
|
||||||
|
|
||||||
bool is_charging;
|
bool is_charging;
|
||||||
int battery_level;
|
int battery_level;
|
||||||
if ((battery_level = get_battery_level(device_path, &is_charging)) < 0) {
|
if ((battery_level = get_battery_level(device_path, &is_charging)) < 0) {
|
||||||
fprintf_s(stderr, "Failed to get battery level.\n");
|
fprintf_s(stderr, "Failed to get battery level.\n");
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue