@@ -6108,19 +6108,33 @@ static gint channel_compare(gconstpointer a, gconstpointer b)
6108
6108
6109
6109
static GSList * math_expression_get_iio_channel_list (const char * expression , struct iio_context * ctx , const char * device , bool * has_invalid_ch )
6110
6110
{
6111
+
6111
6112
GSList * chn_list = NULL ;
6112
- GRegex * regex ;
6113
+ GRegex * regex , * regex_i , * regex_q ;
6113
6114
GMatchInfo * info ;
6114
6115
gchar * chn_name ;
6115
6116
struct iio_device * iio_dev ;
6116
6117
struct iio_channel * iio_chn ;
6117
- gboolean invalid_list = false, is_match ;
6118
+ gboolean invalid_list = false, is_match = true, match_q , match_i , match ;
6118
6119
6119
6120
if (!device || !(iio_dev = iio_context_find_device (ctx , device )))
6120
6121
return NULL ;
6121
6122
6122
6123
regex = g_regex_new ("voltage[0-9]+" , 0 , 0 , NULL );
6123
- is_match = g_regex_match (regex , expression , 0 , & info );
6124
+ regex_i = g_regex_new ("voltage[0-9]+_i" , 0 , 0 , NULL );
6125
+ regex_q = g_regex_new ("voltage[0-9]+_q" , 0 , 0 , NULL );
6126
+
6127
+ match_i = g_regex_match (regex_i , expression , 0 , & info );
6128
+
6129
+ if (!match_i ) {
6130
+ match_q = g_regex_match (regex_q , expression , 0 , & info );
6131
+ if (!match_q ) {
6132
+ match = g_regex_match (regex , expression , 0 , & info );
6133
+ if (!match )
6134
+ is_match = false;
6135
+ }
6136
+ }
6137
+
6124
6138
if (!is_match ) {
6125
6139
invalid_list = true;
6126
6140
} else {
@@ -6138,6 +6152,8 @@ static GSList * math_expression_get_iio_channel_list(const char *expression, str
6138
6152
}
6139
6153
g_match_info_free (info );
6140
6154
g_regex_unref (regex );
6155
+ g_regex_unref (regex_i );
6156
+ g_regex_unref (regex_q );
6141
6157
6142
6158
if (invalid_list ) {
6143
6159
if (chn_list )
0 commit comments