Add 3rd Gen 18i8/18i20 S/PDIF/Digital I/O Mode startup controls
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "scarlett2.h"
|
||||
#include "scarlett2-ioctls.h"
|
||||
#include "widget-boolean.h"
|
||||
#include "widget-drop-down.h"
|
||||
#include "window-startup.h"
|
||||
|
||||
#define REQUIRED_HWDEP_VERSION_MAJOR 1
|
||||
@@ -156,6 +157,60 @@ static int add_msd_control(
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int add_spdif_mode_control(
|
||||
GArray *elems,
|
||||
GtkWidget *grid,
|
||||
int *grid_y
|
||||
) {
|
||||
const char * const mode_names[] = {
|
||||
"S/PDIF Mode",
|
||||
"Digital I/O Mode",
|
||||
NULL
|
||||
};
|
||||
|
||||
struct alsa_elem *spdif = NULL;
|
||||
int i = 0;
|
||||
|
||||
while (mode_names[i]) {
|
||||
if ((spdif = get_elem_by_prefix(elems, mode_names[i])))
|
||||
break;
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
if (!spdif)
|
||||
return 0;
|
||||
|
||||
add_sep(grid, grid_y);
|
||||
|
||||
GtkWidget *w;
|
||||
|
||||
w = small_label(mode_names[i]);
|
||||
gtk_grid_attach(GTK_GRID(grid), w, 0, *grid_y, 1, 1);
|
||||
|
||||
w = make_drop_down_alsa_elem(spdif, NULL);
|
||||
gtk_widget_set_valign(w, GTK_ALIGN_START);
|
||||
gtk_grid_attach(GTK_GRID(grid), w, 0, *grid_y + 1, 1, 1);
|
||||
|
||||
w = big_label(
|
||||
i == 0 ? (
|
||||
"The S/PDIF Mode selects whether the interface can receive "
|
||||
"S/PDIF input from the coaxial (RCA) input or the optical "
|
||||
"(TOSLINK) input. This requires a reboot to take effect."
|
||||
) : (
|
||||
"The Digital I/O Mode selects whether the interface can "
|
||||
"receive S/PDIF input from the coaxial (RCA) input, the "
|
||||
"optical (TOSLINK) input, or whether dual-ADAT mode is "
|
||||
"enabled. This requires a reboot to take effect."
|
||||
)
|
||||
);
|
||||
gtk_grid_attach(GTK_GRID(grid), w, 1, *grid_y, 1, 2);
|
||||
|
||||
*grid_y += 2;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void add_reset_action(
|
||||
struct alsa_card *card,
|
||||
GtkWidget *grid,
|
||||
@@ -204,7 +259,7 @@ static void add_reset_actions(
|
||||
struct alsa_card *card,
|
||||
GtkWidget *grid,
|
||||
int *grid_y,
|
||||
int has_msd
|
||||
int show_reboot_option
|
||||
) {
|
||||
// simulated cards don't support hwdep
|
||||
if (!card->device)
|
||||
@@ -238,16 +293,17 @@ static void add_reset_actions(
|
||||
|
||||
scarlett2_close(hwdep);
|
||||
|
||||
// Add reboot action if there is an MSD control
|
||||
if (has_msd) {
|
||||
// Add reboot action if there is a control that requires a reboot
|
||||
// to take effect
|
||||
if (show_reboot_option) {
|
||||
add_reset_action(
|
||||
card,
|
||||
grid,
|
||||
grid_y,
|
||||
"Reboot Device",
|
||||
"Reboot",
|
||||
"After enabling or disabling MSD mode, the interface must be "
|
||||
"rebooted for the change to take effect.",
|
||||
"Rebooting the interface will apply changes made to the "
|
||||
"startup configuration. This will take a few seconds.",
|
||||
G_CALLBACK(reboot_device)
|
||||
);
|
||||
}
|
||||
@@ -323,7 +379,9 @@ GtkWidget *create_startup_controls(struct alsa_card *card) {
|
||||
add_standalone_control(elems, grid, &grid_y);
|
||||
add_phantom_persistence_control(elems, grid, &grid_y);
|
||||
int has_msd = add_msd_control(elems, grid, &grid_y);
|
||||
add_reset_actions(card, grid, &grid_y, has_msd);
|
||||
int has_spdif_mode = add_spdif_mode_control(elems, grid, &grid_y);
|
||||
int show_reboot_option = has_msd || has_spdif_mode;
|
||||
add_reset_actions(card, grid, &grid_y, show_reboot_option);
|
||||
|
||||
if (!grid_y)
|
||||
add_no_startup_controls_msg(grid);
|
||||
|
||||
Reference in New Issue
Block a user