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 <pthread.h>
00040 #include "local.h"
00041 #include "use-case.h"
00042
00043 #define MAX_FILE 256
00044 #define ALSA_USE_CASE_DIR ALSA_CONFIG_DIR "/ucm"
00045
00046 #define SEQUENCE_ELEMENT_TYPE_CDEV 1
00047 #define SEQUENCE_ELEMENT_TYPE_CSET 2
00048 #define SEQUENCE_ELEMENT_TYPE_SLEEP 3
00049 #define SEQUENCE_ELEMENT_TYPE_EXEC 4
00050
00051 struct ucm_value {
00052 struct list_head list;
00053 char *name;
00054 char *data;
00055 };
00056
00057 struct sequence_element {
00058 struct list_head list;
00059 unsigned int type;
00060 union {
00061 long sleep;
00062 char *cdev;
00063 char *cset;
00064 char *exec;
00065 } data;
00066 };
00067
00068
00069
00070
00071 struct transition_sequence {
00072 struct list_head list;
00073 char *name;
00074 struct list_head transition_list;
00075 };
00076
00077
00078
00079
00080 enum dev_list_type {
00081 DEVLIST_NONE,
00082 DEVLIST_SUPPORTED,
00083 DEVLIST_CONFLICTING
00084 };
00085
00086 struct dev_list_node {
00087 struct list_head list;
00088 char *name;
00089 };
00090
00091 struct dev_list {
00092 enum dev_list_type type;
00093 struct list_head list;
00094 };
00095
00096
00097
00098
00099
00100 struct use_case_modifier {
00101 struct list_head list;
00102 struct list_head active_list;
00103
00104 char *name;
00105 char *comment;
00106
00107
00108 struct list_head enable_list;
00109 struct list_head disable_list;
00110
00111
00112 struct list_head transition_list;
00113
00114
00115 struct dev_list dev_list;
00116
00117
00118 struct list_head value_list;
00119 };
00120
00121
00122
00123
00124
00125 struct use_case_device {
00126 struct list_head list;
00127 struct list_head active_list;
00128
00129 char *name;
00130 char *comment;
00131
00132
00133 struct list_head enable_list;
00134 struct list_head disable_list;
00135
00136
00137 struct list_head transition_list;
00138
00139
00140 struct dev_list dev_list;
00141
00142
00143 struct list_head value_list;
00144 };
00145
00146
00147
00148
00149
00150 struct use_case_verb {
00151 struct list_head list;
00152
00153 unsigned int active: 1;
00154
00155 char *name;
00156 char *comment;
00157
00158
00159 struct list_head enable_list;
00160 struct list_head disable_list;
00161
00162
00163 struct list_head transition_list;
00164
00165
00166 struct list_head device_list;
00167
00168
00169 struct list_head modifier_list;
00170
00171
00172 struct list_head value_list;
00173 };
00174
00175
00176
00177
00178 struct snd_use_case_mgr {
00179 char *card_name;
00180 char *comment;
00181
00182
00183 struct list_head verb_list;
00184
00185
00186 struct list_head default_list;
00187
00188
00189 struct list_head value_list;
00190
00191
00192 struct use_case_verb *active_verb;
00193 struct list_head active_devices;
00194 struct list_head active_modifiers;
00195
00196
00197 pthread_mutex_t mutex;
00198
00199
00200 snd_ctl_t *ctl;
00201 char *ctl_dev;
00202 };
00203
00204 #define uc_error SNDERR
00205
00206 #ifdef UC_MGR_DEBUG
00207 #define uc_dbg SNDERR
00208 #else
00209 #define uc_dbg(fmt, arg...) do { } while (0)
00210 #endif
00211
00212 void uc_mgr_error(const char *fmt, ...);
00213 void uc_mgr_stdout(const char *fmt, ...);
00214
00215 int uc_mgr_config_load(const char *file, snd_config_t **cfg);
00216 int uc_mgr_import_master_config(snd_use_case_mgr_t *uc_mgr);
00217 int uc_mgr_scan_master_configs(const char **_list[]);
00218
00219 void uc_mgr_free_sequence_element(struct sequence_element *seq);
00220 void uc_mgr_free_transition_element(struct transition_sequence *seq);
00221 void uc_mgr_free_verb(snd_use_case_mgr_t *uc_mgr);
00222 void uc_mgr_free(snd_use_case_mgr_t *uc_mgr);