summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hel.nix5
-rw-r--r--patches/attachment-0001.patch158
-rw-r--r--patches/attachment.patch34
3 files changed, 193 insertions, 4 deletions
diff --git a/hel.nix b/hel.nix
index 44c3f279..c8f42f82 100644
--- a/hel.nix
+++ b/hel.nix
@@ -58,11 +58,8 @@
58 58
59 nixpkgs.config.packageOverrides = pkgs: rec { 59 nixpkgs.config.packageOverrides = pkgs: rec {
60 libmbim = pkgs.stdenv.lib.overrideDerivation pkgs.libmbim (attrs: { 60 libmbim = pkgs.stdenv.lib.overrideDerivation pkgs.libmbim (attrs: {
61 patches = [ ./patches/attachment-0003.patch ]; 61 patches = [ ./patches/attachment-0003.patch ./patches/attachment.patch ./patches/attachment-0001.patch ];
62 buildInputs = attrs.buildInputs ++ [ pkgs.automake114x pkgs.autoconf ]; 62 buildInputs = attrs.buildInputs ++ [ pkgs.automake114x pkgs.autoconf ];
63 postConfigure = ''
64 ${pkgs.findutils}/bin/find . -iname '*.json'
65 '';
66 }); 63 });
67 libqmi = pkgs.stdenv.lib.overrideDerivation pkgs.libqmi (attrs: { 64 libqmi = pkgs.stdenv.lib.overrideDerivation pkgs.libqmi (attrs: {
68 patches = [ ./patches/attachment-0004.patch ./patches/attachment-0005.patch ]; 65 patches = [ ./patches/attachment-0004.patch ./patches/attachment-0005.patch ];
diff --git a/patches/attachment-0001.patch b/patches/attachment-0001.patch
new file mode 100644
index 00000000..54882d44
--- /dev/null
+++ b/patches/attachment-0001.patch
@@ -0,0 +1,158 @@
1From 9550bd568371995acca003d6250ba4535db7d59f Mon Sep 17 00:00:00 2001
2From: Emil Ljungdahl <emil.ljungdahl@wisi.se>
3Date: Wed, 6 Apr 2016 19:25:27 +0200
4Subject: [PATCH 3/3] Avoid affecting the padding behavior for other services
5 than QMI
6
7---
8 build-aux/mbim-codegen/Message.py | 9 +++++----
9 build-aux/mbim-codegen/Struct.py | 9 +++++----
10 data/mbim-service-qmi.json | 6 ++++--
11 src/libmbim-glib/mbim-message-private.h | 4 ++--
12 src/libmbim-glib/mbim-message.c | 10 +++++-----
13 5 files changed, 21 insertions(+), 17 deletions(-)
14
15diff --git a/build-aux/mbim-codegen/Message.py b/build-aux/mbim-codegen/Message.py
16index e66335d..a569685 100644
17--- a/build-aux/mbim-codegen/Message.py
18+++ b/build-aux/mbim-codegen/Message.py
19@@ -381,6 +381,7 @@ class Message:
20 translations['struct'] = field['struct-type'] if 'struct-type' in field else ''
21 translations['struct_underscore'] = utils.build_underscore_name_from_camelcase (translations['struct'])
22 translations['array_size'] = field['array-size'] if 'array-size' in field else ''
23+ translations['pad_array'] = field['pad-array'] if 'pad-array' in field else 'TRUE'
24
25 inner_template = ''
26 if 'available-if' in field:
27@@ -394,13 +395,13 @@ class Message:
28 inner_template += (' {\n')
29
30 if field['format'] == 'byte-array':
31- inner_template += (' _mbim_message_command_builder_append_byte_array (builder, FALSE, FALSE, TRUE, ${field}, ${array_size});\n')
32+ inner_template += (' _mbim_message_command_builder_append_byte_array (builder, FALSE, FALSE, ${pad_array}, ${field}, ${array_size});\n')
33 elif field['format'] == 'unsized-byte-array':
34- inner_template += (' _mbim_message_command_builder_append_byte_array (builder, FALSE, FALSE, FALSE, ${field}, ${field}_size);\n')
35+ inner_template += (' _mbim_message_command_builder_append_byte_array (builder, FALSE, FALSE, ${pad_array}, ${field}, ${field}_size);\n')
36 elif field['format'] == 'ref-byte-array':
37- inner_template += (' _mbim_message_command_builder_append_byte_array (builder, TRUE, TRUE, TRUE, ${field}, ${field}_size);\n')
38+ inner_template += (' _mbim_message_command_builder_append_byte_array (builder, TRUE, TRUE, ${pad_array}, ${field}, ${field}_size);\n')
39 elif field['format'] == 'ref-byte-array-no-offset':
40- inner_template += (' _mbim_message_command_builder_append_byte_array (builder, FALSE, TRUE, TRUE, ${field}, ${field}_size);\n')
41+ inner_template += (' _mbim_message_command_builder_append_byte_array (builder, FALSE, TRUE, ${pad_array}, ${field}, ${field}_size);\n')
42 elif field['format'] == 'uuid':
43 inner_template += (' _mbim_message_command_builder_append_uuid (builder, ${field});\n')
44 elif field['format'] == 'guint32':
45diff --git a/build-aux/mbim-codegen/Struct.py b/build-aux/mbim-codegen/Struct.py
46index 8797f3a..84570de 100644
47--- a/build-aux/mbim-codegen/Struct.py
48+++ b/build-aux/mbim-codegen/Struct.py
49@@ -494,18 +494,19 @@ class Struct:
50 translations['field'] = utils.build_underscore_name_from_camelcase(field['name'])
51 translations['array_size'] = field['array-size'] if 'array-size' in field else ''
52 translations['array_size_field'] = utils.build_underscore_name_from_camelcase(field['array-size-field']) if 'array-size-field' in field else ''
53+ translations['pad_array'] = field['pad-array'] if 'pad-array' in field else 'TRUE'
54
55 if field['format'] == 'uuid':
56 inner_template = (' _mbim_struct_builder_append_uuid (builder, &(value->${field}));\n')
57 elif field['format'] == 'byte-array':
58- inner_template = (' _mbim_struct_builder_append_byte_array (builder, FALSE, FALSE, TRUE, value->${field}, ${array_size});\n')
59+ inner_template = (' _mbim_struct_builder_append_byte_array (builder, FALSE, FALSE, ${pad_array}, value->${field}, ${array_size});\n')
60 elif field['format'] == 'unsized-byte-array':
61- inner_template = (' _mbim_struct_builder_append_byte_array (builder, FALSE, FALSE, FALSE, value->${field}, value->${field}_size);\n')
62+ inner_template = (' _mbim_struct_builder_append_byte_array (builder, FALSE, FALSE, ${pad_array}, value->${field}, value->${field}_size);\n')
63 elif field['format'] == 'ref-byte-array':
64 if 'array-size-field' in field:
65- inner_template = (' _mbim_struct_builder_append_byte_array (builder, TRUE, FALSE, TRUE, value->${field}, value->${array_size_field});\n')
66+ inner_template = (' _mbim_struct_builder_append_byte_array (builder, TRUE, FALSE, ${pad_array}, value->${field}, value->${array_size_field});\n')
67 else:
68- inner_template = (' _mbim_struct_builder_append_byte_array (builder, TRUE, TRUE, TRUE, value->${field}, value->${field}_size);\n')
69+ inner_template = (' _mbim_struct_builder_append_byte_array (builder, TRUE, TRUE, ${pad_array}, value->${field}, value->${field}_size);\n')
70 elif field['format'] == 'guint32':
71 inner_template = (' _mbim_struct_builder_append_guint32 (builder, value->${field});\n')
72 elif field['format'] == 'guint32-array':
73diff --git a/data/mbim-service-qmi.json b/data/mbim-service-qmi.json
74index b764d01..c11857f 100644
75--- a/data/mbim-service-qmi.json
76+++ b/data/mbim-service-qmi.json
77@@ -9,7 +9,9 @@
78 "service" : "QMI",
79 "type" : "Command",
80 "set" : [ { "name" : "QmiMsg",
81- "format" : "unsized-byte-array" } ],
82+ "format" : "unsized-byte-array",
83+ "pad-array" : "FALSE" } ],
84 "response" : [ { "name" : "QMUX",
85- "format" : "unsized-byte-array" } ] }
86+ "format" : "unsized-byte-array",
87+ "pad-array" : "FALSE" } ] }
88 ]
89diff --git a/src/libmbim-glib/mbim-message-private.h b/src/libmbim-glib/mbim-message-private.h
90index 0082026..79071d8 100644
91--- a/src/libmbim-glib/mbim-message-private.h
92+++ b/src/libmbim-glib/mbim-message-private.h
93@@ -177,7 +177,7 @@ GByteArray *_mbim_struct_builder_complete (MbimStructBuilder
94 void _mbim_struct_builder_append_byte_array (MbimStructBuilder *builder,
95 gboolean with_offset,
96 gboolean with_length,
97- gboolean permit_padding,
98+ gboolean pad_buffer,
99 const guint8 *buffer,
100 guint32 buffer_len);
101 void _mbim_struct_builder_append_uuid (MbimStructBuilder *builder,
102@@ -226,7 +226,7 @@ MbimMessage *_mbim_message_command_builder_complete (M
103 void _mbim_message_command_builder_append_byte_array (MbimMessageCommandBuilder *builder,
104 gboolean with_offset,
105 gboolean with_length,
106- gboolean permit_padding,
107+ gboolean pad_buffer,
108 const guint8 *buffer,
109 guint32 buffer_len);
110 void _mbim_message_command_builder_append_uuid (MbimMessageCommandBuilder *builder,
111diff --git a/src/libmbim-glib/mbim-message.c b/src/libmbim-glib/mbim-message.c
112index ad67059..1a0d492 100644
113--- a/src/libmbim-glib/mbim-message.c
114+++ b/src/libmbim-glib/mbim-message.c
115@@ -492,7 +492,7 @@ void
116 _mbim_struct_builder_append_byte_array (MbimStructBuilder *builder,
117 gboolean with_offset,
118 gboolean with_length,
119- gboolean permit_padding,
120+ gboolean pad_buffer,
121 const guint8 *buffer,
122 guint32 buffer_len)
123 {
124@@ -502,7 +502,7 @@ _mbim_struct_builder_append_byte_array (MbimStructBuilder *builder,
125 */
126 if (!with_offset && !with_length) {
127 g_byte_array_append (builder->fixed_buffer, buffer, buffer_len);
128- if(permit_padding) {
129+ if(pad_buffer) {
130 while (buffer_len % 4 != 0) {
131 const guint8 padding = 0;
132
133@@ -554,7 +554,7 @@ _mbim_struct_builder_append_byte_array (MbimStructBuilder *builder,
134 g_byte_array_append (builder->variable_buffer, (const guint8 *)buffer, (guint)buffer_len);
135
136 /* Note: adding zero padding causes trouble for QMI service */
137- if(permit_padding) {
138+ if(pad_buffer) {
139 while (buffer_len % 4 != 0) {
140 const guint8 padding = 0;
141
142@@ -830,11 +830,11 @@ void
143 _mbim_message_command_builder_append_byte_array (MbimMessageCommandBuilder *builder,
144 gboolean with_offset,
145 gboolean with_length,
146- gboolean permit_padding,
147+ gboolean pad_buffer,
148 const guint8 *buffer,
149 guint32 buffer_len)
150 {
151- _mbim_struct_builder_append_byte_array (builder->contents_builder, with_offset, with_length, permit_padding, buffer, buffer_len);
152+ _mbim_struct_builder_append_byte_array (builder->contents_builder, with_offset, with_length, pad_buffer, buffer, buffer_len);
153 }
154
155 void
156--
1571.9.1
158
diff --git a/patches/attachment.patch b/patches/attachment.patch
new file mode 100644
index 00000000..32d4b053
--- /dev/null
+++ b/patches/attachment.patch
@@ -0,0 +1,34 @@
1From 65d4a4bb0420794ece5082da2cac0b6771e75be7 Mon Sep 17 00:00:00 2001
2From: Emil Ljungdahl <emil.ljungdahl@wisi.se>
3Date: Wed, 6 Apr 2016 19:16:47 +0200
4Subject: [PATCH 2/3] Added json file lost in original qmi-over-mbim patch
5
6---
7 data/mbim-service-qmi.json | 15 +++++++++++++++
8 1 file changed, 15 insertions(+)
9 create mode 100644 data/mbim-service-qmi.json
10
11diff --git a/data/mbim-service-qmi.json b/data/mbim-service-qmi.json
12new file mode 100644
13index 0000000..b764d01
14--- /dev/null
15+++ b/data/mbim-service-qmi.json
16@@ -0,0 +1,15 @@
17+
18+[
19+ // *********************************************************************************
20+ { "type" : "Service",
21+ "name" : "QMI" },
22+
23+ // *********************************************************************************
24+ { "name" : "msg",
25+ "service" : "QMI",
26+ "type" : "Command",
27+ "set" : [ { "name" : "QmiMsg",
28+ "format" : "unsized-byte-array" } ],
29+ "response" : [ { "name" : "QMUX",
30+ "format" : "unsized-byte-array" } ] }
31+]
32--
331.9.1
34