summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2016-03-03 13:26:44 -0600
committerDan Williams <dcbw@redhat.com>2016-03-03 13:26:44 -0600
commit3465107153e373adfd4e50ac90259ed25d556bed (patch)
tree2bb7755187f3136555d401d16ded37dc415736ab
parentfea234dd1ea6f8d558b32d93e127a5bd73e5ae04 (diff)
downloadlibqmi-3465107153e373adfd4e50ac90259ed25d556bed.tar.gz
trivial: whitespace fixes
-rw-r--r--src/libqmi-glib/qmi-utils.c52
-rw-r--r--src/libqmi-glib/test/test-port-context.c52
-rw-r--r--src/qmi-proxy/qmi-proxy.c2
-rw-r--r--src/qmicli/qmicli-dms.c16
-rw-r--r--src/qmicli/qmicli-helpers.c42
-rw-r--r--src/qmicli/qmicli-nas.c16
-rw-r--r--src/qmicli/qmicli-pbm.c16
-rw-r--r--src/qmicli/qmicli-uim.c16
-rw-r--r--src/qmicli/qmicli-voice.c16
-rw-r--r--src/qmicli/qmicli-wda.c16
-rw-r--r--src/qmicli/qmicli-wds.c16
-rw-r--r--src/qmicli/qmicli.c34
-rw-r--r--utils/qmitest.c576
13 files changed, 435 insertions, 435 deletions
diff --git a/src/libqmi-glib/qmi-utils.c b/src/libqmi-glib/qmi-utils.c
index d0df93b9..a4028cb6 100644
--- a/src/libqmi-glib/qmi-utils.c
+++ b/src/libqmi-glib/qmi-utils.c
@@ -47,32 +47,32 @@ __qmi_utils_str_hex (gconstpointer mem,
gchar delimiter)
{
const guint8 *data = mem;
- gsize i;
- gsize j;
- gsize new_str_length;
- gchar *new_str;
-
- /* Get new string length. If input string has N bytes, we need:
- * - 1 byte for last NUL char
- * - 2N bytes for hexadecimal char representation of each byte...
- * - N-1 bytes for the separator ':'
- * So... a total of (1+2N+N-1) = 3N bytes are needed... */
- new_str_length = 3 * size;
-
- /* Allocate memory for new array and initialize contents to NUL */
- new_str = g_malloc0 (new_str_length);
-
- /* Print hexadecimal representation of each byte... */
- for (i = 0, j = 0; i < size; i++, j += 3) {
- /* Print character in output string... */
- snprintf (&new_str[j], 3, "%02X", data[i]);
- /* And if needed, add separator */
- if (i != (size - 1) )
- new_str[j + 2] = delimiter;
- }
-
- /* Set output string */
- return new_str;
+ gsize i;
+ gsize j;
+ gsize new_str_length;
+ gchar *new_str;
+
+ /* Get new string length. If input string has N bytes, we need:
+ * - 1 byte for last NUL char
+ * - 2N bytes for hexadecimal char representation of each byte...
+ * - N-1 bytes for the separator ':'
+ * So... a total of (1+2N+N-1) = 3N bytes are needed... */
+ new_str_length = 3 * size;
+
+ /* Allocate memory for new array and initialize contents to NUL */
+ new_str = g_malloc0 (new_str_length);
+
+ /* Print hexadecimal representation of each byte... */
+ for (i = 0, j = 0; i < size; i++, j += 3) {
+ /* Print character in output string... */
+ snprintf (&new_str[j], 3, "%02X", data[i]);
+ /* And if needed, add separator */
+ if (i != (size - 1) )
+ new_str[j + 2] = delimiter;
+ }
+
+ /* Set output string */
+ return new_str;
}
/*****************************************************************************/
diff --git a/src/libqmi-glib/test/test-port-context.c b/src/libqmi-glib/test/test-port-context.c
index e3ed94eb..72407c2f 100644
--- a/src/libqmi-glib/test/test-port-context.c
+++ b/src/libqmi-glib/test/test-port-context.c
@@ -51,32 +51,32 @@ str_hex (gconstpointer mem,
gchar delimiter)
{
const guint8 *data = mem;
- gsize i;
- gsize j;
- gsize new_str_length;
- gchar *new_str;
-
- /* Get new string length. If input string has N bytes, we need:
- * - 1 byte for last NUL char
- * - 2N bytes for hexadecimal char representation of each byte...
- * - N-1 bytes for the separator ':'
- * So... a total of (1+2N+N-1) = 3N bytes are needed... */
- new_str_length = 3 * size;
-
- /* Allocate memory for new array and initialize contents to NUL */
- new_str = g_malloc0 (new_str_length);
-
- /* Print hexadecimal representation of each byte... */
- for (i = 0, j = 0; i < size; i++, j += 3) {
- /* Print character in output string... */
- snprintf (&new_str[j], 3, "%02X", data[i]);
- /* And if needed, add separator */
- if (i != (size - 1) )
- new_str[j + 2] = delimiter;
- }
-
- /* Set output string */
- return new_str;
+ gsize i;
+ gsize j;
+ gsize new_str_length;
+ gchar *new_str;
+
+ /* Get new string length. If input string has N bytes, we need:
+ * - 1 byte for last NUL char
+ * - 2N bytes for hexadecimal char representation of each byte...
+ * - N-1 bytes for the separator ':'
+ * So... a total of (1+2N+N-1) = 3N bytes are needed... */
+ new_str_length = 3 * size;
+
+ /* Allocate memory for new array and initialize contents to NUL */
+ new_str = g_malloc0 (new_str_length);
+
+ /* Print hexadecimal representation of each byte... */
+ for (i = 0, j = 0; i < size; i++, j += 3) {
+ /* Print character in output string... */
+ snprintf (&new_str[j], 3, "%02X", data[i]);
+ /* And if needed, add separator */
+ if (i != (size - 1) )
+ new_str[j + 2] = delimiter;
+ }
+
+ /* Set output string */
+ return new_str;
}
/*****************************************************************************/
diff --git a/src/qmi-proxy/qmi-proxy.c b/src/qmi-proxy/qmi-proxy.c
index b7053b2b..fe51075f 100644
--- a/src/qmi-proxy/qmi-proxy.c
+++ b/src/qmi-proxy/qmi-proxy.c
@@ -184,7 +184,7 @@ int main (int argc, char **argv)
error->message);
exit (EXIT_FAILURE);
}
- g_option_context_free (context);
+ g_option_context_free (context);
if (version_flag)
print_version_and_exit ();
diff --git a/src/qmicli/qmicli-dms.c b/src/qmicli/qmicli-dms.c
index 5d080eb2..7f1593f3 100644
--- a/src/qmicli/qmicli-dms.c
+++ b/src/qmicli/qmicli-dms.c
@@ -265,16 +265,16 @@ static GOptionEntry entries[] = {
GOptionGroup *
qmicli_dms_get_option_group (void)
{
- GOptionGroup *group;
+ GOptionGroup *group;
- group = g_option_group_new ("dms",
- "DMS options",
- "Show Device Management Service options",
- NULL,
- NULL);
- g_option_group_add_entries (group, entries);
+ group = g_option_group_new ("dms",
+ "DMS options",
+ "Show Device Management Service options",
+ NULL,
+ NULL);
+ g_option_group_add_entries (group, entries);
- return group;
+ return group;
}
gboolean
diff --git a/src/qmicli/qmicli-helpers.c b/src/qmicli/qmicli-helpers.c
index 205f3192..5443cad3 100644
--- a/src/qmicli/qmicli-helpers.c
+++ b/src/qmicli/qmicli-helpers.c
@@ -31,11 +31,11 @@ qmicli_get_raw_data_printable (const GArray *data,
gsize max_line_length,
const gchar *line_prefix)
{
- gsize i;
- gsize j;
+ gsize i;
+ gsize j;
gsize k;
- gsize new_str_length;
- gchar *new_str;
+ gsize new_str_length;
+ gchar *new_str;
gsize prefix_len;
guint n_lines;
gboolean is_new_line;
@@ -45,12 +45,12 @@ qmicli_get_raw_data_printable (const GArray *data,
if (!data)
return g_strdup ("");
- /* Get new string length. If input string has N bytes, we need:
- * - 1 byte for last NUL char
- * - 2N bytes for hexadecimal char representation of each byte...
- * - N-1 bytes for the separator ':'
- * So... a total of (1+2N+N-1) = 3N bytes are needed... */
- new_str_length = 3 * data->len;
+ /* Get new string length. If input string has N bytes, we need:
+ * - 1 byte for last NUL char
+ * - 2N bytes for hexadecimal char representation of each byte...
+ * - N-1 bytes for the separator ':'
+ * So... a total of (1+2N+N-1) = 3N bytes are needed... */
+ new_str_length = 3 * data->len;
/* Effective max line length needs to be multiple of 3, we don't want to
* split in half a given byte representation */
@@ -69,25 +69,25 @@ qmicli_get_raw_data_printable (const GArray *data,
* line length */
new_str_length += (n_lines * prefix_len);
- /* Allocate memory for new array and initialize contents to NUL */
- new_str = g_malloc0 (new_str_length);
+ /* Allocate memory for new array and initialize contents to NUL */
+ new_str = g_malloc0 (new_str_length);
- /* Print hexadecimal representation of each byte... */
+ /* Print hexadecimal representation of each byte... */
is_new_line = TRUE;
- for (i = 0, j = 0, k = 0; i < data->len; i++) {
+ for (i = 0, j = 0, k = 0; i < data->len; i++) {
if (is_new_line) {
strcpy (&new_str[j], line_prefix);
j += strlen (line_prefix);
is_new_line = FALSE;
}
- /* Print character in output string... */
- snprintf (&new_str[j], 3, "%02X", g_array_index (data, guint8, i));
+ /* Print character in output string... */
+ snprintf (&new_str[j], 3, "%02X", g_array_index (data, guint8, i));
j+=2;
k+=2;
- if (i != (data->len - 1) ) {
- new_str[j] = ':';
+ if (i != (data->len - 1) ) {
+ new_str[j] = ':';
j++;
k++;
}
@@ -98,10 +98,10 @@ qmicli_get_raw_data_printable (const GArray *data,
j++;
is_new_line = TRUE;
}
- }
+ }
- /* Set output string */
- return new_str;
+ /* Set output string */
+ return new_str;
}
gboolean
diff --git a/src/qmicli/qmicli-nas.c b/src/qmicli/qmicli-nas.c
index c774bf46..312ae169 100644
--- a/src/qmicli/qmicli-nas.c
+++ b/src/qmicli/qmicli-nas.c
@@ -120,16 +120,16 @@ static GOptionEntry entries[] = {
GOptionGroup *
qmicli_nas_get_option_group (void)
{
- GOptionGroup *group;
+ GOptionGroup *group;
- group = g_option_group_new ("nas",
- "NAS options",
- "Show Network Access Service options",
- NULL,
- NULL);
- g_option_group_add_entries (group, entries);
+ group = g_option_group_new ("nas",
+ "NAS options",
+ "Show Network Access Service options",
+ NULL,
+ NULL);
+ g_option_group_add_entries (group, entries);
- return group;
+ return group;
}
gboolean
diff --git a/src/qmicli/qmicli-pbm.c b/src/qmicli/qmicli-pbm.c
index 2e5f6d9e..66fd1fb2 100644
--- a/src/qmicli/qmicli-pbm.c
+++ b/src/qmicli/qmicli-pbm.c
@@ -59,16 +59,16 @@ static GOptionEntry entries[] = {
GOptionGroup *
qmicli_pbm_get_option_group (void)
{
- GOptionGroup *group;
+ GOptionGroup *group;
- group = g_option_group_new ("pbm",
- "PBM options",
- "Show Phonebook Management options",
- NULL,
- NULL);
- g_option_group_add_entries (group, entries);
+ group = g_option_group_new ("pbm",
+ "PBM options",
+ "Show Phonebook Management options",
+ NULL,
+ NULL);
+ g_option_group_add_entries (group, entries);
- return group;
+ return group;
}
gboolean
diff --git a/src/qmicli/qmicli-uim.c b/src/qmicli/qmicli-uim.c
index abf80472..453b46de 100644
--- a/src/qmicli/qmicli-uim.c
+++ b/src/qmicli/qmicli-uim.c
@@ -100,16 +100,16 @@ static GOptionEntry entries[] = {
GOptionGroup *
qmicli_uim_get_option_group (void)
{
- GOptionGroup *group;
+ GOptionGroup *group;
- group = g_option_group_new ("uim",
- "UIM options",
- "Show User Identity Module options",
- NULL,
- NULL);
- g_option_group_add_entries (group, entries);
+ group = g_option_group_new ("uim",
+ "UIM options",
+ "Show User Identity Module options",
+ NULL,
+ NULL);
+ g_option_group_add_entries (group, entries);
- return group;
+ return group;
}
gboolean
diff --git a/src/qmicli/qmicli-voice.c b/src/qmicli/qmicli-voice.c
index 6310cb1d..c3729f93 100644
--- a/src/qmicli/qmicli-voice.c
+++ b/src/qmicli/qmicli-voice.c
@@ -65,16 +65,16 @@ static GOptionEntry entries[] = {
GOptionGroup *
qmicli_voice_get_option_group (void)
{
- GOptionGroup *group;
+ GOptionGroup *group;
- group = g_option_group_new ("voice",
- "VOICE options",
- "Show Voice Service options",
- NULL,
- NULL);
- g_option_group_add_entries (group, entries);
+ group = g_option_group_new ("voice",
+ "VOICE options",
+ "Show Voice Service options",
+ NULL,
+ NULL);
+ g_option_group_add_entries (group, entries);
- return group;
+ return group;
}
gboolean
diff --git a/src/qmicli/qmicli-wda.c b/src/qmicli/qmicli-wda.c
index 5fdd41be..b88b16e6 100644
--- a/src/qmicli/qmicli-wda.c
+++ b/src/qmicli/qmicli-wda.c
@@ -70,16 +70,16 @@ static GOptionEntry entries[] = {
GOptionGroup *
qmicli_wda_get_option_group (void)
{
- GOptionGroup *group;
+ GOptionGroup *group;
- group = g_option_group_new ("wda",
- "WDA options",
- "Show Wireless Data Administrative options",
- NULL,
- NULL);
- g_option_group_add_entries (group, entries);
+ group = g_option_group_new ("wda",
+ "WDA options",
+ "Show Wireless Data Administrative options",
+ NULL,
+ NULL);
+ g_option_group_add_entries (group, entries);
- return group;
+ return group;
}
gboolean
diff --git a/src/qmicli/qmicli-wds.c b/src/qmicli/qmicli-wds.c
index 06a8b928..b4b1a60a 100644
--- a/src/qmicli/qmicli-wds.c
+++ b/src/qmicli/qmicli-wds.c
@@ -132,16 +132,16 @@ static GOptionEntry entries[] = {
GOptionGroup *
qmicli_wds_get_option_group (void)
{
- GOptionGroup *group;
+ GOptionGroup *group;
- group = g_option_group_new ("wds",
- "WDS options",
- "Show Wireless Data Service options",
- NULL,
- NULL);
- g_option_group_add_entries (group, entries);
+ group = g_option_group_new ("wds",
+ "WDS options",
+ "Show Wireless Data Service options",
+ NULL,
+ NULL);
+ g_option_group_add_entries (group, entries);
- return group;
+ return group;
}
gboolean
diff --git a/src/qmicli/qmicli.c b/src/qmicli/qmicli.c
index 4960c782..85c2faa0 100644
--- a/src/qmicli/qmicli.c
+++ b/src/qmicli/qmicli.c
@@ -704,29 +704,29 @@ int main (int argc, char **argv)
/* Setup option context, process it and destroy it */
context = g_option_context_new ("- Control QMI devices");
- g_option_context_add_group (context,
- qmicli_dms_get_option_group ());
- g_option_context_add_group (context,
- qmicli_nas_get_option_group ());
- g_option_context_add_group (context,
- qmicli_wds_get_option_group ());
- g_option_context_add_group (context,
- qmicli_pbm_get_option_group ());
- g_option_context_add_group (context,
- qmicli_uim_get_option_group ());
- g_option_context_add_group (context,
- qmicli_wms_get_option_group ());
- g_option_context_add_group (context,
- qmicli_wda_get_option_group ());
- g_option_context_add_group (context,
- qmicli_voice_get_option_group ());
+ g_option_context_add_group (context,
+ qmicli_dms_get_option_group ());
+ g_option_context_add_group (context,
+ qmicli_nas_get_option_group ());
+ g_option_context_add_group (context,
+ qmicli_wds_get_option_group ());
+ g_option_context_add_group (context,
+ qmicli_pbm_get_option_group ());
+ g_option_context_add_group (context,
+ qmicli_uim_get_option_group ());
+ g_option_context_add_group (context,
+ qmicli_wms_get_option_group ());
+ g_option_context_add_group (context,
+ qmicli_wda_get_option_group ());
+ g_option_context_add_group (context,
+ qmicli_voice_get_option_group ());
g_option_context_add_main_entries (context, main_entries, NULL);
if (!g_option_context_parse (context, &argc, &argv, &error)) {
g_printerr ("error: %s\n",
error->message);
exit (EXIT_FAILURE);
}
- g_option_context_free (context);
+ g_option_context_free (context);
if (version_flag)
print_version_and_exit ();
diff --git a/utils/qmitest.c b/utils/qmitest.c
index 7df896e5..5d20a548 100644
--- a/utils/qmitest.c
+++ b/utils/qmitest.c
@@ -77,33 +77,33 @@ print_buf (const char *detail, const char *buf, size_t len)
/**************************************************************/
typedef enum {
- QMI_SVC_CTL = 0x00,
- QMI_SVC_WDS = 0x01,
- QMI_SVC_DMS = 0x02,
- QMI_SVC_NAS = 0x03,
- QMI_SVC_QOS = 0x04,
- QMI_SVC_WMS = 0x05,
- QMI_SVC_PDS = 0x06,
- QMI_SVC_AUTH = 0x07,
- QMI_SVC_AT = 0x08,
- QMI_SVC_VOICE = 0x09,
- QMI_SVC_CAT2 = 0x0A,
- QMI_SVC_UIM = 0x0B,
- QMI_SVC_PBM = 0x0C,
- QMI_SVC_LOC = 0x10,
- QMI_SVC_SAR = 0x11,
- QMI_SVC_RMTFS = 0x14,
- QMI_SVC_CAT = 0xE0,
- QMI_SVC_RMS = 0xE1,
- QMI_SVC_OMA = 0xE2
+ QMI_SVC_CTL = 0x00,
+ QMI_SVC_WDS = 0x01,
+ QMI_SVC_DMS = 0x02,
+ QMI_SVC_NAS = 0x03,
+ QMI_SVC_QOS = 0x04,
+ QMI_SVC_WMS = 0x05,
+ QMI_SVC_PDS = 0x06,
+ QMI_SVC_AUTH = 0x07,
+ QMI_SVC_AT = 0x08,
+ QMI_SVC_VOICE = 0x09,
+ QMI_SVC_CAT2 = 0x0A,
+ QMI_SVC_UIM = 0x0B,
+ QMI_SVC_PBM = 0x0C,
+ QMI_SVC_LOC = 0x10,
+ QMI_SVC_SAR = 0x11,
+ QMI_SVC_RMTFS = 0x14,
+ QMI_SVC_CAT = 0xE0,
+ QMI_SVC_RMS = 0xE1,
+ QMI_SVC_OMA = 0xE2
} qmi_service_type;
struct qmux {
- u8 tf; /* always 1 */
- u16 len;
- u8 ctrl;
- u8 service;
- u8 qmicid;
+ u8 tf; /* always 1 */
+ u16 len;
+ u8 ctrl;
+ u8 service;
+ u8 qmicid;
} __attribute__((__packed__));
struct qmi_tlv_status {
@@ -112,93 +112,93 @@ struct qmi_tlv_status {
} __attribute__((__packed__));
struct getcid_req {
- struct qmux header;
- u8 req;
- u8 tid;
- u16 msgid;
- u16 tlvsize;
- u8 service;
- u16 size;
- u8 qmisvc;
+ struct qmux header;
+ u8 req;
+ u8 tid;
+ u16 msgid;
+ u16 tlvsize;
+ u8 service;
+ u16 size;
+ u8 qmisvc;
} __attribute__((__packed__));
struct releasecid_req {
- struct qmux header;
- u8 req;
- u8 tid;
- u16 msgid;
- u16 tlvsize;
- u8 rlscid;
- u16 size;
- u16 cid;
+ struct qmux header;
+ u8 req;
+ u8 tid;
+ u16 msgid;
+ u16 tlvsize;
+ u8 rlscid;
+ u16 size;
+ u16 cid;
} __attribute__((__packed__));
struct version_info_req {
- struct qmux header;
- u8 req;
- u8 tid;
- u16 msgid;
- u16 tlvsize;
+ struct qmux header;
+ u8 req;
+ u8 tid;
+ u16 msgid;
+ u16 tlvsize;
} __attribute__((__packed__));
struct qmi_ctl_version_info_list_service {
- u8 service_type; /* QMI_SVC_xxx */
- u16 major_version;
- u16 minor_version;
+ u8 service_type; /* QMI_SVC_xxx */
+ u16 major_version;
+ u16 minor_version;
} __attribute__((__packed__));
struct qmi_tlv_ctl_version_info_list {
- u8 count;
- struct qmi_ctl_version_info_list_service services[0];
+ u8 count;
+ struct qmi_ctl_version_info_list_service services[0];
}__attribute__((__packed__));
struct seteventreport_req {
- struct qmux header;
- u8 req;
- u16 tid;
- u16 msgid;
- u16 tlvsize;
- u8 reportchanrate;
- u16 size;
- u8 period;
- u32 mask;
+ struct qmux header;
+ u8 req;
+ u16 tid;
+ u16 msgid;
+ u16 tlvsize;
+ u8 reportchanrate;
+ u16 size;
+ u8 period;
+ u32 mask;
} __attribute__((__packed__));
struct getpkgsrvcstatus_req {
- struct qmux header;
- u8 req;
- u16 tid;
- u16 msgid;
- u16 tlvsize;
+ struct qmux header;
+ u8 req;
+ u16 tid;
+ u16 msgid;
+ u16 tlvsize;
} __attribute__((__packed__));
struct getmeid_req {
- struct qmux header;
- u8 req;
- u16 tid;
- u16 msgid;
- u16 tlvsize;
+ struct qmux header;
+ u8 req;
+ u16 tid;
+ u16 msgid;
+ u16 tlvsize;
} __attribute__((__packed__));
struct qmiwds_stats {
- u32 txok;
- u32 rxok;
- u32 txerr;
- u32 rxerr;
- u32 txofl;
- u32 rxofl;
- u64 txbytesok;
- u64 rxbytesok;
- qbool linkstate;
- qbool reconfigure;
+ u32 txok;
+ u32 rxok;
+ u32 txerr;
+ u32 rxerr;
+ u32 txofl;
+ u32 rxofl;
+ u64 txbytesok;
+ u64 rxbytesok;
+ qbool linkstate;
+ qbool reconfigure;
};
struct nas_signal_req {
- struct qmux header;
- u8 req;
- u16 tid;
- u16 msgid;
- u16 tlvsize;
+ struct qmux header;
+ u8 req;
+ u16 tid;
+ u16 msgid;
+ u16 tlvsize;
} __attribute__((__packed__));
const size_t qmux_size = sizeof(struct qmux);
@@ -206,147 +206,147 @@ const size_t qmux_size = sizeof(struct qmux);
static void
qmux_fill(struct qmux *qmux, u8 service, u16 cid, u16 size)
{
- qmux->tf = 1;
- qmux->len = size - 1;
- qmux->ctrl = 0;
- qmux->service = cid & 0xff;
- qmux->qmicid = cid >> 8;
+ qmux->tf = 1;
+ qmux->len = size - 1;
+ qmux->ctrl = 0;
+ qmux->service = cid & 0xff;
+ qmux->qmicid = cid >> 8;
}
static void *
qmictl_new_getcid(u8 tid, u8 svctype, size_t *size)
{
- struct getcid_req *req;
+ struct getcid_req *req;
req = g_malloc0 (sizeof (*req));
- req->req = 0x00;
- req->tid = tid;
- req->msgid = 0x0022;
- req->tlvsize = 0x0004;
- req->service = 0x01;
- req->size = 0x0001;
- req->qmisvc = svctype;
- *size = sizeof(*req);
+ req->req = 0x00;
+ req->tid = tid;
+ req->msgid = 0x0022;
+ req->tlvsize = 0x0004;
+ req->service = 0x01;
+ req->size = 0x0001;
+ req->qmisvc = svctype;
+ *size = sizeof(*req);
qmux_fill (&req->header, QMI_SVC_CTL, 0, *size);
- return req;
+ return req;
}
static void *
qmictl_new_releasecid(u8 tid, u16 cid, size_t *size)
{
- struct releasecid_req *req;
+ struct releasecid_req *req;
req = g_malloc0 (sizeof (*req));
- req->req = 0x00;
- req->tid = tid;
- req->msgid = 0x0023;
- req->tlvsize = 0x05;
- req->rlscid = 0x01;
- req->size = 0x0002;
- req->cid = cid;
- *size = sizeof(*req);
+ req->req = 0x00;
+ req->tid = tid;
+ req->msgid = 0x0023;
+ req->tlvsize = 0x05;
+ req->rlscid = 0x01;
+ req->size = 0x0002;
+ req->cid = cid;
+ *size = sizeof(*req);
qmux_fill (&req->header, QMI_SVC_CTL, 0, *size);
- return req;
+ return req;
}
static void *
qmictl_new_version_info(u8 tid, size_t *size)
{
- struct version_info_req *req;
+ struct version_info_req *req;
req = g_malloc0 (sizeof (*req));
- req->req = 0x00;
- req->tid = tid;
- req->msgid = 0x21;
- req->tlvsize = 0;
- *size = sizeof(*req);
+ req->req = 0x00;
+ req->tid = tid;
+ req->msgid = 0x21;
+ req->tlvsize = 0;
+ *size = sizeof(*req);
qmux_fill (&req->header, QMI_SVC_CTL, 0, *size);
- return req;
+ return req;
}
static void *
qmiwds_new_seteventreport(u8 tid, size_t *size)
{
- struct seteventreport_req *req;
+ struct seteventreport_req *req;
req = g_malloc0 (sizeof (*req));
- req->req = 0x00;
- req->tid = tid;
- req->msgid = 0x0001;
- req->tlvsize = 0x0008;
- req->reportchanrate = 0x11;
- req->size = 0x0005;
- req->period = 0x01;
- req->mask = 0x000000ff;
- *size = sizeof(*req);
- return req;
+ req->req = 0x00;
+ req->tid = tid;
+ req->msgid = 0x0001;
+ req->tlvsize = 0x0008;
+ req->reportchanrate = 0x11;
+ req->size = 0x0005;
+ req->period = 0x01;
+ req->mask = 0x000000ff;
+ *size = sizeof(*req);
+ return req;
}
static void *
qmiwds_new_getpkgsrvcstatus(u8 tid, size_t *size)
{
- struct getpkgsrvcstatus_req *req;
+ struct getpkgsrvcstatus_req *req;
req = g_malloc0 (sizeof (*req));
- req->req = 0x00;
- req->tid = tid;
- req->msgid = 0x22;
- req->tlvsize = 0x0000;
- *size = sizeof(*req);
- return req;
+ req->req = 0x00;
+ req->tid = tid;
+ req->msgid = 0x22;
+ req->tlvsize = 0x0000;
+ *size = sizeof(*req);
+ return req;
}
static void *
qmidms_new_getmeid(u16 cid, u8 tid, size_t *size)
{
- struct getmeid_req *req;
+ struct getmeid_req *req;
req = g_malloc0 (sizeof (*req));
- req->req = 0x00;
- req->tid = tid;
- req->msgid = 0x25;
- req->tlvsize = 0x0000;
- *size = sizeof(*req);
+ req->req = 0x00;
+ req->tid = tid;
+ req->msgid = 0x25;
+ req->tlvsize = 0x0000;
+ *size = sizeof(*req);
qmux_fill (&req->header, QMI_SVC_WDS, cid, *size);
- return req;
+ return req;
}
static int
qmux_parse(u16 *cid, void *buf, size_t size)
{
- struct qmux *qmux = buf;
+ struct qmux *qmux = buf;
- if (!buf || size < 12)
- return -ENOMEM;
+ if (!buf || size < 12)
+ return -ENOMEM;
- if (qmux->tf != 1 || qmux->len != size - 1 || qmux->ctrl != 0x80)
- return -EINVAL;
+ if (qmux->tf != 1 || qmux->len != size - 1 || qmux->ctrl != 0x80)
+ return -EINVAL;
- *cid = (qmux->qmicid << 8) + qmux->service;
- return sizeof(*qmux);
+ *cid = (qmux->qmicid << 8) + qmux->service;
+ return sizeof(*qmux);
}
static u16
tlv_get(void *msg, u16 msgsize, u8 type, void *buf, u16 bufsize)
{
- u16 pos;
- u16 msize = 0;
+ u16 pos;
+ u16 msize = 0;
- if (!msg || !buf)
- return -ENOMEM;
+ if (!msg || !buf)
+ return -ENOMEM;
- for (pos = 4; pos + 3 < msgsize; pos += msize + 3) {
- msize = *(u16 *)(msg + pos + 1);
- if (*(u8 *)(msg + pos) == type) {
- if (bufsize < msize)
- return -ENOMEM;
+ for (pos = 4; pos + 3 < msgsize; pos += msize + 3) {
+ msize = *(u16 *)(msg + pos + 1);
+ if (*(u8 *)(msg + pos) == type) {
+ if (bufsize < msize)
+ return -ENOMEM;
- memcpy(buf, msg + pos + 3, msize);
- return msize;
- }
- }
+ memcpy(buf, msg + pos + 3, msize);
+ return msize;
+ }
+ }
- return -ENOMSG;
+ return -ENOMSG;
}
static int
@@ -354,48 +354,48 @@ qmi_msgisvalid(void *msg, u16 size)
{
struct qmi_tlv_status status;
- if (tlv_get(msg, size, 2, &status, sizeof (status)) == sizeof (status)) {
+ if (tlv_get(msg, size, 2, &status, sizeof (status)) == sizeof (status)) {
if (le16toh (status.status != 0))
return le16toh (status.error);
- else
- return 0;
- }
- return -ENOMSG;
+ else
+ return 0;
+ }
+ return -ENOMSG;
}
static int
qmi_msgid(void *msg, u16 size)
{
- return size < 2 ? -ENODATA : *(u16 *)msg;
+ return size < 2 ? -ENODATA : *(u16 *)msg;
}
static int
qmictl_version_info_resp(void *buf, u16 size)
{
- int result, i;
- u8 offset = sizeof(struct qmux) + 2;
+ int result, i;
+ u8 offset = sizeof(struct qmux) + 2;
u8 svcbuf[100];
struct qmi_tlv_ctl_version_info_list *service_list;
struct qmi_ctl_version_info_list_service *svc;
- if (!buf || size < offset)
- return -ENOMEM;
+ if (!buf || size < offset)
+ return -ENOMEM;
- buf = buf + offset;
- size -= offset;
+ buf = buf + offset;
+ size -= offset;
- result = qmi_msgid(buf, size);
- if (result != 0x21)
- return -EFAULT;
+ result = qmi_msgid(buf, size);
+ if (result != 0x21)
+ return -EFAULT;
- result = qmi_msgisvalid(buf, size);
- if (result != 0)
- return -EFAULT;
+ result = qmi_msgisvalid(buf, size);
+ if (result != 0)
+ return -EFAULT;
/* Get the services TLV */
- result = tlv_get(buf, size, 0x01, svcbuf, sizeof (svcbuf));
- if (result < 0)
- return -EFAULT;
+ result = tlv_get(buf, size, 0x01, svcbuf, sizeof (svcbuf));
+ if (result < 0)
+ return -EFAULT;
service_list = (struct qmi_tlv_ctl_version_info_list *) svcbuf;
if (result < (service_list->count * sizeof (struct qmi_ctl_version_info_list_service)))
@@ -409,140 +409,140 @@ qmictl_version_info_resp(void *buf, u16 size)
le16toh (svc->minor_version));
}
- return 0;
+ return 0;
}
static int
qmictl_getcid_resp(void *buf, u16 size, u16 *cid)
{
- int result;
- u8 offset = sizeof(struct qmux) + 2;
+ int result;
+ u8 offset = sizeof(struct qmux) + 2;
- if (!buf || size < offset)
- return -ENOMEM;
+ if (!buf || size < offset)
+ return -ENOMEM;
- buf = buf + offset;
- size -= offset;
+ buf = buf + offset;
+ size -= offset;
- result = qmi_msgid(buf, size);
- if (result != 0x22)
- return -EFAULT;
+ result = qmi_msgid(buf, size);
+ if (result != 0x22)
+ return -EFAULT;
- result = qmi_msgisvalid(buf, size);
- if (result != 0)
- return -EFAULT;
+ result = qmi_msgisvalid(buf, size);
+ if (result != 0)
+ return -EFAULT;
- result = tlv_get(buf, size, 0x01, cid, 2);
- if (result != 2)
- return -EFAULT;
+ result = tlv_get(buf, size, 0x01, cid, 2);
+ if (result != 2)
+ return -EFAULT;
- return 0;
+ return 0;
}
static int
qmictl_releasecid_resp(void *buf, u16 size)
{
- int result;
- u8 offset = sizeof(struct qmux) + 2;
+ int result;
+ u8 offset = sizeof(struct qmux) + 2;
- if (!buf || size < offset)
- return -ENOMEM;
+ if (!buf || size < offset)
+ return -ENOMEM;
- buf = buf + offset;
- size -= offset;
+ buf = buf + offset;
+ size -= offset;
- result = qmi_msgid(buf, size);
- if (result != 0x23)
- return -EFAULT;
+ result = qmi_msgid(buf, size);
+ if (result != 0x23)
+ return -EFAULT;
- result = qmi_msgisvalid(buf, size);
- if (result != 0)
- return -EFAULT;
+ result = qmi_msgisvalid(buf, size);
+ if (result != 0)
+ return -EFAULT;
- return 0;
+ return 0;
}
static int
qmiwds_event_resp(void *buf, u16 size, struct qmiwds_stats *stats)
{
- int result;
- u8 status[2];
-
- u8 offset = sizeof(struct qmux) + 3;
-
- if (!buf || size < offset || !stats)
- return -ENOMEM;
-
- buf = buf + offset;
- size -= offset;
-
- result = qmi_msgid(buf, size);
- if (result == 0x01) {
- tlv_get(buf, size, 0x10, &stats->txok, 4);
- tlv_get(buf, size, 0x11, &stats->rxok, 4);
- tlv_get(buf, size, 0x12, &stats->txerr, 4);
- tlv_get(buf, size, 0x13, &stats->rxerr, 4);
- tlv_get(buf, size, 0x14, &stats->txofl, 4);
- tlv_get(buf, size, 0x15, &stats->rxofl, 4);
- tlv_get(buf, size, 0x19, &stats->txbytesok, 8);
- tlv_get(buf, size, 0x1A, &stats->rxbytesok, 8);
- } else if (result == 0x22) {
- result = tlv_get(buf, size, 0x01, &status[0], 2);
- if (result >= 1)
- stats->linkstate = status[0] == 0x02;
- if (result == 2)
- stats->reconfigure = status[1] == 0x01;
-
- if (result < 0)
- return result;
- } else {
- return -EFAULT;
- }
-
- return 0;
+ int result;
+ u8 status[2];
+
+ u8 offset = sizeof(struct qmux) + 3;
+
+ if (!buf || size < offset || !stats)
+ return -ENOMEM;
+
+ buf = buf + offset;
+ size -= offset;
+
+ result = qmi_msgid(buf, size);
+ if (result == 0x01) {
+ tlv_get(buf, size, 0x10, &stats->txok, 4);
+ tlv_get(buf, size, 0x11, &stats->rxok, 4);
+ tlv_get(buf, size, 0x12, &stats->txerr, 4);
+ tlv_get(buf, size, 0x13, &stats->rxerr, 4);
+ tlv_get(buf, size, 0x14, &stats->txofl, 4);
+ tlv_get(buf, size, 0x15, &stats->rxofl, 4);
+ tlv_get(buf, size, 0x19, &stats->txbytesok, 8);
+ tlv_get(buf, size, 0x1A, &stats->rxbytesok, 8);
+ } else if (result == 0x22) {
+ result = tlv_get(buf, size, 0x01, &status[0], 2);
+ if (result >= 1)
+ stats->linkstate = status[0] == 0x02;
+ if (result == 2)
+ stats->reconfigure = status[1] == 0x01;
+
+ if (result < 0)
+ return result;
+ } else {
+ return -EFAULT;
+ }
+
+ return 0;
}
static int
qmidms_meid_resp(void *buf, u16 size, char *meid, int meidsize)
{
- int result;
+ int result;
- u8 offset = sizeof(struct qmux) + 3;
+ u8 offset = sizeof(struct qmux) + 3;
- if (!buf || size < offset || meidsize < 14)
- return -ENOMEM;
+ if (!buf || size < offset || meidsize < 14)
+ return -ENOMEM;
- buf = buf + offset;
- size -= offset;
+ buf = buf + offset;
+ size -= offset;
- result = qmi_msgid(buf, size);
- if (result != 0x25)
- return -EFAULT;
+ result = qmi_msgid(buf, size);
+ if (result != 0x25)
+ return -EFAULT;
- result = qmi_msgisvalid(buf, size);
- if (result)
- return -EFAULT;
+ result = qmi_msgisvalid(buf, size);
+ if (result)
+ return -EFAULT;
- result = tlv_get(buf, size, 0x12, meid, 14);
- if (result != 14)
- return -EFAULT;
+ result = tlv_get(buf, size, 0x12, meid, 14);
+ if (result != 14)
+ return -EFAULT;
- return 0;
+ return 0;
}
static void *
qminas_new_signal(u16 cid, u8 tid, size_t *size)
{
- struct nas_signal_req *req;
+ struct nas_signal_req *req;
req = g_malloc0 (sizeof (*req));
- req->req = 0x00;
- req->tid = tid;
- req->msgid = 0x20;
- req->tlvsize = 0x0000;
- *size = sizeof(*req);
+ req->req = 0x00;
+ req->tid = tid;
+ req->msgid = 0x20;
+ req->tlvsize = 0x0000;
+ *size = sizeof(*req);
qmux_fill (&req->header, QMI_SVC_NAS, cid, *size);
- return req;
+ return req;
}
/* NAS/Get Signal Strength TLV 0x01 */
@@ -554,32 +554,32 @@ struct qminas_resp_signalstrength {
static int
qminas_signal_resp(void *buf, u16 size, u8 *dbm, u8 *act)
{
- int result;
- struct qminas_resp_signalstrength signal;
+ int result;
+ struct qminas_resp_signalstrength signal;
- u8 offset = sizeof(struct qmux) + 3;
+ u8 offset = sizeof(struct qmux) + 3;
- if (!buf || size < offset)
- return -ENOMEM;
+ if (!buf || size < offset)
+ return -ENOMEM;
- buf = buf + offset;
- size -= offset;
+ buf = buf + offset;
+ size -= offset;
- result = qmi_msgid(buf, size);
- if (result != 0x20)
- return -EFAULT;
+ result = qmi_msgid(buf, size);
+ if (result != 0x20)
+ return -EFAULT;
- result = qmi_msgisvalid(buf, size);
- if (result)
- return -EFAULT;
+ result = qmi_msgisvalid(buf, size);
+ if (result)
+ return -EFAULT;
- result = tlv_get(buf, size, 0x01, &signal, sizeof (signal));
- if (result != sizeof (signal))
- return -EFAULT;
+ result = tlv_get(buf, size, 0x01, &signal, sizeof (signal));
+ if (result != sizeof (signal))
+ return -EFAULT;
*dbm = signal.dbm;
*act = signal.act;
- return 0;
+ return 0;
}
/*****************************************************/