In prepration to allow uqmid to use it as well.
Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
-SET(SOURCES qmi-message.c mbim.c)
+SET(SOURCES qmi-message.c mbim.c utils.c)
SET(UQMI uqmi.c dev.c commands.c ${SOURCES})
FIND_PATH(ubox_include_dir libubox/usock.h)
#include <libubox/blobmsg_json.h>
#include "uqmi.h"
+#include "utils.h"
#include "commands.h"
struct blob_buf status;
return -1;
}
-
-const char *qmi_get_error_str(int code)
-{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(qmi_errors); i++) {
- if (qmi_errors[i].code == code)
- return qmi_errors[i].text;
- }
-
- return "Unknown error";
-}
int qmi_service_get_client_id(struct qmi_dev *qmi, QmiService svc);
int qmi_service_release_client_id(struct qmi_dev *qmi, QmiService svc);
QmiService qmi_service_get_by_name(const char *str);
-const char *qmi_get_error_str(int code);
#endif
--- /dev/null
+/*
+ * uqmi -- tiny QMI support implementation
+ *
+ * Copyright (C) 2014-2015 Felix Fietkau <nbd@openwrt.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ */
+
+#include "utils.h"
+#include "qmi-errors.h"
+#include <qmi-errors.c>
+
+#include <libubox/utils.h>
+
+const char *qmi_get_error_str(int code)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(qmi_errors); i++) {
+ if (qmi_errors[i].code == code)
+ return qmi_errors[i].text;
+ }
+
+ return "Unknown error";
+}
--- /dev/null
+/*
+ * uqmi -- tiny QMI support implementation
+ *
+ * Copyright (C) 2014-2015 Felix Fietkau <nbd@openwrt.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ */
+
+
+#ifndef __UTILS_H
+#define __UTILS_H
+
+const char *qmi_get_error_str(int code);
+
+#endif /* __UTILS_H */