fclose(file);
}
+ /* If present, add serial to description for better identification. */
+ if (port->usb_serial && strlen(port->usb_serial)) {
+ snprintf(description, sizeof(description),
+ "%s - %s", port->description, port->usb_serial);
+ if (port->description)
+ free(port->description);
+ port->description = strdup(description);
+ }
+
break;
}
} else {
struct serial_struct serial_info;
int ioctl_result;
#endif
-#ifndef HAVE_READLINKAT
char buf[sizeof(entry.d_name) + 16];
-#endif
int len, fd;
DIR *dir;
int ret = SP_OK;
DEBUG("Iterating over results");
while (!readdir_r(dir, &entry, &result) && result) {
-#ifdef HAVE_READLINKAT
- len = readlinkat(dirfd(dir), entry.d_name, target, sizeof(target));
-#else
snprintf(buf, sizeof(buf), "/sys/class/tty/%s", entry.d_name);
len = readlink(buf, target, sizeof(target));
-#endif
if (len <= 0 || len >= (int) sizeof(target)-1)
continue;
target[len] = 0;