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.
This commit is contained in:
@@ -10,8 +10,6 @@
|
|||||||
#include "widget-drop-down.h"
|
#include "widget-drop-down.h"
|
||||||
#include "window-startup.h"
|
#include "window-startup.h"
|
||||||
|
|
||||||
#define REQUIRED_HWDEP_VERSION_MAJOR 1
|
|
||||||
|
|
||||||
static GtkWidget *small_label(const char *text) {
|
static GtkWidget *small_label(const char *text) {
|
||||||
GtkWidget *w = gtk_label_new(NULL);
|
GtkWidget *w = gtk_label_new(NULL);
|
||||||
|
|
||||||
@@ -261,38 +259,9 @@ static void add_reset_actions(
|
|||||||
int *grid_y,
|
int *grid_y,
|
||||||
int show_reboot_option
|
int show_reboot_option
|
||||||
) {
|
) {
|
||||||
// simulated cards don't support hwdep
|
if (card->driver_type != DRIVER_TYPE_HWDEP)
|
||||||
if (!card->device)
|
|
||||||
return;
|
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
|
// Add reboot action if there is a control that requires a reboot
|
||||||
// to take effect
|
// to take effect
|
||||||
if (show_reboot_option) {
|
if (show_reboot_option) {
|
||||||
|
|||||||
Reference in New Issue
Block a user