00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #if 0
00036 #define UC_MGR_DEBUG
00037 #endif
00038
00039 #include "local.h"
00040 #include "use-case.h"
00041
00042 #define MAX_FILE 256
00043 #define ALSA_USE_CASE_DIR ALSA_CONFIG_DIR "/ucm"
00044
00045 #define SEQUENCE_ELEMENT_TYPE_CDEV 1
00046 #define SEQUENCE_ELEMENT_TYPE_CSET 2
00047 #define SEQUENCE_ELEMENT_TYPE_SLEEP 3
00048 #define SEQUENCE_ELEMENT_TYPE_EXEC 4
00049
00050 struct ucm_value {
00051 struct list_head list;
00052 char *name;
00053 char *data;
00054 };
00055
00056 struct sequence_element {
00057 struct list_head list;
00058 unsigned int type;
00059 union {
00060 long sleep;
00061 char *cdev;
00062 char *cset;
00063 char *exec;
00064 } data;
00065 };
00066
00067
00068
00069
00070 struct transition_sequence {
00071 struct list_head list;
00072 char *name;
00073 struct list_head transition_list;
00074 };
00075
00076
00077
00078
00079 struct dev_list {
00080 struct list_head list;
00081 char *name;
00082 };
00083
00084
00085
00086
00087
00088
00089 struct use_case_modifier {
00090 struct list_head list;
00091 struct list_head active_list;
00092
00093 char *name;
00094 char *comment;
00095
00096
00097 struct list_head enable_list;
00098 struct list_head disable_list;
00099
00100
00101 struct list_head transition_list;
00102
00103
00104 struct list_head dev_list;
00105
00106
00107 struct list_head value_list;
00108 };
00109
00110
00111
00112
00113
00114 struct use_case_device {
00115 struct list_head list;
00116 struct list_head active_list;
00117
00118 char *name;
00119 char *comment;
00120
00121
00122 struct list_head enable_list;
00123 struct list_head disable_list;
00124
00125
00126 struct list_head transition_list;
00127
00128
00129 struct list_head value_list;
00130 };
00131
00132
00133
00134
00135
00136 struct use_case_verb {
00137 struct list_head list;
00138
00139 unsigned int active: 1;
00140
00141 char *name;
00142 char *comment;
00143
00144
00145 struct list_head enable_list;
00146 struct list_head disable_list;
00147
00148
00149 struct list_head transition_list;
00150
00151
00152 struct list_head device_list;
00153
00154
00155 struct list_head modifier_list;
00156
00157
00158 struct list_head value_list;
00159 };
00160
00161
00162
00163
00164 struct snd_use_case_mgr {
00165 char *card_name;
00166 char *comment;
00167
00168
00169 struct list_head verb_list;
00170
00171
00172 struct list_head default_list;
00173
00174
00175 struct list_head value_list;
00176
00177
00178 struct use_case_verb *active_verb;
00179 struct list_head active_devices;
00180 struct list_head active_modifiers;
00181
00182
00183 pthread_mutex_t mutex;
00184
00185
00186 snd_ctl_t *ctl;
00187 char *ctl_dev;
00188 };
00189
00190 #define uc_error SNDERR
00191
00192 #ifdef UC_MGR_DEBUG
00193 #define uc_dbg SNDERR
00194 #else
00195 #define uc_dbg(fmt, arg...)
00196 #endif
00197
00198 void uc_mgr_error(const char *fmt, ...);
00199 void uc_mgr_stdout(const char *fmt, ...);
00200
00201 int uc_mgr_config_load(const char *file, snd_config_t **cfg);
00202 int uc_mgr_import_master_config(snd_use_case_mgr_t *uc_mgr);
00203 int uc_mgr_scan_master_configs(const char **_list[]);
00204
00205 void uc_mgr_free_sequence_element(struct sequence_element *seq);
00206 void uc_mgr_free_transition_element(struct transition_sequence *seq);
00207 void uc_mgr_free_verb(snd_use_case_mgr_t *uc_mgr);
00208 void uc_mgr_free(snd_use_case_mgr_t *uc_mgr);