+ if (!has_colon) {
+ /* "Something raw" and no colon. Add raw= prefix. */
+ copy = g_strdup_printf("%s%s", SER_HID_RAW_PREFIX, parse);
+ return copy;
+ }
+ if (g_str_has_prefix(parse, IOKIT_PATH_PREFIX)) do {
+ /*
+ * Path starts with Mac IOKit literal which contains the
+ * colon. Drop that literal from the start of the path,
+ * and check whether any colon remains which we cannot
+ * deal with. Fall though to other approaches which could
+ * be more generic, or to the error path.
+ */
+ remain = &parse[strlen(IOKIT_PATH_PREFIX)];
+ if (strchr(remain, ':'))
+ break;
+ copy = g_strdup_printf("%s%s", SER_HID_IOKIT_PREFIX, remain);
+ return copy;
+ } while (0);
+
+ /* TODO
+ * Consider adding support for more of the currently unhandled
+ * cases. When we get here, the HIDAPI path could be arbitrarily
+ * complex, none of the above "straight" approaches took effect.
+ * Proper escaping or other transformations could get applied,
+ * though they decrease usability the more they obfuscate the
+ * resulting port name. Ideally users remain able to recognize
+ * their device or cable or port after the manipulation.
+ */
+ sr_err("Unsupported HIDAPI path format: %s", path);
+ return NULL;