diff --git a/modules/comedi/comedi.c b/modules/comedi/comedi.c
index c40aef5e676f47f832673a90a5958f1b57266a0c..db2d6642d0d4c83a91e31377e978483630f9abc5 100644
--- a/modules/comedi/comedi.c
+++ b/modules/comedi/comedi.c
@@ -18,15 +18,17 @@ static struct moberg_driver_config parse_config(
   printf("PARSE_CONFIG %s\n", __FILE__);
   printf("LBRACE %d", acceptsym(c, tok_LBRACE, &t));
   for (;;) {
-    if (acceptsym(c, tok_IDENT, &t) ||
-	acceptsym(c, tok_CONFIG, &t)) {
+    if (acceptsym(c, tok_RBRACE, NULL)) {
+	break;
+    } else  if (acceptsym(c, tok_IDENT, &t) ||
+		acceptsym(c, tok_CONFIG, &t)) {
       const char *v = t.u.ident.value;
       int l = t.u.ident.length;
       if (strncmp("device", v, l) == 0) {
 	printf("DEVICE\n");
       } else if (strncmp("modprobe", v, l) == 0) {
 	printf("MODPROBE\n");
-      } else if (strncmp("comedi", v, l) == 0) {
+      } else if (strncmp("config", v, l) == 0) {
 	printf("CONFIG\n");
       }
       acceptsym(c, tok_EQUAL, NULL);
@@ -36,25 +38,31 @@ static struct moberg_driver_config parse_config(
 	printf("%d\n", t.kind);
 	if (t.kind == tok_SEMICOLON) { break; }
       }
-    } else if (acceptsym(c, tok_RBRACE, NULL)) {
-	break;
     } else {
-      goto err;
+	break;
     }
   }
-  return result;
-err:
-  exit(1);
+  printf("PARSE_CONFIG DONE%s\n", __FILE__);
   return result;
 }
 
 static struct moberg_driver_map parse_map(
-  struct moberg_config_parser_context *context,
+  struct moberg_config_parser_context *c,
   enum moberg_config_parser_token_kind kind)
 {
   struct moberg_driver_map result;
 
+  token_t t;
   printf("PARSE_MAP %s\n", __FILE__);
+  if (acceptsym(c, tok_IDENT, &t)) {
+    if (strncmp("subdevice", t.u.ident.value, t.u.ident.length) != 0) {
+      goto err;
+    }
+    if (! acceptsym(c, tok_LBRACKET, NULL)) { goto err; }
+    if (! acceptsym(c, tok_INTEGER, &t)) { goto err; }
+    if (! acceptsym(c, tok_RBRACKET, NULL)) { goto err; }
+  }
+    
 /*
   const char *buf = context->buf;
   while (*buf && *buf != '}') {
@@ -63,6 +71,8 @@ static struct moberg_driver_map parse_map(
   context->buf = buf + 1;
 */
   return result;
+err:
+  exit(1);
 }
 
 struct moberg_driver_module moberg_module = {
diff --git a/parse_config.c b/parse_config.c
index 1f65d463479293c8dd3fd780b30b63caf3a10f2c..cb7194431621cc5e164de1bad17431db23f2e245 100644
--- a/parse_config.c
+++ b/parse_config.c
@@ -11,6 +11,7 @@
 #define token moberg_config_parser_token
 #define token_kind moberg_config_parser_token_kind 
 #define acceptsym moberg_config_parser_acceptsym
+#define peeksym moberg_config_parser_peeksym
 
 typedef struct moberg_config_parser_token token_t;
 typedef struct moberg_config_parser_ident ident_t;
@@ -47,20 +48,20 @@ out: ;
     c->token.kind = tok_CONFIG;
   } else if (strncmp("map", v, l) == 0) {
     c->token.kind = tok_MAP;
-  } else if (strncmp("analogin", v, l) == 0) {
+  } else if (strncmp("analog_in", v, l) == 0) {
     c->token.kind = tok_ANALOGIN;
-  } else if (strncmp("analogout", v, l) == 0) {
+  } else if (strncmp("analog_out", v, l) == 0) {
     c->token.kind = tok_ANALOGOUT;
-  } else if (strncmp("digitalin", v, l) == 0) {
+  } else if (strncmp("digital_in", v, l) == 0) {
     c->token.kind = tok_DIGITALIN;
-  } else if (strncmp("digitalout", v, l) == 0) {
+  } else if (strncmp("digital_out", v, l) == 0) {
     c->token.kind = tok_DIGITALOUT;
-  } else if (strncmp("encoderin", v, l) == 0) {
+  } else if (strncmp("encoder_in", v, l) == 0) {
     c->token.kind = tok_ENCODERIN;
   } else {
     c->token.kind = tok_IDENT;
   }
-  printf("IDENT: %.*s\n", l, v);
+  printf("IDENT: %.*s %d\n", l, v, c->token.kind);
 }
 
 static const void nextsym_integer(context_t *c)
@@ -176,12 +177,14 @@ int moberg_config_parser_acceptsym(context_t *c,
                                    token_t *token)
 {
   if (c->token.kind == kind) {
+    printf("ACCEPT %d", c->token.kind);
     if (token) {
       *token = c->token;
     }
     nextsym(c);
     return 1;
   }
+  printf("REJECT %d (%d)", kind, c->token.kind);
   return 0;
 }
 
@@ -214,6 +217,7 @@ err:
 static int parse_map(context_t *c,
                      struct moberg_driver *driver)
 {
+  printf("parsemap");
   struct token t;
   if (acceptsym(c, tok_ANALOGIN, &t) ||
       acceptsym(c, tok_ANALOGOUT, &t) ||
@@ -252,10 +256,15 @@ static int parse_device(context_t *c,
 {
   if (! acceptsym(c, tok_LBRACE, NULL)) { goto err; }
   for (;;) {
+    struct token t;
+    peeksym(c, &t);
+    printf("PEEK %d", t.kind);
     if (acceptsym(c, tok_CONFIG, NULL)) {
       driver->module.parse_config(c);
     } else if (acceptsym(c, tok_MAP, NULL)) {
       parse_map(c, driver);
+    } else if (acceptsym(c, tok_RBRACE, NULL)) {
+      break;
     } else {
       goto err;
     }
@@ -286,6 +295,8 @@ static int parse_config(context_t *c)
 {
   for (;;) {
     struct token t;
+    peeksym(c, &t);
+    printf("PEEK %d", t.kind);
     if (acceptsym(c, tok_IDENT, &t)) {
       printf("DRIVER=%.*s\n", t.u.ident.length, t.u.ident.value);
       if (! parse_driver(c, t.u.ident)) { goto err; }
diff --git a/test/a/moberg.conf b/test/a/moberg.conf
index 270ba54699276ef36f7a0fe9c04201f44bb7fbc0..4a3c7c736c7a10c03da26c44fd5282b33e7f5352 100644
--- a/test/a/moberg.conf
+++ b/test/a/moberg.conf
@@ -7,7 +7,11 @@ comedi {
     }
     /* Moberg mapping[indices] = {driver specific}[indices]
       {driver specific} is parsed by parse_map in libmoberg_comedi.so */
-    map digital_in[0:7] = {subdevice[4]}[0:7] ;
+    map analog_in[0:7] = subdevice[0][0:7] ;
+    map analog_out[0:1] = subdevice[1][0:1] ;
+    map digital_in[0] = subdevice[7][15] ;
+    map digital_in[1] = subdevice[7][2] ;
+    map digital_out[0:1] = subdevice[7][0:1] route 16 ;
 }
 serial2002 {
     config {
@@ -17,5 +21,5 @@ serial2002 {
     }
     /* Moberg mapping[indices] = {driver specific}[indices]
       {driver specific} is parsed by parse_map in libmoberg_serial2002.so */
-    map digital_in[30:37] = {digital_in}[0:7] ;
+    map digital_in[30:37] = digital_in[0:7] ;
 }