summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Chan <benchan@chromium.org>2018-01-10 12:46:59 -0800
committerAleksander Morgado <aleksander@aleksander.es>2018-01-10 21:54:15 +0100
commitd2ae618dd598fb05d42c914ef74ba09c6b80b032 (patch)
tree92f3d67dea8e33f995baa47f81d03c17deeebe5c
parentbf3a6ab8e01ecf9ee7494aade4bcbd59c1e71c3f (diff)
downloadlibmbim-d2ae618dd598fb05d42c914ef74ba09c6b80b032.tar.gz
intel-firmware-update: add support for Intel Firmware Update service
-rw-r--r--data/Makefile.am3
-rw-r--r--data/mbim-service-intel-firmware-update.json11
-rw-r--r--docs/reference/libmbim-glib/Makefile.am3
-rw-r--r--docs/reference/libmbim-glib/libmbim-glib-common.sections2
-rw-r--r--src/libmbim-glib/generated/Makefile.am18
-rw-r--r--src/libmbim-glib/libmbim-glib.h1
-rw-r--r--src/libmbim-glib/mbim-cid.c12
-rw-r--r--src/libmbim-glib/mbim-cid.h12
-rw-r--r--src/libmbim-glib/mbim-uuid.c13
-rw-r--r--src/libmbim-glib/mbim-uuid.h11
-rw-r--r--src/libmbim-glib/test/test-uuid.c8
11 files changed, 89 insertions, 5 deletions
diff --git a/data/Makefile.am b/data/Makefile.am
index e70ec6e..357275e 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -12,4 +12,5 @@ EXTRA_DIST = \
mbim-service-ms-host-shutdown.json \
mbim-service-proxy-control.json \
mbim-service-qmi.json \
- mbim-service-atds.json
+ mbim-service-atds.json \
+ mbim-service-intel-firmware-update.json
diff --git a/data/mbim-service-intel-firmware-update.json b/data/mbim-service-intel-firmware-update.json
new file mode 100644
index 0000000..cd55164
--- /dev/null
+++ b/data/mbim-service-intel-firmware-update.json
@@ -0,0 +1,11 @@
+[
+ // *********************************************************************************
+ { "type" : "Service",
+ "name" : "Intel Firmware Update" },
+
+ // *********************************************************************************
+ { "name" : "Modem Reboot",
+ "service" : "Intel Firmware Update",
+ "type" : "Command",
+ "set" : [] }
+]
diff --git a/docs/reference/libmbim-glib/Makefile.am b/docs/reference/libmbim-glib/Makefile.am
index 94d7c7b..d569d13 100644
--- a/docs/reference/libmbim-glib/Makefile.am
+++ b/docs/reference/libmbim-glib/Makefile.am
@@ -18,7 +18,8 @@ ALL_SECTIONS = \
$(top_builddir)/src/libmbim-glib/generated/mbim-ms-firmware-id.sections \
$(top_builddir)/src/libmbim-glib/generated/mbim-ms-host-shutdown.sections \
$(top_builddir)/src/libmbim-glib/generated/mbim-qmi.sections \
- $(top_builddir)/src/libmbim-glib/generated/mbim-atds.sections
+ $(top_builddir)/src/libmbim-glib/generated/mbim-atds.sections \
+ $(top_builddir)/src/libmbim-glib/generated/mbim-intel-firmware-update.sections
$(DOC_MODULE)-sections.mstamp: $(ALL_SECTIONS)
$(AM_V_GEN) \
diff --git a/docs/reference/libmbim-glib/libmbim-glib-common.sections b/docs/reference/libmbim-glib/libmbim-glib-common.sections
index 6367ab9..6aad149 100644
--- a/docs/reference/libmbim-glib/libmbim-glib-common.sections
+++ b/docs/reference/libmbim-glib/libmbim-glib-common.sections
@@ -25,6 +25,7 @@ MBIM_UUID_MS_FIRMWARE_ID
MBIM_UUID_MS_HOST_SHUTDOWN
MBIM_UUID_PROXY_CONTROL
MBIM_UUID_QMI
+MBIM_UUID_INTEL_FIRMWARE_UPDATE
<SUBSECTION Methods>
mbim_service_get_string
mbim_service_lookup_name
@@ -102,6 +103,7 @@ MBIM_TYPE_CID_MS_FIRMWARE_ID
MBIM_TYPE_CID_MS_HOST_SHUTDOWN
MBIM_TYPE_CID_PROXY_CONTROL
MBIM_TYPE_CID_QMI
+MBIM_TYPE_CID_INTEL_FIRMWARE_UPDATE
mbim_cid_atds_get_type
mbim_cid_auth_get_type
mbim_cid_basic_connect_get_type
diff --git a/src/libmbim-glib/generated/Makefile.am b/src/libmbim-glib/generated/Makefile.am
index b0722a0..ce69402 100644
--- a/src/libmbim-glib/generated/Makefile.am
+++ b/src/libmbim-glib/generated/Makefile.am
@@ -14,7 +14,8 @@ GENERATED_H = \
mbim-ms-host-shutdown.h \
mbim-proxy-control.h \
mbim-qmi.h \
- mbim-atds.h
+ mbim-atds.h \
+ mbim-intel-firmware-update.h
GENERATED_C = \
mbim-error-types.c \
@@ -31,7 +32,8 @@ GENERATED_C = \
mbim-ms-host-shutdown.c \
mbim-proxy-control.c \
mbim-qmi.c \
- mbim-atds.c
+ mbim-atds.c \
+ mbim-intel-firmware-update.c
GENERATED_SECTIONS = \
mbim-basic-connect.sections \
@@ -45,7 +47,8 @@ GENERATED_SECTIONS = \
mbim-ms-host-shutdown.sections \
mbim-proxy-control.sections \
mbim-qmi.sections \
- mbim-atds.sections
+ mbim-atds.sections \
+ mbim-intel-firmware-update.sections
# Error types
mbim-error-types.h: $(top_srcdir)/src/libmbim-glib/mbim-errors.h $(top_srcdir)/build-aux/templates/mbim-error-types-template.h
@@ -194,6 +197,15 @@ mbim-atds.h mbim-atds.c mbim-atds.sections: $(top_srcdir)/data/mbim-service-atds
--input $(top_srcdir)/data/mbim-service-atds.json \
--output mbim-atds
+# Intel Firmware Update Service
+mbim-intel-firmware-update.h mbim-intel-firmware-update.c mbim-intel-firmware-update.sections: $(top_srcdir)/data/mbim-service-intel-firmware-update.json $(top_srcdir)/build-aux/mbim-codegen/*.py $(top_srcdir)/build-aux/mbim-codegen/mbim-codegen
+ $(AM_V_GEN) \
+ rm -f mbim-intel-firmware-update.h && \
+ rm -f mbim-intel-firmware-update.c && \
+ $(top_srcdir)/build-aux/mbim-codegen/mbim-codegen \
+ --input $(top_srcdir)/data/mbim-service-intel-firmware-update.json \
+ --output mbim-intel-firmware-update
+
BUILT_SOURCES = $(GENERATED_H) $(GENERATED_C)
nodist_libmbim_glib_generated_la_SOURCES = \
diff --git a/src/libmbim-glib/libmbim-glib.h b/src/libmbim-glib/libmbim-glib.h
index 1b82de5..a7bf92c 100644
--- a/src/libmbim-glib/libmbim-glib.h
+++ b/src/libmbim-glib/libmbim-glib.h
@@ -50,6 +50,7 @@
#include "mbim-ms-host-shutdown.h"
#include "mbim-qmi.h"
#include "mbim-atds.h"
+#include "mbim-intel-firmware-update.h"
/* backwards compatibility */
#include "mbim-compat.h"
diff --git a/src/libmbim-glib/mbim-cid.c b/src/libmbim-glib/mbim-cid.c
index 4f3cc7c..7f46466 100644
--- a/src/libmbim-glib/mbim-cid.c
+++ b/src/libmbim-glib/mbim-cid.c
@@ -157,6 +157,12 @@ static const CidConfig cid_atds_config [MBIM_CID_ATDS_LAST] = {
{ NO_SET, QUERY, NO_NOTIFY }, /* MBIM_CID_ATDS_REGISTER_STATE */
};
+/* Note: index of the array is CID-1 */
+#define MBIM_CID_INTEL_FIRMWARE_UPDATE_LAST MBIM_CID_INTEL_FIRMWARE_UPDATE_MODEM_REBOOT
+static const CidConfig cid_intel_firmware_update_config [MBIM_CID_INTEL_FIRMWARE_UPDATE_LAST] = {
+ { SET, NO_QUERY, NO_NOTIFY }, /* MBIM_CID_INTEL_FIRMWARE_UPDATE_MODEM_REBOOT */
+};
+
/**
* mbim_cid_can_set:
* @service: a #MbimService.
@@ -201,6 +207,8 @@ mbim_cid_can_set (MbimService service,
return cid_qmi_config[cid - 1].set;
case MBIM_SERVICE_ATDS:
return cid_atds_config[cid - 1].set;
+ case MBIM_SERVICE_INTEL_FIRMWARE_UPDATE:
+ return cid_intel_firmware_update_config[cid - 1].set;
default:
g_assert_not_reached ();
return FALSE;
@@ -251,6 +259,8 @@ mbim_cid_can_query (MbimService service,
return cid_qmi_config[cid - 1].query;
case MBIM_SERVICE_ATDS:
return cid_atds_config[cid - 1].query;
+ case MBIM_SERVICE_INTEL_FIRMWARE_UPDATE:
+ return cid_intel_firmware_update_config[cid - 1].query;
default:
g_assert_not_reached ();
return FALSE;
@@ -301,6 +311,8 @@ mbim_cid_can_notify (MbimService service,
return cid_qmi_config[cid - 1].notify;
case MBIM_SERVICE_ATDS:
return cid_atds_config[cid - 1].notify;
+ case MBIM_SERVICE_INTEL_FIRMWARE_UPDATE:
+ return cid_intel_firmware_update_config[cid - 1].notify;
default:
g_assert_not_reached ();
return FALSE;
diff --git a/src/libmbim-glib/mbim-cid.h b/src/libmbim-glib/mbim-cid.h
index d85d201..4be0dbf 100644
--- a/src/libmbim-glib/mbim-cid.h
+++ b/src/libmbim-glib/mbim-cid.h
@@ -251,6 +251,18 @@ typedef enum {
MBIM_CID_ATDS_REGISTER_STATE = 9,
} MbimCidAtds;
+/**
+ * MbimCidIntelFirmwareUpdate:
+ * @MBIM_CID_INTEL_FIRMWARE_UPDATE_UNKNOWN: Unknown command.
+ * @MBIM_CID_INTEL_FIRMWARE_UPDATE_MODEM_REBOOT: Reboot modem for firmware update.
+ *
+ * MBIM commands in the %MBIM_SERVICE_INTEL_FIRMWARE_UPDATE service.
+ */
+typedef enum {
+ MBIM_CID_INTEL_FIRMWARE_UPDATE_UNKNOWN = 0,
+ MBIM_CID_INTEL_FIRMWARE_UPDATE_MODEM_REBOOT = 1,
+} MbimCidIntelFirmwareUpdate;
+
/* Command helpers */
gboolean mbim_cid_can_set (MbimService service,
diff --git a/src/libmbim-glib/mbim-uuid.c b/src/libmbim-glib/mbim-uuid.c
index 4cb9a20..d77be39 100644
--- a/src/libmbim-glib/mbim-uuid.c
+++ b/src/libmbim-glib/mbim-uuid.c
@@ -244,6 +244,14 @@ static const MbimUuid uuid_atds = {
.e = { 0xb2, 0xe7, 0x0e, 0x52, 0x7d, 0xb3 }
};
+static const MbimUuid uuid_intel_firmware_update = {
+ .a = { 0x0e, 0xd3, 0x74, 0xcb },
+ .b = { 0xf8, 0x35 },
+ .c = { 0x44, 0x74 },
+ .d = { 0xbc, 0x11 },
+ .e = { 0x3b, 0x3f, 0xd7, 0x6f, 0x56, 0x41 }
+};
+
static GList *mbim_custom_service_list = NULL;
typedef struct {
@@ -413,6 +421,8 @@ mbim_uuid_from_service (MbimService service)
return &uuid_qmi;
case MBIM_SERVICE_ATDS:
return &uuid_atds;
+ case MBIM_SERVICE_INTEL_FIRMWARE_UPDATE:
+ return &uuid_intel_firmware_update;
default:
for (l = mbim_custom_service_list; l != NULL; l = l->next) {
if (service == ((MbimCustomService *)l->data)->service_id)
@@ -471,6 +481,9 @@ mbim_uuid_to_service (const MbimUuid *uuid)
if (mbim_uuid_cmp (uuid, &uuid_atds))
return MBIM_SERVICE_ATDS;
+ if (mbim_uuid_cmp (uuid, &uuid_intel_firmware_update))
+ return MBIM_SERVICE_INTEL_FIRMWARE_UPDATE;
+
for (l = mbim_custom_service_list; l != NULL; l = l->next) {
if (mbim_uuid_cmp (&((MbimCustomService *)l->data)->uuid, uuid))
return ((MbimCustomService *)l->data)->service_id;
diff --git a/src/libmbim-glib/mbim-uuid.h b/src/libmbim-glib/mbim-uuid.h
index 14db47e..59b6338 100644
--- a/src/libmbim-glib/mbim-uuid.h
+++ b/src/libmbim-glib/mbim-uuid.h
@@ -73,6 +73,7 @@ gboolean mbim_uuid_from_printable (const gchar *str,
* @MBIM_SERVICE_PROXY_CONTROL: Proxy Control service.
* @MBIM_SERVICE_QMI: QMI-over-MBIM service.
* @MBIM_SERVICE_ATDS: ATT Device service.
+ * @MBIM_SERVICE_INTEL_FIRMWARE_UPDATE: Intel firmware update service.
* @MBIM_SERVICE_LAST: Internal value.
*
* Enumeration of the generic MBIM services.
@@ -91,6 +92,7 @@ typedef enum {
MBIM_SERVICE_PROXY_CONTROL = 10,
MBIM_SERVICE_QMI = 11,
MBIM_SERVICE_ATDS = 12,
+ MBIM_SERVICE_INTEL_FIRMWARE_UPDATE = 13,
#if defined LIBMBIM_GLIB_COMPILATION
MBIM_SERVICE_LAST /*< skip >*/
#endif
@@ -213,6 +215,15 @@ typedef enum {
*/
#define MBIM_UUID_ATDS mbim_uuid_from_service (MBIM_SERVICE_ATDS)
+/**
+ * MBIM_UUID_INTEL_FIRMWARE_UPDATE:
+ *
+ * Get the UUID of the %MBIM_SERVICE_INTEL_FIRMWARE_UPDATE service.
+ *
+ * Returns: (transfer none): a #MbimUuid.
+ */
+#define MBIM_UUID_INTEL_FIRMWARE_UPDATE mbim_uuid_from_service (MBIM_SERVICE_INTEL_FIRMWARE_UPDATE)
+
const gchar *mbim_service_lookup_name (guint service);
guint mbim_register_custom_service (const MbimUuid *uuid,
diff --git a/src/libmbim-glib/test/test-uuid.c b/src/libmbim-glib/test/test-uuid.c
index 7b0ec28..accf45b 100644
--- a/src/libmbim-glib/test/test-uuid.c
+++ b/src/libmbim-glib/test/test-uuid.c
@@ -91,6 +91,13 @@ test_uuid_ms_host_shutdown (void)
"883b7c26-985f-43fa-9804-27d7fb80959c");
}
+static void
+test_uuid_intel_firmware_update (void)
+{
+ compare_uuid_strings (MBIM_UUID_INTEL_FIRMWARE_UPDATE,
+ "0ed374cb-f835-4474-bc11-3b3fd76f5641");
+}
+
/*****************************************************************************/
static void
@@ -200,6 +207,7 @@ int main (int argc, char **argv)
g_test_add_func ("/libmbim-glib/uuid/dss", test_uuid_dss);
g_test_add_func ("/libmbim-glib/uuid/ms-firmware-id", test_uuid_ms_firmware_id);
g_test_add_func ("/libmbim-glib/uuid/ms-host-shutdown", test_uuid_ms_host_shutdown);
+ g_test_add_func ("/libmbim-glib/uuid/intel-firmware-update", test_uuid_intel_firmware_update);
g_test_add_func ("/libmbim-glib/uuid/valid", test_uuid_valid);
g_test_add_func ("/libmbim-glib/uuid/valid/camelcase", test_uuid_valid_camelcase);