From a5676eeb5af91efd433c67cc59bc4d05051b133a Mon Sep 17 00:00:00 2001 From: "Geoffrey D. Bennett" Date: Sat, 8 Mar 2025 04:57:40 +1030 Subject: [PATCH] Replace hwdep check in window-startup.c with driver_type check Since alsa.c already checks the hwdep version to determine the driver type, window-startup.c doesn't need to do the same. --- src/window-startup.c | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/src/window-startup.c b/src/window-startup.c index 38940c7..acf063e 100644 --- a/src/window-startup.c +++ b/src/window-startup.c @@ -10,8 +10,6 @@ #include "widget-drop-down.h" #include "window-startup.h" -#define REQUIRED_HWDEP_VERSION_MAJOR 1 - static GtkWidget *small_label(const char *text) { GtkWidget *w = gtk_label_new(NULL); @@ -261,38 +259,9 @@ static void add_reset_actions( int *grid_y, int show_reboot_option ) { - // simulated cards don't support hwdep - if (!card->device) + if (card->driver_type != DRIVER_TYPE_HWDEP) return; - snd_hwdep_t *hwdep; - - int err = scarlett2_open_card(card->device, &hwdep); - if (err < 0) { - fprintf(stderr, "unable to open hwdep interface: %s\n", snd_strerror(err)); - return; - } - - int ver = scarlett2_get_protocol_version(hwdep); - if (ver < 0) { - fprintf(stderr, "unable to get protocol version: %s\n", snd_strerror(ver)); - return; - } - - if (SCARLETT2_HWDEP_VERSION_MAJOR(ver) != REQUIRED_HWDEP_VERSION_MAJOR) { - fprintf( - stderr, - "Unsupported hwdep protocol version %d.%d.%d on card %s\n", - SCARLETT2_HWDEP_VERSION_MAJOR(ver), - SCARLETT2_HWDEP_VERSION_MINOR(ver), - SCARLETT2_HWDEP_VERSION_SUBMINOR(ver), - card->device - ); - return; - } - - scarlett2_close(hwdep); - // Add reboot action if there is a control that requires a reboot // to take effect if (show_reboot_option) {