diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-05-17 01:07:14 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-05-17 01:07:14 +0200 |
commit | 743af014a307153c017077d255c7b3a181237e35 (patch) | |
tree | c26c38c19122fb2cfb42064069e05888f2d2c215 | |
parent | fdf028a3703e66770be71c777d7609c58611f859 (diff) | |
parent | 29f16288001cd0d64e7c158bb1e327483a9e2d9a (diff) | |
download | nixos-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
-rw-r--r-- | custom/tinc/def.nix | 1 | ||||
-rw-r--r-- | custom/uucp.nix | 28 | ||||
-rw-r--r-- | custom/zsh.nix | 2 | ||||
-rw-r--r-- | hel.nix | 59 | ||||
-rw-r--r-- | hel/recv-media.nix | 13 | ||||
-rw-r--r-- | patches/attachment-0001.patch | 158 | ||||
-rw-r--r-- | patches/attachment-0003.patch | 446 | ||||
-rw-r--r-- | patches/attachment-0004.patch | 329 | ||||
-rw-r--r-- | patches/attachment-0005.patch | 50 | ||||
-rw-r--r-- | patches/attachment.patch | 34 | ||||
-rw-r--r-- | ymir.nix | 16 |
11 files changed, 1121 insertions, 15 deletions
diff --git a/custom/tinc/def.nix b/custom/tinc/def.nix index e14ce5e9..3de31418 100644 --- a/custom/tinc/def.nix +++ b/custom/tinc/def.nix | |||
@@ -118,6 +118,7 @@ in | |||
118 | DeviceType = ${data.interfaceType} | 118 | DeviceType = ${data.interfaceType} |
119 | Device = /dev/net/tun | 119 | Device = /dev/net/tun |
120 | Interface = tinc.${network} | 120 | Interface = tinc.${network} |
121 | ExperimentalProtocol = no | ||
121 | ${data.extraConfig} | 122 | ${data.extraConfig} |
122 | ''; | 123 | ''; |
123 | }; | 124 | }; |
diff --git a/custom/uucp.nix b/custom/uucp.nix index 51caf13c..ed452f22 100644 --- a/custom/uucp.nix +++ b/custom/uucp.nix | |||
@@ -6,7 +6,7 @@ let | |||
6 | portSpec = name: '' | 6 | portSpec = name: '' |
7 | port ${name} | 7 | port ${name} |
8 | type pipe | 8 | type pipe |
9 | protocol e | 9 | protocol ${if builtins.hasAttr name config.services.uucp.protocols then config.services.uucp.protocols."${name}" else config.services.uucp.defaultProtocol} |
10 | reliable true | 10 | reliable true |
11 | command ${pkgs.openssh}/bin/ssh -x -o batchmode=yes ${name} | 11 | command ${pkgs.openssh}/bin/ssh -x -o batchmode=yes ${name} |
12 | ''; | 12 | ''; |
@@ -15,9 +15,9 @@ let | |||
15 | time Any | 15 | time Any |
16 | port ${name} | 16 | port ${name} |
17 | chat "" | 17 | chat "" |
18 | protocol e | 18 | protocol ${if builtins.hasAttr name config.services.uucp.protocols then config.services.uucp.protocols."${name}" else config.services.uucp.defaultProtocol} |
19 | command-path ${concatStringsSep " " config.services.uucp.commandPath} | 19 | command-path ${concatStringsSep " " config.services.uucp.commandPath} |
20 | commands ${concatStringsSep " " (if config.services.uucp.commands ? name then config.services.uucp.commands."${name}" else config.services.uucp.defaultCommands)} | 20 | commands ${concatStringsSep " " (if builtins.hasAttr name config.services.uucp.commands then config.services.uucp.commands."${name}" else config.services.uucp.defaultCommands)} |
21 | ''; | 21 | ''; |
22 | in { | 22 | in { |
23 | options = { | 23 | options = { |
@@ -77,6 +77,18 @@ in { | |||
77 | description = "Override commands for specific remotes"; | 77 | description = "Override commands for specific remotes"; |
78 | }; | 78 | }; |
79 | 79 | ||
80 | defaultProtocol = mkOption { | ||
81 | type = types.string; | ||
82 | default = "e"; | ||
83 | description = "UUCP protocol to use within ssh unless overriden"; | ||
84 | }; | ||
85 | |||
86 | protocols = mkOption { | ||
87 | type = types.attrsOf types.string; | ||
88 | default = {}; | ||
89 | description = "UUCP protocols to use for specific remotes"; | ||
90 | }; | ||
91 | |||
80 | spoolDir = mkOption { | 92 | spoolDir = mkOption { |
81 | type = types.path; | 93 | type = types.path; |
82 | default = "/var/spool/uucp"; | 94 | default = "/var/spool/uucp"; |
@@ -127,6 +139,14 @@ in { | |||
127 | default = ""; | 139 | default = ""; |
128 | description = "Extra configuration to append verbatim to `/etc/uucp/config'"; | 140 | description = "Extra configuration to append verbatim to `/etc/uucp/config'"; |
129 | }; | 141 | }; |
142 | |||
143 | extraSys = mkOption { | ||
144 | type = types.string; | ||
145 | default = '' | ||
146 | protocol-parameter g packet-size 4096 | ||
147 | ''; | ||
148 | description = "Extra configuration to prepend verbatim to `/etc/uucp/sys`"; | ||
149 | }; | ||
130 | }; | 150 | }; |
131 | }; | 151 | }; |
132 | 152 | ||
@@ -183,7 +203,7 @@ in { | |||
183 | '' + concatStringsSep "\n" (map portSpec config.services.uucp.remoteNodes); | 203 | '' + concatStringsSep "\n" (map portSpec config.services.uucp.remoteNodes); |
184 | }; | 204 | }; |
185 | environment.etc."uucp/sys" = { | 205 | environment.etc."uucp/sys" = { |
186 | text = concatStringsSep "\n" (map sysSpec config.services.uucp.remoteNodes); | 206 | text = config.services.uucp.extraSys + "\n" + concatStringsSep "\n" (map sysSpec config.services.uucp.remoteNodes); |
187 | }; | 207 | }; |
188 | 208 | ||
189 | security.setuidOwners = map (p: {program = p; owner = "root"; group = "root"; setuid = true; setgid = false;}) ["uucico" "uuxqt" "cu" "uucp" "uuname" "uustat" "uux"]; | 209 | security.setuidOwners = map (p: {program = p; owner = "root"; group = "root"; setuid = true; setgid = false;}) ["uucico" "uuxqt" "cu" "uucp" "uuname" "uustat" "uux"]; |
diff --git a/custom/zsh.nix b/custom/zsh.nix index 7279cf4f..826a3511 100644 --- a/custom/zsh.nix +++ b/custom/zsh.nix | |||
@@ -31,6 +31,8 @@ in rec { | |||
31 | tmux | 31 | tmux |
32 | zsh-users/zsh-syntax-highlighting | 32 | zsh-users/zsh-syntax-highlighting |
33 | systemd | 33 | systemd |
34 | pass | ||
35 | mosh | ||
34 | EOBUNDLES | 36 | EOBUNDLES |
35 | 37 | ||
36 | if [[ -e ~/.zsh-theme ]]; then | 38 | if [[ -e ~/.zsh-theme ]]; then |
@@ -19,19 +19,23 @@ | |||
19 | 19 | ||
20 | networking = { | 20 | networking = { |
21 | hostName = "hel"; | 21 | hostName = "hel"; |
22 | wireless = { | 22 | # wireless = { |
23 | enable = true; | 23 | # enable = true; |
24 | userControlled = { | 24 | # userControlled = { |
25 | enable = true; | 25 | # enable = true; |
26 | group = "network"; | 26 | # group = "network"; |
27 | }; | 27 | # }; |
28 | }; | 28 | # }; |
29 | 29 | ||
30 | firewall = { | 30 | firewall = { |
31 | enable = true; | 31 | enable = true; |
32 | allowedTCPPorts = [ 22 # ssh | 32 | allowedTCPPorts = [ 22 # ssh |
33 | ]; | 33 | ]; |
34 | }; | 34 | }; |
35 | |||
36 | networkmanager = { | ||
37 | enable = true; | ||
38 | }; | ||
35 | }; | 39 | }; |
36 | 40 | ||
37 | powerManagement.enable = true; | 41 | powerManagement.enable = true; |
@@ -50,8 +54,20 @@ | |||
50 | shadow | 54 | shadow |
51 | (callPackage ./custom/thinklight.nix { thinklight = "kbd_backlight"; }) | 55 | (callPackage ./custom/thinklight.nix { thinklight = "kbd_backlight"; }) |
52 | (callPackage ./utils/nix/rebuild-system.nix {}) | 56 | (callPackage ./utils/nix/rebuild-system.nix {}) |
57 | libmbim libqmi | ||
53 | ]; | 58 | ]; |
54 | 59 | ||
60 | nixpkgs.config.packageOverrides = pkgs: rec { | ||
61 | libmbim = pkgs.stdenv.lib.overrideDerivation pkgs.libmbim (attrs: { | ||
62 | patches = [ ./patches/attachment-0003.patch ./patches/attachment.patch ]; | ||
63 | buildInputs = attrs.buildInputs ++ [ pkgs.automake114x pkgs.autoconf ]; | ||
64 | }); | ||
65 | libqmi = pkgs.stdenv.lib.overrideDerivation pkgs.libqmi (attrs: { | ||
66 | patches = [ ./patches/attachment-0004.patch ./patches/attachment-0005.patch ]; | ||
67 | buildInputs = attrs.buildInputs ++ [ pkgs.automake pkgs.autoconf ]; | ||
68 | }); | ||
69 | }; | ||
70 | |||
55 | services = { | 71 | services = { |
56 | logind.extraConfig = '' | 72 | logind.extraConfig = '' |
57 | HandleLidSwitch=suspend | 73 | HandleLidSwitch=suspend |
@@ -107,8 +123,8 @@ | |||
107 | nodeName = "hel"; | 123 | nodeName = "hel"; |
108 | remoteNodes = ["isaac" "ymir"]; # legacy name for odin | 124 | remoteNodes = ["isaac" "ymir"]; # legacy name for odin |
109 | sshUser = { | 125 | sshUser = { |
110 | openssh.authorizedKeys.keys = [ ''no-port-forwarding,no-X11-forwarding,no-agent-forwarding,command="/var/setuid-wrappers/uucico" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEgtDHA7oDIaRwggGGznNaKZF68rFTziqefSCn1t9ZKe uucp@odin'' | 126 | openssh.authorizedKeys.keys = [ ''no-port-forwarding,no-X11-forwarding,no-agent-forwarding,command="/var/setuid-wrappers/uucico" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFH1QWdgoC03nzW5GBuCl2pqASHeIXIYtE9IInHdaKcO uucp@ymir'' |
111 | ''no-port-forwarding,no-X11-forwarding,no-agent-forwarding,command="/var/setuid-wrappers/uucico" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFH1QWdgoC03nzW5GBuCl2pqASHeIXIYtE9IInHdaKcO uucp@ymir'' | 127 | ''no-port-forwarding,no-X11-forwarding,no-agent-forwarding,command="/var/setuid-wrappers/uucico" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJhACtnt9+3j2ev4QVA2QBlPtblPnu7yol2njgfMlHtC uucp@odin'' |
112 | ]; | 128 | ]; |
113 | }; | 129 | }; |
114 | sshConfig = '' | 130 | sshConfig = '' |
@@ -119,8 +135,28 @@ | |||
119 | Hostname ymir.niflheim.yggdrasil | 135 | Hostname ymir.niflheim.yggdrasil |
120 | IdentityFile ~/.ssh/ymir | 136 | IdentityFile ~/.ssh/ymir |
121 | ''; | 137 | ''; |
122 | commandPath = []; | 138 | commandPath = [ "${pkgs.callPackage ./hel/recv-media.nix {}}/bin" ]; |
123 | defaultCommands = []; | 139 | defaultCommands = []; |
140 | commands = { | ||
141 | "isaac" = ["recv-media"]; | ||
142 | }; | ||
143 | }; | ||
144 | |||
145 | postfix = { | ||
146 | enable = true; | ||
147 | enableSmtp = false; | ||
148 | setSendmail = true; | ||
149 | networksStyle = "host"; | ||
150 | hostname = "hel.midgard.yggdrasil"; | ||
151 | destination = []; | ||
152 | relayHost = "uucp:ymir"; | ||
153 | recipientDelimiter = "+"; | ||
154 | transport = '' | ||
155 | * uucp:ymir | ||
156 | ''; | ||
157 | extraMasterConf = '' | ||
158 | uucp unix - n n - - pipe flags=Fqhu user=uucp argv=/var/setuid-wrappers/uux -z -a$sender - $nexthop!rmail ($recipient) | ||
159 | ''; | ||
124 | }; | 160 | }; |
125 | }; | 161 | }; |
126 | 162 | ||
@@ -134,6 +170,9 @@ | |||
134 | media = { | 170 | media = { |
135 | members = [ "gkleen" "uucp" ]; | 171 | members = [ "gkleen" "uucp" ]; |
136 | }; | 172 | }; |
173 | networkmanager = { | ||
174 | members = [ "gkleen" ]; | ||
175 | }; | ||
137 | }; | 176 | }; |
138 | }; | 177 | }; |
139 | 178 | ||
diff --git a/hel/recv-media.nix b/hel/recv-media.nix new file mode 100644 index 00000000..b61840ec --- /dev/null +++ b/hel/recv-media.nix | |||
@@ -0,0 +1,13 @@ | |||
1 | { stdenv, coreutils, writeScriptBin }: | ||
2 | |||
3 | writeScriptBin "recv-media" '' | ||
4 | #!${stdenv.shell} | ||
5 | |||
6 | [[ -z "$1" ]] && exit 2 | ||
7 | |||
8 | PATH=${coreutils}/bin | ||
9 | |||
10 | dir=/var/media | ||
11 | |||
12 | cp -l "$1" "''${dir}/$(basename "$1")" | ||
13 | '' | ||
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 @@ | |||
1 | From 9550bd568371995acca003d6250ba4535db7d59f Mon Sep 17 00:00:00 2001 | ||
2 | From: Emil Ljungdahl <emil.ljungdahl@wisi.se> | ||
3 | Date: Wed, 6 Apr 2016 19:25:27 +0200 | ||
4 | Subject: [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 | |||
15 | diff --git a/build-aux/mbim-codegen/Message.py b/build-aux/mbim-codegen/Message.py | ||
16 | index 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': | ||
45 | diff --git a/build-aux/mbim-codegen/Struct.py b/build-aux/mbim-codegen/Struct.py | ||
46 | index 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': | ||
73 | diff --git a/data/mbim-service-qmi.json b/data/mbim-service-qmi.json | ||
74 | index 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 | ] | ||
89 | diff --git a/src/libmbim-glib/mbim-message-private.h b/src/libmbim-glib/mbim-message-private.h | ||
90 | index 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, | ||
111 | diff --git a/src/libmbim-glib/mbim-message.c b/src/libmbim-glib/mbim-message.c | ||
112 | index 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 | -- | ||
157 | 1.9.1 | ||
158 | |||
diff --git a/patches/attachment-0003.patch b/patches/attachment-0003.patch new file mode 100644 index 00000000..35923a90 --- /dev/null +++ b/patches/attachment-0003.patch | |||
@@ -0,0 +1,446 @@ | |||
1 | >From 35f6f9c86c3dc66f2855b513e389a99bbcbb74c4 Mon Sep 17 00:00:00 2001 | ||
2 | From: Collin McMillan <cmc@nd.edu> | ||
3 | Date: Mon, 4 Apr 2016 11:33:46 +0200 | ||
4 | Subject: [PATCH] QMI via MBIM | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | Signed-off-by: Bjørn Mork <bjorn@mork.no> | ||
10 | --- | ||
11 | build-aux/mbim-codegen/Message.py | 8 ++++---- | ||
12 | build-aux/mbim-codegen/Struct.py | 8 ++++---- | ||
13 | data/Makefile.am | 3 ++- | ||
14 | src/libmbim-glib/generated/Makefile.am | 18 +++++++++++++++--- | ||
15 | src/libmbim-glib/libmbim-glib.h | 1 + | ||
16 | src/libmbim-glib/mbim-cid.c | 25 +++++++++++++++++++++---- | ||
17 | src/libmbim-glib/mbim-cid.h | 12 ++++++++++++ | ||
18 | src/libmbim-glib/mbim-message-private.h | 2 ++ | ||
19 | src/libmbim-glib/mbim-message.c | 31 +++++++++++++++++++------------ | ||
20 | src/libmbim-glib/mbim-uuid.c | 18 ++++++++++++++++-- | ||
21 | src/libmbim-glib/mbim-uuid.h | 11 +++++++++++ | ||
22 | 11 files changed, 107 insertions(+), 30 deletions(-) | ||
23 | |||
24 | diff --git a/build-aux/mbim-codegen/Message.py b/build-aux/mbim-codegen/Message.py | ||
25 | index aa4e7b7..e66335d 100644 | ||
26 | --- a/build-aux/mbim-codegen/Message.py | ||
27 | +++ b/build-aux/mbim-codegen/Message.py | ||
28 | @@ -394,13 +394,13 @@ class Message: | ||
29 | inner_template += (' {\n') | ||
30 | |||
31 | if field['format'] == 'byte-array': | ||
32 | - inner_template += (' _mbim_message_command_builder_append_byte_array (builder, FALSE, FALSE, ${field}, ${array_size});\n') | ||
33 | + inner_template += (' _mbim_message_command_builder_append_byte_array (builder, FALSE, FALSE, TRUE, ${field}, ${array_size});\n') | ||
34 | elif field['format'] == 'unsized-byte-array': | ||
35 | - inner_template += (' _mbim_message_command_builder_append_byte_array (builder, FALSE, FALSE, ${field}, ${field}_size);\n') | ||
36 | + inner_template += (' _mbim_message_command_builder_append_byte_array (builder, FALSE, FALSE, FALSE, ${field}, ${field}_size);\n') | ||
37 | elif field['format'] == 'ref-byte-array': | ||
38 | - inner_template += (' _mbim_message_command_builder_append_byte_array (builder, TRUE, TRUE, ${field}, ${field}_size);\n') | ||
39 | + inner_template += (' _mbim_message_command_builder_append_byte_array (builder, TRUE, TRUE, TRUE, ${field}, ${field}_size);\n') | ||
40 | elif field['format'] == 'ref-byte-array-no-offset': | ||
41 | - inner_template += (' _mbim_message_command_builder_append_byte_array (builder, FALSE, TRUE, ${field}, ${field}_size);\n') | ||
42 | + inner_template += (' _mbim_message_command_builder_append_byte_array (builder, FALSE, TRUE, TRUE, ${field}, ${field}_size);\n') | ||
43 | elif field['format'] == 'uuid': | ||
44 | inner_template += (' _mbim_message_command_builder_append_uuid (builder, ${field});\n') | ||
45 | elif field['format'] == 'guint32': | ||
46 | diff --git a/build-aux/mbim-codegen/Struct.py b/build-aux/mbim-codegen/Struct.py | ||
47 | index 495e22f..8797f3a 100644 | ||
48 | --- a/build-aux/mbim-codegen/Struct.py | ||
49 | +++ b/build-aux/mbim-codegen/Struct.py | ||
50 | @@ -498,14 +498,14 @@ class Struct: | ||
51 | if field['format'] == 'uuid': | ||
52 | inner_template = (' _mbim_struct_builder_append_uuid (builder, &(value->${field}));\n') | ||
53 | elif field['format'] == 'byte-array': | ||
54 | - inner_template = (' _mbim_struct_builder_append_byte_array (builder, FALSE, FALSE, value->${field}, ${array_size});\n') | ||
55 | + inner_template = (' _mbim_struct_builder_append_byte_array (builder, FALSE, FALSE, TRUE, value->${field}, ${array_size});\n') | ||
56 | elif field['format'] == 'unsized-byte-array': | ||
57 | - inner_template = (' _mbim_struct_builder_append_byte_array (builder, FALSE, FALSE, value->${field}, value->${field}_size);\n') | ||
58 | + inner_template = (' _mbim_struct_builder_append_byte_array (builder, FALSE, FALSE, FALSE, value->${field}, value->${field}_size);\n') | ||
59 | elif field['format'] == 'ref-byte-array': | ||
60 | if 'array-size-field' in field: | ||
61 | - inner_template = (' _mbim_struct_builder_append_byte_array (builder, TRUE, FALSE, value->${field}, value->${array_size_field});\n') | ||
62 | + inner_template = (' _mbim_struct_builder_append_byte_array (builder, TRUE, FALSE, TRUE, value->${field}, value->${array_size_field});\n') | ||
63 | else: | ||
64 | - inner_template = (' _mbim_struct_builder_append_byte_array (builder, TRUE, TRUE, value->${field}, value->${field}_size);\n') | ||
65 | + inner_template = (' _mbim_struct_builder_append_byte_array (builder, TRUE, TRUE, TRUE, value->${field}, value->${field}_size);\n') | ||
66 | elif field['format'] == 'guint32': | ||
67 | inner_template = (' _mbim_struct_builder_append_guint32 (builder, value->${field});\n') | ||
68 | elif field['format'] == 'guint32-array': | ||
69 | diff --git a/data/Makefile.am b/data/Makefile.am | ||
70 | index 111e028..8c8891a 100644 | ||
71 | --- a/data/Makefile.am | ||
72 | +++ b/data/Makefile.am | ||
73 | @@ -10,4 +10,5 @@ EXTRA_DIST = \ | ||
74 | mbim-service-dss.json \ | ||
75 | mbim-service-ms-firmware-id.json \ | ||
76 | mbim-service-ms-host-shutdown.json \ | ||
77 | - mbim-service-proxy-control.json | ||
78 | + mbim-service-proxy-control.json \ | ||
79 | + mbim-service-qmi.json | ||
80 | diff --git a/src/libmbim-glib/generated/Makefile.am b/src/libmbim-glib/generated/Makefile.am | ||
81 | index ce81a71..c8b153a 100644 | ||
82 | --- a/src/libmbim-glib/generated/Makefile.am | ||
83 | +++ b/src/libmbim-glib/generated/Makefile.am | ||
84 | @@ -12,7 +12,8 @@ GENERATED_H = \ | ||
85 | mbim-dss.h \ | ||
86 | mbim-ms-firmware-id.h \ | ||
87 | mbim-ms-host-shutdown.h \ | ||
88 | - mbim-proxy-control.h | ||
89 | + mbim-proxy-control.h \ | ||
90 | + mbim-qmi.h | ||
91 | |||
92 | GENERATED_C = \ | ||
93 | mbim-error-types.c \ | ||
94 | @@ -27,7 +28,8 @@ GENERATED_C = \ | ||
95 | mbim-dss.c \ | ||
96 | mbim-ms-firmware-id.c \ | ||
97 | mbim-ms-host-shutdown.c \ | ||
98 | - mbim-proxy-control.c | ||
99 | + mbim-proxy-control.c \ | ||
100 | + mbim-qmi.c | ||
101 | |||
102 | GENERATED_SECTIONS = \ | ||
103 | mbim-basic-connect.sections \ | ||
104 | @@ -39,7 +41,8 @@ GENERATED_SECTIONS = \ | ||
105 | mbim-dss.sections \ | ||
106 | mbim-ms-firmware-id.sections \ | ||
107 | mbim-ms-host-shutdown.sections \ | ||
108 | - mbim-proxy-control.sections | ||
109 | + mbim-proxy-control.sections \ | ||
110 | + mbim-qmi.sections | ||
111 | |||
112 | # Error types | ||
113 | mbim-error-types.h: $(top_srcdir)/src/libmbim-glib/mbim-errors.h $(top_srcdir)/build-aux/templates/mbim-error-types-template.h | ||
114 | @@ -170,6 +173,15 @@ mbim-proxy-control.h mbim-proxy-control.c mbim-proxy-control.sections: $(top_src | ||
115 | --input $(top_srcdir)/data/mbim-service-proxy-control.json \ | ||
116 | --output mbim-proxy-control | ||
117 | |||
118 | +# QMI-over-MBIM service | ||
119 | +mbim-qmi.h mbim-qmi.c mbim-qmi.sections: $(top_srcdir)/data/mbim-service-qmi.json $(top_srcdir)/build-aux/mbim-codegen/*.py $(top_srcdir)/build-aux/mbim-codegen/mbim-codegen | ||
120 | + $(AM_V_GEN) \ | ||
121 | + rm -f mbim-qmi.h && \ | ||
122 | + rm -f mbim-qmi.c && \ | ||
123 | + $(top_srcdir)/build-aux/mbim-codegen/mbim-codegen \ | ||
124 | + --input $(top_srcdir)/data/mbim-service-qmi.json \ | ||
125 | + --output mbim-qmi | ||
126 | + | ||
127 | BUILT_SOURCES = $(GENERATED_H) $(GENERATED_C) | ||
128 | |||
129 | nodist_libmbim_glib_generated_la_SOURCES = \ | ||
130 | diff --git a/src/libmbim-glib/libmbim-glib.h b/src/libmbim-glib/libmbim-glib.h | ||
131 | index b41122b..88d0be8 100644 | ||
132 | --- a/src/libmbim-glib/libmbim-glib.h | ||
133 | +++ b/src/libmbim-glib/libmbim-glib.h | ||
134 | @@ -48,6 +48,7 @@ | ||
135 | #include "mbim-dss.h" | ||
136 | #include "mbim-ms-firmware-id.h" | ||
137 | #include "mbim-ms-host-shutdown.h" | ||
138 | +#include "mbim-qmi.h" | ||
139 | |||
140 | /* backwards compatibility */ | ||
141 | #include "mbim-compat.h" | ||
142 | diff --git a/src/libmbim-glib/mbim-cid.c b/src/libmbim-glib/mbim-cid.c | ||
143 | index 50dc4f1..cbfd81e 100644 | ||
144 | --- a/src/libmbim-glib/mbim-cid.c | ||
145 | +++ b/src/libmbim-glib/mbim-cid.c | ||
146 | @@ -38,6 +38,9 @@ typedef struct { | ||
147 | gboolean notify; | ||
148 | } CidConfig; | ||
149 | |||
150 | +/* Note: MBIM_SERVICE_LAST from mbim-uuid.c should probably be visible | ||
151 | + * here somehow, since MBIM_SERVICE_QMI must be used in the error checks */ | ||
152 | + | ||
153 | /* Note: index of the array is CID-1 */ | ||
154 | #define MBIM_CID_BASIC_CONNECT_LAST MBIM_CID_BASIC_CONNECT_MULTICARRIER_PROVIDERS | ||
155 | static const CidConfig cid_basic_connect_config [MBIM_CID_BASIC_CONNECT_LAST] = { | ||
156 | @@ -132,6 +135,12 @@ static const CidConfig cid_proxy_control_config [MBIM_CID_PROXY_CONTROL_LAST] = | ||
157 | { TRUE, FALSE, FALSE }, /* MBIM_CID_PROXY_CONTROL_CONFIGURATION */ | ||
158 | }; | ||
159 | |||
160 | +/* Note: index of the array is CID-1 */ | ||
161 | +#define MBIM_CID_QMI_LAST MBIM_CID_QMI_MSG | ||
162 | +static const CidConfig cid_qmi_config [MBIM_CID_QMI_LAST] = { | ||
163 | + { TRUE, FALSE, FALSE }, /* MBIM_CID_QMI_MSG */ | ||
164 | +}; | ||
165 | + | ||
166 | /** | ||
167 | * mbim_cid_can_set: | ||
168 | * @service: a #MbimService. | ||
169 | @@ -149,7 +158,7 @@ mbim_cid_can_set (MbimService service, | ||
170 | g_return_val_if_fail (cid > 0, FALSE); | ||
171 | /* Known service required */ | ||
172 | g_return_val_if_fail (service > MBIM_SERVICE_INVALID, FALSE); | ||
173 | - g_return_val_if_fail (service <= MBIM_SERVICE_PROXY_CONTROL, FALSE); | ||
174 | + g_return_val_if_fail (service <= MBIM_SERVICE_QMI, FALSE); | ||
175 | |||
176 | switch (service) { | ||
177 | case MBIM_SERVICE_BASIC_CONNECT: | ||
178 | @@ -172,6 +181,8 @@ mbim_cid_can_set (MbimService service, | ||
179 | return cid_ms_host_shutdown_config[cid - 1].set; | ||
180 | case MBIM_SERVICE_PROXY_CONTROL: | ||
181 | return cid_proxy_control_config[cid - 1].set; | ||
182 | + case MBIM_SERVICE_QMI: | ||
183 | + return cid_qmi_config[cid - 1].set; | ||
184 | default: | ||
185 | g_assert_not_reached (); | ||
186 | return FALSE; | ||
187 | @@ -195,7 +206,7 @@ mbim_cid_can_query (MbimService service, | ||
188 | g_return_val_if_fail (cid > 0, FALSE); | ||
189 | /* Known service required */ | ||
190 | g_return_val_if_fail (service > MBIM_SERVICE_INVALID, FALSE); | ||
191 | - g_return_val_if_fail (service <= MBIM_SERVICE_PROXY_CONTROL, FALSE); | ||
192 | + g_return_val_if_fail (service <= MBIM_SERVICE_QMI, FALSE); | ||
193 | |||
194 | switch (service) { | ||
195 | case MBIM_SERVICE_BASIC_CONNECT: | ||
196 | @@ -218,6 +229,8 @@ mbim_cid_can_query (MbimService service, | ||
197 | return cid_ms_host_shutdown_config[cid - 1].query; | ||
198 | case MBIM_SERVICE_PROXY_CONTROL: | ||
199 | return cid_proxy_control_config[cid - 1].query; | ||
200 | + case MBIM_SERVICE_QMI: | ||
201 | + return cid_qmi_config[cid - 1].query; | ||
202 | default: | ||
203 | g_assert_not_reached (); | ||
204 | return FALSE; | ||
205 | @@ -241,7 +254,7 @@ mbim_cid_can_notify (MbimService service, | ||
206 | g_return_val_if_fail (cid > 0, FALSE); | ||
207 | /* Known service required */ | ||
208 | g_return_val_if_fail (service > MBIM_SERVICE_INVALID, FALSE); | ||
209 | - g_return_val_if_fail (service <= MBIM_SERVICE_PROXY_CONTROL, FALSE); | ||
210 | + g_return_val_if_fail (service <= MBIM_SERVICE_QMI, FALSE); | ||
211 | |||
212 | switch (service) { | ||
213 | case MBIM_SERVICE_BASIC_CONNECT: | ||
214 | @@ -264,6 +277,8 @@ mbim_cid_can_notify (MbimService service, | ||
215 | return cid_ms_host_shutdown_config[cid - 1].notify; | ||
216 | case MBIM_SERVICE_PROXY_CONTROL: | ||
217 | return cid_proxy_control_config[cid - 1].notify; | ||
218 | + case MBIM_SERVICE_QMI: | ||
219 | + return cid_qmi_config[cid - 1].notify; | ||
220 | default: | ||
221 | g_assert_not_reached (); | ||
222 | return FALSE; | ||
223 | @@ -288,7 +303,7 @@ mbim_cid_get_printable (MbimService service, | ||
224 | g_return_val_if_fail (cid > 0, NULL); | ||
225 | /* Known service required */ | ||
226 | g_return_val_if_fail (service > MBIM_SERVICE_INVALID, NULL); | ||
227 | - g_return_val_if_fail (service <= MBIM_SERVICE_PROXY_CONTROL, NULL); | ||
228 | + g_return_val_if_fail (service <= MBIM_SERVICE_QMI, NULL); | ||
229 | |||
230 | switch (service) { | ||
231 | case MBIM_SERVICE_BASIC_CONNECT: | ||
232 | @@ -311,6 +326,8 @@ mbim_cid_get_printable (MbimService service, | ||
233 | return mbim_cid_ms_host_shutdown_get_string (cid); | ||
234 | case MBIM_SERVICE_PROXY_CONTROL: | ||
235 | return mbim_cid_proxy_control_get_string (cid); | ||
236 | + case MBIM_SERVICE_QMI: | ||
237 | + return mbim_cid_qmi_get_string (cid); | ||
238 | default: | ||
239 | g_assert_not_reached (); | ||
240 | return FALSE; | ||
241 | diff --git a/src/libmbim-glib/mbim-cid.h b/src/libmbim-glib/mbim-cid.h | ||
242 | index 3315340..36930cd 100644 | ||
243 | --- a/src/libmbim-glib/mbim-cid.h | ||
244 | +++ b/src/libmbim-glib/mbim-cid.h | ||
245 | @@ -219,6 +219,18 @@ typedef enum { | ||
246 | MBIM_CID_PROXY_CONTROL_CONFIGURATION = 1 | ||
247 | } MbimCidProxyControl; | ||
248 | |||
249 | +/** | ||
250 | + * MbimCidQmi: | ||
251 | + * @MBIM_CID_QMI_UNKNOWN: Unknown command. | ||
252 | + * @MBIM_CID_QMI_MSG: Configuration. | ||
253 | + * | ||
254 | + * MBIM commands in the %MBIM_SERVICE_QMI service. | ||
255 | + */ | ||
256 | +typedef enum { | ||
257 | + MBIM_CID_QMI_UNKNOWN = 0, | ||
258 | + MBIM_CID_QMI_MSG = 1 | ||
259 | +} MbimCidQmi; | ||
260 | + | ||
261 | /* Command helpers */ | ||
262 | |||
263 | gboolean mbim_cid_can_set (MbimService service, | ||
264 | diff --git a/src/libmbim-glib/mbim-message-private.h b/src/libmbim-glib/mbim-message-private.h | ||
265 | index b5606e0..0459d00 100644 | ||
266 | --- a/src/libmbim-glib/mbim-message-private.h | ||
267 | +++ b/src/libmbim-glib/mbim-message-private.h | ||
268 | @@ -177,6 +177,7 @@ GByteArray *_mbim_struct_builder_complete (MbimStructBuilder | ||
269 | void _mbim_struct_builder_append_byte_array (MbimStructBuilder *builder, | ||
270 | gboolean with_offset, | ||
271 | gboolean with_length, | ||
272 | + gboolean permit_padding, | ||
273 | const guint8 *buffer, | ||
274 | guint32 buffer_len); | ||
275 | void _mbim_struct_builder_append_uuid (MbimStructBuilder *builder, | ||
276 | @@ -225,6 +226,7 @@ MbimMessage *_mbim_message_command_builder_complete (M | ||
277 | void _mbim_message_command_builder_append_byte_array (MbimMessageCommandBuilder *builder, | ||
278 | gboolean with_offset, | ||
279 | gboolean with_length, | ||
280 | + gboolean permit_padding, | ||
281 | const guint8 *buffer, | ||
282 | guint32 buffer_len); | ||
283 | void _mbim_message_command_builder_append_uuid (MbimMessageCommandBuilder *builder, | ||
284 | diff --git a/src/libmbim-glib/mbim-message.c b/src/libmbim-glib/mbim-message.c | ||
285 | index b625ee5..7ab28f0 100644 | ||
286 | --- a/src/libmbim-glib/mbim-message.c | ||
287 | +++ b/src/libmbim-glib/mbim-message.c | ||
288 | @@ -492,6 +492,7 @@ void | ||
289 | _mbim_struct_builder_append_byte_array (MbimStructBuilder *builder, | ||
290 | gboolean with_offset, | ||
291 | gboolean with_length, | ||
292 | + gboolean permit_padding, | ||
293 | const guint8 *buffer, | ||
294 | guint32 buffer_len) | ||
295 | { | ||
296 | @@ -501,12 +502,14 @@ _mbim_struct_builder_append_byte_array (MbimStructBuilder *builder, | ||
297 | */ | ||
298 | if (!with_offset && !with_length) { | ||
299 | g_byte_array_append (builder->fixed_buffer, buffer, buffer_len); | ||
300 | - while (buffer_len % 4 != 0) { | ||
301 | - const guint8 padding = 0; | ||
302 | - | ||
303 | - g_byte_array_append (builder->fixed_buffer, &padding, 1); | ||
304 | - buffer_len++; | ||
305 | - } | ||
306 | + if(permit_padding) { | ||
307 | + while (buffer_len % 4 != 0) { | ||
308 | + const guint8 padding = 0; | ||
309 | + | ||
310 | + g_byte_array_append (builder->fixed_buffer, &padding, 1); | ||
311 | + buffer_len++; | ||
312 | + } | ||
313 | + } | ||
314 | return; | ||
315 | } | ||
316 | |||
317 | @@ -550,12 +553,15 @@ _mbim_struct_builder_append_byte_array (MbimStructBuilder *builder, | ||
318 | if (buffer_len) { | ||
319 | g_byte_array_append (builder->variable_buffer, (const guint8 *)buffer, (guint)buffer_len); | ||
320 | |||
321 | - while (buffer_len % 4 != 0) { | ||
322 | - const guint8 padding = 0; | ||
323 | + /* Note: adding zero padding causes trouble for QMI service */ | ||
324 | + if(permit_padding) { | ||
325 | + while (buffer_len % 4 != 0) { | ||
326 | + const guint8 padding = 0; | ||
327 | |||
328 | - g_byte_array_append (builder->variable_buffer, &padding, 1); | ||
329 | - buffer_len++; | ||
330 | - } | ||
331 | + g_byte_array_append (builder->variable_buffer, &padding, 1); | ||
332 | + buffer_len++; | ||
333 | + } | ||
334 | + } | ||
335 | } | ||
336 | } | ||
337 | |||
338 | @@ -824,10 +830,11 @@ void | ||
339 | _mbim_message_command_builder_append_byte_array (MbimMessageCommandBuilder *builder, | ||
340 | gboolean with_offset, | ||
341 | gboolean with_length, | ||
342 | + gboolean permit_padding, | ||
343 | const guint8 *buffer, | ||
344 | guint32 buffer_len) | ||
345 | { | ||
346 | - _mbim_struct_builder_append_byte_array (builder->contents_builder, with_offset, with_length, buffer, buffer_len); | ||
347 | + _mbim_struct_builder_append_byte_array (builder->contents_builder, with_offset, with_length, permit_padding, buffer, buffer_len); | ||
348 | } | ||
349 | |||
350 | void | ||
351 | diff --git a/src/libmbim-glib/mbim-uuid.c b/src/libmbim-glib/mbim-uuid.c | ||
352 | index 6497645..cdc9ba3 100644 | ||
353 | --- a/src/libmbim-glib/mbim-uuid.c | ||
354 | +++ b/src/libmbim-glib/mbim-uuid.c | ||
355 | @@ -38,7 +38,7 @@ | ||
356 | * This section defines the data type for unique identifiers. | ||
357 | */ | ||
358 | |||
359 | -#define MBIM_SERVICE_LAST MBIM_SERVICE_PROXY_CONTROL | ||
360 | +#define MBIM_SERVICE_LAST MBIM_SERVICE_QMI | ||
361 | |||
362 | /*****************************************************************************/ | ||
363 | |||
364 | @@ -229,6 +229,15 @@ static const MbimUuid uuid_proxy_control = { | ||
365 | .e = { 0xd7, 0x1d , 0xbe, 0xfb, 0xb3, 0x9b } | ||
366 | }; | ||
367 | |||
368 | +/* Note: this UUID is likely to work only for Sierra modems */ | ||
369 | +static const MbimUuid uuid_qmi = { | ||
370 | + .a = { 0xd1, 0xa3, 0x0b, 0xc2 }, | ||
371 | + .b = { 0xf9, 0x7a }, | ||
372 | + .c = { 0x6e, 0x43 }, | ||
373 | + .d = { 0xbf, 0x65 }, | ||
374 | + .e = { 0xc7, 0xe2 , 0x4f, 0xb0, 0xf0, 0xd3 } | ||
375 | +}; | ||
376 | + | ||
377 | static GList *mbim_custom_service_list = NULL; | ||
378 | |||
379 | typedef struct { | ||
380 | @@ -367,7 +376,7 @@ mbim_uuid_from_service (MbimService service) | ||
381 | GList *l; | ||
382 | |||
383 | g_return_val_if_fail (service >= MBIM_SERVICE_INVALID && | ||
384 | - (service <= MBIM_SERVICE_PROXY_CONTROL || | ||
385 | + (service <= MBIM_SERVICE_LAST || | ||
386 | mbim_service_id_is_custom (service)), | ||
387 | &uuid_invalid); | ||
388 | |||
389 | @@ -394,6 +403,8 @@ mbim_uuid_from_service (MbimService service) | ||
390 | return &uuid_ms_host_shutdown; | ||
391 | case MBIM_SERVICE_PROXY_CONTROL: | ||
392 | return &uuid_proxy_control; | ||
393 | + case MBIM_SERVICE_QMI: | ||
394 | + return &uuid_qmi; | ||
395 | default: | ||
396 | for (l = mbim_custom_service_list; l != NULL; l = l->next) { | ||
397 | if (service == ((MbimCustomService *)l->data)->service_id) | ||
398 | @@ -446,6 +457,9 @@ mbim_uuid_to_service (const MbimUuid *uuid) | ||
399 | if (mbim_uuid_cmp (uuid, &uuid_proxy_control)) | ||
400 | return MBIM_SERVICE_PROXY_CONTROL; | ||
401 | |||
402 | + if (mbim_uuid_cmp (uuid, &uuid_qmi)) | ||
403 | + return MBIM_SERVICE_QMI; | ||
404 | + | ||
405 | for (l = mbim_custom_service_list; l != NULL; l = l->next) { | ||
406 | if (mbim_uuid_cmp (&((MbimCustomService *)l->data)->uuid, uuid)) | ||
407 | return ((MbimCustomService *)l->data)->service_id; | ||
408 | diff --git a/src/libmbim-glib/mbim-uuid.h b/src/libmbim-glib/mbim-uuid.h | ||
409 | index 91def98..d42a256 100644 | ||
410 | --- a/src/libmbim-glib/mbim-uuid.h | ||
411 | +++ b/src/libmbim-glib/mbim-uuid.h | ||
412 | @@ -71,6 +71,7 @@ gboolean mbim_uuid_from_printable (const gchar *str, | ||
413 | * @MBIM_SERVICE_MS_FIRMWARE_ID: Microsoft Firmware ID service. | ||
414 | * @MBIM_SERVICE_MS_HOST_SHUTDOWN: Microsoft Host Shutdown service. | ||
415 | * @MBIM_SERVICE_PROXY_CONTROL: Proxy Control service. | ||
416 | + * @MBIM_SERVICE_QMI: QMI-over-MBIM service. | ||
417 | * | ||
418 | * Enumeration of the generic MBIM services. | ||
419 | */ | ||
420 | @@ -86,6 +87,7 @@ typedef enum { | ||
421 | MBIM_SERVICE_MS_FIRMWARE_ID = 8, | ||
422 | MBIM_SERVICE_MS_HOST_SHUTDOWN = 9, | ||
423 | MBIM_SERVICE_PROXY_CONTROL = 10, | ||
424 | + MBIM_SERVICE_QMI = 11 | ||
425 | /* Note: update MBIM_SERVICE_LAST when a new value is added */ | ||
426 | } MbimService; | ||
427 | |||
428 | @@ -188,6 +190,15 @@ typedef enum { | ||
429 | */ | ||
430 | #define MBIM_UUID_PROXY_CONTROL mbim_uuid_from_service (MBIM_SERVICE_PROXY_CONTROL) | ||
431 | |||
432 | +/** | ||
433 | + * MBIM_UUID_QMI: | ||
434 | + * | ||
435 | + * Get the UUID of the %MBIM_SERVICE_QMI service. | ||
436 | + * | ||
437 | + * Returns: (transfer none): a #MbimUuid. | ||
438 | + */ | ||
439 | +#define MBIM_UUID_QMI mbim_uuid_from_service (MBIM_SERVICE_QMI) | ||
440 | + | ||
441 | const gchar *mbim_service_lookup_name (guint service); | ||
442 | |||
443 | guint mbim_register_custom_service (const MbimUuid *uuid, | ||
444 | -- | ||
445 | 2.1.4 | ||
446 | |||
diff --git a/patches/attachment-0004.patch b/patches/attachment-0004.patch new file mode 100644 index 00000000..b1110feb --- /dev/null +++ b/patches/attachment-0004.patch | |||
@@ -0,0 +1,329 @@ | |||
1 | >From 4ffa5693bcaf283bc3c8ea7808226eb6e92aaaf5 Mon Sep 17 00:00:00 2001 | ||
2 | From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <bjorn@mork.no> | ||
3 | Date: Mon, 4 Apr 2016 14:44:01 +0200 | ||
4 | Subject: [PATCH 1/2] libqmi: support MBIM EXT_QMUX service | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | Signed-off-by: Bjørn Mork <bjorn@mork.no> | ||
10 | --- | ||
11 | configure.ac | 13 ++++ | ||
12 | src/libqmi-glib/Makefile.am | 4 +- | ||
13 | src/libqmi-glib/qmi-device.c | 156 ++++++++++++++++++++++++++++++++++++++++++- | ||
14 | src/libqmi-glib/qmi-device.h | 4 +- | ||
15 | 4 files changed, 172 insertions(+), 5 deletions(-) | ||
16 | |||
17 | diff --git a/configure.ac b/configure.ac | ||
18 | index 3e05993..fe6225e 100644 | ||
19 | --- a/configure.ac | ||
20 | +++ b/configure.ac | ||
21 | @@ -95,6 +95,18 @@ fi | ||
22 | |||
23 | AM_CONDITIONAL([QMI_USERNAME_ENABLED], [test "x$QMI_USERNAME_ENABLED" = "xyes"]) | ||
24 | |||
25 | +# MBIM QMUX service support | ||
26 | +AC_ARG_ENABLE(mbim-qmux, | ||
27 | + AS_HELP_STRING([--enable-mbim-qmux], [support QMI over MBIM QMUX service])) | ||
28 | +if test -n "$enable_mbim_qmux"; then | ||
29 | + PKG_CHECK_MODULES(MBIM, mbim-glib >= 1.13) | ||
30 | + MBIM_CFLAGS="$MBIM_CFLAGS -DMBIM_QMUX" | ||
31 | + AC_SUBST(MBIM_CFLAGS) | ||
32 | + AC_SUBST(MBIM_LIBS) | ||
33 | +fi | ||
34 | + | ||
35 | +AM_CONDITIONAL(MBIM_QMUX, [test -n "$MBIM_CFLAGS"]) | ||
36 | + | ||
37 | # udev base directory | ||
38 | AC_ARG_WITH(udev-base-dir, AS_HELP_STRING([--with-udev-base-dir=DIR], [where udev base directory is])) | ||
39 | if test -n "$with_udev_base_dir" ; then | ||
40 | @@ -146,4 +158,5 @@ echo " | ||
41 | udev base directory: ${UDEV_BASE_DIR} | ||
42 | Documentation: ${enable_gtk_doc} | ||
43 | QMI username: ${QMI_USERNAME_ENABLED} (${QMI_USERNAME}) | ||
44 | + QMUX over MBIM: ${enable_mbim_qmux} | ||
45 | " | ||
46 | diff --git a/src/libqmi-glib/Makefile.am b/src/libqmi-glib/Makefile.am | ||
47 | index b24e3ae..6ff4e66 100644 | ||
48 | --- a/src/libqmi-glib/Makefile.am | ||
49 | +++ b/src/libqmi-glib/Makefile.am | ||
50 | @@ -5,6 +5,7 @@ lib_LTLIBRARIES = libqmi-glib.la | ||
51 | |||
52 | libqmi_glib_la_CPPFLAGS = \ | ||
53 | $(GLIB_CFLAGS) \ | ||
54 | + $(MBIM_CFLAGS) \ | ||
55 | -I$(top_srcdir) \ | ||
56 | -I$(top_builddir) \ | ||
57 | -I$(top_srcdir)/src/libqmi-glib \ | ||
58 | @@ -39,7 +40,8 @@ libqmi_glib_la_SOURCES = \ | ||
59 | |||
60 | libqmi_glib_la_LIBADD = \ | ||
61 | ${top_builddir}/src/libqmi-glib/generated/libqmi-glib-generated.la \ | ||
62 | - $(GLIB_LIBS) | ||
63 | + $(GLIB_LIBS) \ | ||
64 | + $(MBIM_LIBS) | ||
65 | |||
66 | libqmi_glib_la_LDFLAGS = \ | ||
67 | -version-info $(QMI_GLIB_LT_CURRENT):$(QMI_GLIB_LT_REVISION):$(QMI_GLIB_LT_AGE) | ||
68 | diff --git a/src/libqmi-glib/qmi-device.c b/src/libqmi-glib/qmi-device.c | ||
69 | index c4abbbc..6c46bca 100644 | ||
70 | --- a/src/libqmi-glib/qmi-device.c | ||
71 | +++ b/src/libqmi-glib/qmi-device.c | ||
72 | @@ -32,6 +32,10 @@ | ||
73 | #include <gio/gunixoutputstream.h> | ||
74 | #include <gio/gunixsocketaddress.h> | ||
75 | |||
76 | +#ifdef MBIM_QMUX | ||
77 | +#include <libmbim-glib.h> | ||
78 | +#endif | ||
79 | + | ||
80 | #include "qmi-device.h" | ||
81 | #include "qmi-message.h" | ||
82 | #include "qmi-ctl.h" | ||
83 | @@ -92,6 +96,10 @@ struct _QmiDevicePrivate { | ||
84 | gchar *path_display; | ||
85 | gboolean no_file_check; | ||
86 | gchar *proxy_path; | ||
87 | + gboolean mbim_qmux; | ||
88 | +#ifdef MBIM_QMUX | ||
89 | + MbimDevice *mbimdev; | ||
90 | +#endif | ||
91 | |||
92 | /* WWAN interface */ | ||
93 | gboolean no_wwan_check; | ||
94 | @@ -1689,7 +1697,6 @@ input_ready_cb (GInputStream *istream, | ||
95 | self->priv->buffer = g_byte_array_sized_new (r); | ||
96 | g_byte_array_append (self->priv->buffer, buffer, r); | ||
97 | |||
98 | - /* Try to parse input messages */ | ||
99 | parse_response (self); | ||
100 | |||
101 | return TRUE; | ||
102 | @@ -2134,6 +2141,56 @@ internal_proxy_open_ready (QmiClientCtl *client_ctl, | ||
103 | device_open_context_step (ctx); | ||
104 | } | ||
105 | |||
106 | +#ifdef MBIM_QMUX | ||
107 | +static void | ||
108 | +mbim_device_open_ready (MbimDevice *dev, | ||
109 | + GAsyncResult *res, | ||
110 | + DeviceOpenContext *ctx) | ||
111 | +{ | ||
112 | + GError *error = NULL; | ||
113 | + | ||
114 | + if (!mbim_device_open_finish (dev, res, &error)) { | ||
115 | + g_simple_async_result_take_error (ctx->result, error); | ||
116 | + device_open_context_complete_and_free (ctx); | ||
117 | + return; | ||
118 | + } | ||
119 | + g_debug ("[%s] MBIM device Open..", | ||
120 | + ctx->self->priv->path_display); | ||
121 | + | ||
122 | + /* Go on */ | ||
123 | + ctx->step++; | ||
124 | + device_open_context_step (ctx); | ||
125 | + return; | ||
126 | +} | ||
127 | + | ||
128 | +static void | ||
129 | +mbim_device_new_ready (GObject *source, | ||
130 | + GAsyncResult *res, | ||
131 | + DeviceOpenContext *ctx) | ||
132 | +{ | ||
133 | + MbimDeviceOpenFlags open_flags = MBIM_DEVICE_OPEN_FLAGS_NONE; | ||
134 | + GError *error = NULL; | ||
135 | + MbimDevice *device; | ||
136 | + | ||
137 | + if (ctx->flags & QMI_DEVICE_OPEN_FLAGS_PROXY) | ||
138 | + open_flags |= MBIM_DEVICE_OPEN_FLAGS_PROXY; | ||
139 | + device = mbim_device_new_finish (res, &error); | ||
140 | + if (!device) { | ||
141 | + g_simple_async_result_take_error (ctx->result, error); | ||
142 | + device_open_context_complete_and_free (ctx); | ||
143 | + return; | ||
144 | + } | ||
145 | + ctx->self->priv->mbimdev = device; | ||
146 | + | ||
147 | + mbim_device_open_full(device, | ||
148 | + open_flags, | ||
149 | + 30, | ||
150 | + ctx->cancellable, | ||
151 | + (GAsyncReadyCallback)mbim_device_open_ready, | ||
152 | + ctx); | ||
153 | +} | ||
154 | +#endif | ||
155 | + | ||
156 | static void | ||
157 | create_iostream_ready (QmiDevice *self, | ||
158 | GAsyncResult *res, | ||
159 | @@ -2166,6 +2223,20 @@ device_open_context_step (DeviceOpenContext *ctx) | ||
160 | /* Fall down */ | ||
161 | |||
162 | case DEVICE_OPEN_CONTEXT_STEP_CREATE_IOSTREAM: | ||
163 | +#ifdef MBIM_QMUX | ||
164 | + if (ctx->flags & QMI_DEVICE_OPEN_FLAGS_MBIM) { | ||
165 | + GFile *file; | ||
166 | + | ||
167 | + ctx->self->priv->mbim_qmux = TRUE; | ||
168 | + file = g_file_new_for_path (ctx->self->priv->path); | ||
169 | + mbim_device_new (file, | ||
170 | + ctx->cancellable, | ||
171 | + (GAsyncReadyCallback)mbim_device_new_ready, | ||
172 | + ctx); | ||
173 | + g_object_unref (file); | ||
174 | + return; | ||
175 | + } | ||
176 | +#endif | ||
177 | create_iostream (ctx->self, | ||
178 | !!(ctx->flags & QMI_DEVICE_OPEN_FLAGS_PROXY), | ||
179 | (GAsyncReadyCallback)create_iostream_ready, | ||
180 | @@ -2174,7 +2245,8 @@ device_open_context_step (DeviceOpenContext *ctx) | ||
181 | |||
182 | case DEVICE_OPEN_CONTEXT_STEP_FLAGS_PROXY: | ||
183 | /* Initialize communication with proxy? */ | ||
184 | - if (ctx->flags & QMI_DEVICE_OPEN_FLAGS_PROXY) { | ||
185 | + if (ctx->flags & QMI_DEVICE_OPEN_FLAGS_PROXY && | ||
186 | + !(ctx->flags & QMI_DEVICE_OPEN_FLAGS_MBIM)) { | ||
187 | QmiMessageCtlInternalProxyOpenInput *input; | ||
188 | |||
189 | input = qmi_message_ctl_internal_proxy_open_input_new (); | ||
190 | @@ -2369,6 +2441,21 @@ destroy_iostream (QmiDevice *self, | ||
191 | return TRUE; | ||
192 | } | ||
193 | |||
194 | +#ifdef MBIM_QMUX | ||
195 | +static void | ||
196 | +mbim_device_close_ready (MbimDevice *dev, | ||
197 | + GAsyncResult *res) | ||
198 | +{ | ||
199 | + GError *error = NULL; | ||
200 | + | ||
201 | + if (!mbim_device_close_finish (dev, res, &error)) { | ||
202 | + g_printerr ("error: couldn't close device: %s", error->message); | ||
203 | + g_error_free (error); | ||
204 | + } else | ||
205 | + g_debug ("Device closed"); | ||
206 | +} | ||
207 | +#endif | ||
208 | + | ||
209 | /** | ||
210 | * qmi_device_close: | ||
211 | * @self: a #QmiDevice | ||
212 | @@ -2386,6 +2473,15 @@ qmi_device_close (QmiDevice *self, | ||
213 | { | ||
214 | g_return_val_if_fail (QMI_IS_DEVICE (self), FALSE); | ||
215 | |||
216 | +#ifdef MBIM_QMUX | ||
217 | + if (self->priv->mbim_qmux) | ||
218 | + mbim_device_close (self->priv->mbimdev, | ||
219 | + 15, | ||
220 | + NULL, | ||
221 | + (GAsyncReadyCallback) mbim_device_close_ready, | ||
222 | + NULL); | ||
223 | + else | ||
224 | +#endif | ||
225 | if (!destroy_iostream (self, error)) { | ||
226 | g_prefix_error (error, "Cannot close QMI device: "); | ||
227 | return FALSE; | ||
228 | @@ -2394,6 +2490,42 @@ qmi_device_close (QmiDevice *self, | ||
229 | return TRUE; | ||
230 | } | ||
231 | |||
232 | +#ifdef MBIM_QMUX | ||
233 | +static void | ||
234 | +mbim_device_command_ready (MbimDevice *dev, | ||
235 | + GAsyncResult *res, | ||
236 | + QmiDevice *qmidev) | ||
237 | +{ | ||
238 | + MbimMessage *response; | ||
239 | + GError *error = NULL; | ||
240 | + const guint8 *buf; | ||
241 | + guint32 len; | ||
242 | + | ||
243 | + response = mbim_device_command_finish (dev, res, &error); | ||
244 | + if (!response || !mbim_message_response_get_result (response, MBIM_MESSAGE_TYPE_COMMAND_DONE, &error)) { | ||
245 | + g_prefix_error (&error, "MBIM error: "); | ||
246 | + // transaction_complete_and_free (tr, NULL, error); | ||
247 | + g_error_free (error); | ||
248 | + mbim_message_unref (response); | ||
249 | + return; | ||
250 | + } | ||
251 | + | ||
252 | + g_debug ("[%s] Received MBIM message\n", qmidev->priv->path_display); | ||
253 | + | ||
254 | + | ||
255 | + /* get the information buffer */ | ||
256 | + buf = mbim_message_command_done_get_raw_information_buffer (response, &len); | ||
257 | + if (!G_UNLIKELY (qmidev->priv->buffer)) | ||
258 | + qmidev->priv->buffer = g_byte_array_sized_new (len); | ||
259 | + g_byte_array_append (qmidev->priv->buffer, buf, len); | ||
260 | + | ||
261 | + /* and parse it as QMI */ | ||
262 | + parse_response(qmidev); | ||
263 | + mbim_message_unref (response); | ||
264 | + return; | ||
265 | +} | ||
266 | +#endif | ||
267 | + | ||
268 | /*****************************************************************************/ | ||
269 | /* Command */ | ||
270 | |||
271 | @@ -2462,7 +2594,7 @@ qmi_device_command (QmiDevice *self, | ||
272 | tr = transaction_new (self, message, cancellable, callback, user_data); | ||
273 | |||
274 | /* Device must be open */ | ||
275 | - if (!self->priv->istream || !self->priv->ostream) { | ||
276 | + if ((!self->priv->istream || !self->priv->ostream) && !self->priv->mbim_qmux) { | ||
277 | error = g_error_new (QMI_CORE_ERROR, | ||
278 | QMI_CORE_ERROR_WRONG_STATE, | ||
279 | "Device must be open to send commands"); | ||
280 | @@ -2531,6 +2663,24 @@ qmi_device_command (QmiDevice *self, | ||
281 | g_free (printable); | ||
282 | } | ||
283 | |||
284 | +#ifdef MBIM_QMUX | ||
285 | + /* wrap QMUX in MBIM? */ | ||
286 | + if (self->priv->mbim_qmux) { | ||
287 | + MbimMessage *mbim; | ||
288 | + | ||
289 | + mbim = (mbim_message_qmi_msg_set_new (raw_message_len, raw_message, &error)); | ||
290 | + mbim_device_command (self->priv->mbimdev, | ||
291 | + mbim, | ||
292 | + 30, | ||
293 | + NULL, /* cancellable */ | ||
294 | + (GAsyncReadyCallback)mbim_device_command_ready, | ||
295 | + self); | ||
296 | + g_debug ("[%s] Message sent as MBIM\n", self->priv->path_display); | ||
297 | + | ||
298 | + /* FIXME: check errors, set proper MBIM TID */ | ||
299 | + return; | ||
300 | + } | ||
301 | +#endif | ||
302 | if (!g_output_stream_write_all (self->priv->ostream, | ||
303 | raw_message, | ||
304 | raw_message_len, | ||
305 | diff --git a/src/libqmi-glib/qmi-device.h b/src/libqmi-glib/qmi-device.h | ||
306 | index 58651e1..957efac 100644 | ||
307 | --- a/src/libqmi-glib/qmi-device.h | ||
308 | +++ b/src/libqmi-glib/qmi-device.h | ||
309 | @@ -97,6 +97,7 @@ gboolean qmi_device_is_open (QmiDevice *self); | ||
310 | * @QMI_DEVICE_OPEN_FLAGS_NET_QOS_HEADER: set network port to transmit/receive QoS headers; mutually exclusive with @QMI_DEVICE_OPEN_FLAGS_NET_NO_QOS_HEADER | ||
311 | * @QMI_DEVICE_OPEN_FLAGS_NET_NO_QOS_HEADER: set network port to not transmit/receive QoS headers; mutually exclusive with @QMI_DEVICE_OPEN_FLAGS_NET_QOS_HEADER | ||
312 | * @QMI_DEVICE_OPEN_FLAGS_PROXY: Try to open the port through the 'qmi-proxy'. | ||
313 | + * @QMI_DEVICE_OPEN_FLAGS_MBIM: open an MBIM port with QMUX tunneling service | ||
314 | * | ||
315 | * Flags to specify which actions to be performed when the device is open. | ||
316 | */ | ||
317 | @@ -108,7 +109,8 @@ typedef enum { | ||
318 | QMI_DEVICE_OPEN_FLAGS_NET_RAW_IP = 1 << 3, | ||
319 | QMI_DEVICE_OPEN_FLAGS_NET_QOS_HEADER = 1 << 4, | ||
320 | QMI_DEVICE_OPEN_FLAGS_NET_NO_QOS_HEADER = 1 << 5, | ||
321 | - QMI_DEVICE_OPEN_FLAGS_PROXY = 1 << 6 | ||
322 | + QMI_DEVICE_OPEN_FLAGS_PROXY = 1 << 6, | ||
323 | + QMI_DEVICE_OPEN_FLAGS_MBIM = 1 << 7 | ||
324 | } QmiDeviceOpenFlags; | ||
325 | |||
326 | void qmi_device_open (QmiDevice *self, | ||
327 | -- | ||
328 | 2.1.4 | ||
329 | |||
diff --git a/patches/attachment-0005.patch b/patches/attachment-0005.patch new file mode 100644 index 00000000..ef455bce --- /dev/null +++ b/patches/attachment-0005.patch | |||
@@ -0,0 +1,50 @@ | |||
1 | >From cfa1df1527d81bf8cf3deeaf9ce341cd6c2a954c Mon Sep 17 00:00:00 2001 | ||
2 | From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <bjorn@mork.no> | ||
3 | Date: Mon, 4 Apr 2016 14:47:01 +0200 | ||
4 | Subject: [PATCH 2/2] qmicli: support MBIM EXT_QMUX devices | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | Signed-off-by: Bjørn Mork <bjorn@mork.no> | ||
10 | --- | ||
11 | src/qmicli/qmicli.c | 9 ++++++++- | ||
12 | 1 file changed, 8 insertions(+), 1 deletion(-) | ||
13 | |||
14 | diff --git a/src/qmicli/qmicli.c b/src/qmicli/qmicli.c | ||
15 | index 85c2faa..c591da2 100644 | ||
16 | --- a/src/qmicli/qmicli.c | ||
17 | +++ b/src/qmicli/qmicli.c | ||
18 | @@ -56,6 +56,7 @@ static gboolean device_open_version_info_flag; | ||
19 | static gboolean device_open_sync_flag; | ||
20 | static gchar *device_open_net_str; | ||
21 | static gboolean device_open_proxy_flag; | ||
22 | +static gboolean device_open_mbim_flag; | ||
23 | static gchar *client_cid_str; | ||
24 | static gboolean client_no_release_cid_flag; | ||
25 | static gboolean verbose_flag; | ||
26 | @@ -99,6 +100,10 @@ static GOptionEntry main_entries[] = { | ||
27 | "Request to use the 'qmi-proxy' proxy", | ||
28 | NULL | ||
29 | }, | ||
30 | + { "device-open-mbim", 0, 0, G_OPTION_ARG_NONE, &device_open_mbim_flag, | ||
31 | + "Open an MBIM device with EXT_QMUX support", | ||
32 | + NULL | ||
33 | + }, | ||
34 | { "device-open-net", 0, 0, G_OPTION_ARG_STRING, &device_open_net_str, | ||
35 | "Open device with specific link protocol and QoS flags", | ||
36 | "[net-802-3|net-raw-ip|net-qos-header|net-no-qos-header]" | ||
37 | @@ -603,7 +608,9 @@ device_new_ready (GObject *unused, | ||
38 | open_flags |= QMI_DEVICE_OPEN_FLAGS_SYNC; | ||
39 | if (device_open_proxy_flag) | ||
40 | open_flags |= QMI_DEVICE_OPEN_FLAGS_PROXY; | ||
41 | - if (device_open_net_str) | ||
42 | + if (device_open_mbim_flag) | ||
43 | + open_flags |= QMI_DEVICE_OPEN_FLAGS_MBIM; | ||
44 | + if (device_open_net_str) | ||
45 | if (!qmicli_read_net_open_flags_from_string (device_open_net_str, &open_flags)) | ||
46 | exit (EXIT_FAILURE); | ||
47 | |||
48 | -- | ||
49 | 2.1.4 | ||
50 | |||
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 @@ | |||
1 | From 65d4a4bb0420794ece5082da2cac0b6771e75be7 Mon Sep 17 00:00:00 2001 | ||
2 | From: Emil Ljungdahl <emil.ljungdahl@wisi.se> | ||
3 | Date: Wed, 6 Apr 2016 19:16:47 +0200 | ||
4 | Subject: [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 | |||
11 | diff --git a/data/mbim-service-qmi.json b/data/mbim-service-qmi.json | ||
12 | new file mode 100644 | ||
13 | index 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 | -- | ||
33 | 1.9.1 | ||
34 | |||
@@ -327,7 +327,20 @@ in rec { | |||
327 | extraAliases = '' | 327 | extraAliases = '' |
328 | uucp: root | 328 | uucp: root |
329 | ''; | 329 | ''; |
330 | destination = ["yggdrasil.li" "ymir.yggdrasil.li" "praseodym.org" "ymir.praseodym.org" "141.li" "ymir.141.li" "xmpp.li" "ymir.xmpp.li" "dirty-haskell.org" "explainuxul.de" "www.explainuxul.de" "lmu.li" "www.lmu.li" "localhost.yggdrasil.li" "localhost"]; | 330 | #destination = ["yggdrasil.li" "ymir.yggdrasil.li" "praseodym.org" "ymir.praseodym.org" "141.li" "ymir.141.li" "xmpp.li" "ymir.xmpp.li" "dirty-haskell.org" "explainuxul.de" "www.explainuxul.de" "lmu.li" "www.lmu.li" "localhost.yggdrasil.li" "localhost"]; |
331 | destination = [''regexp:${pkgs.writeText "destination" '' | ||
332 | /\.?yggdrasil\.li$/ ACCEPT | ||
333 | /\.?praseodym\.org$/ ACCEPT | ||
334 | /\.?141\.li$/ ACCEPT | ||
335 | /\.?xmpp\.li$/ ACCEPT | ||
336 | /\.?dirty-haskell\.org$/ ACCEPT | ||
337 | /\.?explainuxul\.de$/ ACCEPT | ||
338 | /\.?lmu\.li$/ ACCEPT | ||
339 | /\.?yggdrasil$/ ACCEPT | ||
340 | /\.?localdomain$/ ACCEPT | ||
341 | /^localhost$/ ACCEPT | ||
342 | /\.?ymir$/ ACCEPT | ||
343 | ''}'']; | ||
331 | sslCert = "/var/lib/acme/yggdrasil.li/fullchain.pem"; | 344 | sslCert = "/var/lib/acme/yggdrasil.li/fullchain.pem"; |
332 | sslKey = "/var/lib/acme/yggdrasil.li/key.pem"; | 345 | sslKey = "/var/lib/acme/yggdrasil.li/key.pem"; |
333 | extraConfig = '' | 346 | extraConfig = '' |
@@ -497,6 +510,7 @@ in rec { | |||
497 | ''; | 510 | ''; |
498 | commandPath = ["${pkgs.rmail}/bin" "${pkgs.push2bin}/bin"]; | 511 | commandPath = ["${pkgs.rmail}/bin" "${pkgs.push2bin}/bin"]; |
499 | defaultCommands = ["rmail" "push2bin"]; | 512 | defaultCommands = ["rmail" "push2bin"]; |
513 | interval = "@mail(no) 1h"; | ||
500 | }; | 514 | }; |
501 | 515 | ||
502 | services.atd = { | 516 | services.atd = { |