- linc_lin_state.flags = flags;
- //ret = pcl_config(&linc_lin_state);
- ret = sllin_config(&linc_lin_state);
+ /* Parse device type and path */
+ c = argv[optind]; /* "devtype:devpath" */
+ while ((*c != ':') && (*c != '\0')) {
+ c++;
+ }
+ *c = '\0'; /* In case we found ":" split the string into two */
+ linc_lin_state.dev = strdup(c + 1); /* Second half of the string -- device name */
+
+ if (!strcmp("pcanlin", argv[optind])) {
+ ret = pcl_config(&linc_lin_state);
+ } else if (!strcmp("sllin", argv[optind])) {
+ ret = sllin_config(&linc_lin_state);
+ } else {
+ fprintf(stderr, "Device type is missing. Using default device -- sllin.\n");
+ ret = sllin_config(&linc_lin_state);
+ }