summaryrefslogtreecommitdiff
path: root/patches/attachment-0001.patch
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2016-05-17 01:07:14 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2016-05-17 01:07:14 +0200
commit743af014a307153c017077d255c7b3a181237e35 (patch)
treec26c38c19122fb2cfb42064069e05888f2d2c215 /patches/attachment-0001.patch
parentfdf028a3703e66770be71c777d7609c58611f859 (diff)
parent29f16288001cd0d64e7c158bb1e327483a9e2d9a (diff)
downloadnixos-743af014a307153c017077d255c7b3a181237e35.tar
nixos-743af014a307153c017077d255c7b3a181237e35.tar.gz
nixos-743af014a307153c017077d255c7b3a181237e35.tar.bz2
nixos-743af014a307153c017077d255c7b3a181237e35.tar.xz
nixos-743af014a307153c017077d255c7b3a181237e35.zip
Merge branch 'master' of git://git.yggdrasil.li/nixos
Diffstat (limited to 'patches/attachment-0001.patch')
-rw-r--r--patches/attachment-0001.patch158
1 files changed, 158 insertions, 0 deletions
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