libfxlink: no-colors option + don't always enumerate devices [Windows]

Enumerating devices constantly caused some sort of error/crash that
would stop the monitor after just one frame or so.
This commit is contained in:
Lephenixnoir 2024-08-27 11:50:49 +02:00
parent efcd6ec241
commit 92a95e0090
No known key found for this signature in database
GPG key ID: 1BBA026E13FC0495
4 changed files with 10 additions and 5 deletions

View file

@ -187,6 +187,6 @@ Install the cross-compiler and cross-libraries from AUR.
Configure and build. Install to get libfxlink. Configure and build. Install to get libfxlink.
```bash ```bash
% x86_64-w64-mingw32-cmake -B build-win64 -DCMAKE_INSTALL_PREFIX="$HOME/.local" -DFXLINK_DISABLE_UDISKS2=1 -DFXLINK_DISABLE_POLL=1 % x86_64-w64-mingw32-cmake -B build-win64 -DCMAKE_INSTALL_PREFIX="$HOME/.local" -DFXLINK_DISABLE_UDISKS2=1 -DFXLINK_DISABLE_POLL=1 -DFXLINK_DISABLE_ANSIESC=1
% make -C build-win64 install % make -C build-win64 install
``` ```

View file

@ -15,6 +15,9 @@
char const *fmt_to_ANSI(int format) char const *fmt_to_ANSI(int format)
{ {
#ifdef FXLINK_DISABLE_ANSIESC
return "";
#else
static char buf[64]; static char buf[64];
int n = 0; int n = 0;
@ -36,6 +39,7 @@ char const *fmt_to_ANSI(int format)
strcpy(buf+n, "\e[3m"), n += 4; strcpy(buf+n, "\e[3m"), n += 4;
return buf; return buf;
#endif
} }
char *fxlink_gen_file_name(char const *path, char const *name, char *fxlink_gen_file_name(char const *path, char const *name,

View file

@ -227,7 +227,8 @@ void fxlink_device_analysis_1(struct fxlink_device *fdev, bool quiet)
if(!quiet) { if(!quiet) {
hlog("calculators %s", fxlink_device_id(fdev)); hlog("calculators %s", fxlink_device_id(fdev));
log_("%1$d interface%2$s, class code%2$s", calc->interface_count, log_("%d interface%s, class code%s", calc->interface_count,
calc->interface_count != 1 ? "s" : "",
calc->interface_count != 1 ? "s" : ""); calc->interface_count != 1 ? "s" : "");
for(int i = 0; i < calc->interface_count; i++) { for(int i = 0; i < calc->interface_count; i++) {
@ -842,9 +843,6 @@ bool fxlink_device_list_track(struct fxlink_device_list *list,
void fxlink_device_list_refresh(struct fxlink_device_list *list) void fxlink_device_list_refresh(struct fxlink_device_list *list)
{ {
if(!list->hotplug_supported)
enumerate_devices(list->ctx, list);
for(int i = 0; i < list->count; i++) { for(int i = 0; i < list->count; i++) {
struct fxlink_device *fdev = &list->devices[i]; struct fxlink_device *fdev = &list->devices[i];
/* Finish analysis */ /* Finish analysis */

View file

@ -16,5 +16,8 @@
/* Disable poll-based interfaces. */ /* Disable poll-based interfaces. */
#cmakedefine FXLINK_DISABLE_POLL #cmakedefine FXLINK_DISABLE_POLL
/* Disable printing ANSI escape sequences. */
#cmakedefine FXLINK_DISABLE_ANSIESC
/* fxSDK version */ /* fxSDK version */
#define FXLINK_VERSION "@CMAKE_PROJECT_VERSION@" #define FXLINK_VERSION "@CMAKE_PROJECT_VERSION@"