aboutsummaryrefslogtreecommitdiff
path: root/libjaylink/strutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'libjaylink/strutil.c')
-rw-r--r--libjaylink/strutil.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/libjaylink/strutil.c b/libjaylink/strutil.c
index 283ed17..4b8f3d5 100644
--- a/libjaylink/strutil.c
+++ b/libjaylink/strutil.c
@@ -64,3 +64,30 @@ JAYLINK_API int jaylink_parse_serial_number(const char *str,
return JAYLINK_OK;
}
+
+/**
+ * Get the string representation of a hardware type.
+ *
+ * @param[in] type Hardware type.
+ *
+ * @return The string representation of the given hardware type, or NULL
+ * for an unknown type.
+ *
+ * @since 0.3.0
+ */
+JAYLINK_API const char *jaylink_hardware_type_string(
+ enum jaylink_hardware_type type)
+{
+ switch (type) {
+ case JAYLINK_HW_TYPE_JLINK:
+ return "J-Link";
+ case JAYLINK_HW_TYPE_FLASHER:
+ return "Flasher";
+ case JAYLINK_HW_TYPE_JLINK_PRO:
+ return "J-Link PRO";
+ default:
+ break;
+ }
+
+ return NULL;
+}