temp/ofono: add patch to update modem data format if necessary (MR 2037)

(Also sync with Alpine while I'm at it...)

This is necessary for mobile data to work on MSM8916-based devices
after some changes in the network driver (bam-dmux) to operate in
Raw-IP mode instead of Ethernet mode (which is somewhat broken).
This commit is contained in:
Minecrell 2021-02-19 12:31:01 +01:00
parent 520894dc1b
commit 23d94d7b8c
No known key found for this signature in database
GPG key ID: B77CE638A6C2E562
2 changed files with 131 additions and 3 deletions

View file

@ -3,7 +3,7 @@
pkgname=ofono
pkgver=9999
_pkgver=1.31
pkgrel=9
pkgrel=10
pkgdesc="Infrastructure for building mobile telephony (GSM/UMTS) applications [$_pkgver]"
url="https://01.org/ofono"
arch="armhf armv7 aarch64"
@ -18,6 +18,7 @@ source="https://www.kernel.org/pub/linux/network/ofono/ofono-$_pkgver.tar.xz
fix-TEMP_FAILURE_RETRY.patch
skip-broken-test.patch
support-smdpkt.patch
wda-set-data-format.patch
0001-common-create-GList-helper-ofono_call_compare.patch
0002-common-atmodem-move-at_util_call_compare_by_status-t.patch
0003-common-atmodem-move-at_util_call_compare_by_id-to-dr.patch
@ -49,7 +50,8 @@ build() {
--sbindir=/usr/sbin \
--enable-external-ell \
--enable-tools \
--enable-test
--enable-test \
--with-dbusconfdir=/usr/share
make
}
@ -64,7 +66,7 @@ package() {
install -Dm644 "$srcdir"/udev.rules "$pkgdir"/usr/lib/udev/rules.d/60-ofono-pmos.rules
install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
install -Dm755 "$srcdir"/$pkgname-auto-enable.initd "$pkgdir"/etc/init.d/$pkgname-auto-enable
install -Dm755 "$srcdir"/ofono-wheel.conf "$pkgdir"/etc/dbus-1/system.d/
install -Dm755 "$srcdir"/ofono-wheel.conf -t "$pkgdir"/usr/share/dbus-1/system.d/
}
scripts() {
@ -79,6 +81,7 @@ sha512sums="377cda34dcc92d1f339a4b3271de5a14afaf309061c4467e5af18089cd821e65c0d8
687a2fd592add40122b789073ab9970d6e966752fdecc4077afe1c1bba705fe541dd0e457094f1d9cde747c571b7810b5b1a30835a3f1869bcd810751d5bf76f fix-TEMP_FAILURE_RETRY.patch
777ab2e13eebd1ccbe12a304310a83b262a5d934207c6a8d410e75aff380838eed1a52f3c2fe0d80c1e7db7faa9b55bf17e78a1e1acd8cfb95a3c6aef49c5b67 skip-broken-test.patch
f7f398f77877e78087b691f78ee0f3af5f99d0f15d01d107fbefff16118db4c1e0261c032bd97836a6c30d8b8a4be9d755900c5f9ea48d274a53d9c39c92683b support-smdpkt.patch
80a0ea003c4dd3afd8bea7abbfa21b7045b28e46e0a7fcd908a2695999e29657e047eb8d346f81a41ad659e8ce5c4a0f752210594c7e3b7f3c7b04c366d2ddc5 wda-set-data-format.patch
ad25dcc34bf710287c9a03fdcd61f2f2fd675691f55be30dbe7c8421753aa857906dd23b2d4f7f752fbc62caf2857b00bf5eaa8916e62718d1da7d0abc083ca0 0001-common-create-GList-helper-ofono_call_compare.patch
7e2f7fb1e661cc9f2180c55c701823050328ee906171148e4ba200e6365f1c40382dab608e78e383e62c9029a6a41d7d7a18b971132df30839f625eb576cb080 0002-common-atmodem-move-at_util_call_compare_by_status-t.patch
1a55f558c2e3058eee7dae2a60538417ae0fc058f322f4740a0f46a080cc2fda2c8a8cd522d243ab8f0be2ea461ad7dc1c27d2e73bcaac5848d9c592d6386d8a 0003-common-atmodem-move-at_util_call_compare_by_id-to-dr.patch

View file

@ -0,0 +1,125 @@
From 326066dcf5ca27ed8c46f9dfba888255ce84b408 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Fri, 19 Feb 2021 11:48:44 +0100
Subject: [PATCH] qmimodem: Update WDA data format for network interfaces !=
qmi_wwan
The network interface for the qmimodem may be provided by another
driver, e.g. bam-dmux for the integrated modem in Qualcomm SoCs or IPA.
Those do not support changing the expected data format, they just support
using the modem in Raw-IP mode. However, it may be necessary to change
the WDA data format of the modem to make that work.
To implement that:
1. Assume the network interface expects Raw-IP if it is not exposed
via USB (and therefore managed by qmi_wwan).
2. Fall back to changing the modem data format with "WDA Set Data Format"
if changing the expected data format fails.
---
drivers/qmimodem/gprs-context.c | 59 ++++++++++++++++++++++++++-------
drivers/qmimodem/qmi.c | 5 ++-
2 files changed, 51 insertions(+), 13 deletions(-)
diff --git a/drivers/qmimodem/gprs-context.c b/drivers/qmimodem/gprs-context.c
index f1fd1f12..b5ab8a83 100644
--- a/drivers/qmimodem/gprs-context.c
+++ b/drivers/qmimodem/gprs-context.c
@@ -390,12 +390,25 @@ static void create_wds_cb(struct qmi_service *service, void *user_data)
pkt_status_notify, gc, NULL);
}
+static void set_data_format_cb(struct qmi_result *result, void *user_data)
+{
+ struct ofono_gprs_context *gc = user_data;
+ struct gprs_context_data *data = ofono_gprs_context_get_data(gc);
+ uint16_t error;
+
+ qmi_result_set_error(result, &error);
+ DBG("result %#x\n", error);
+
+ qmi_service_create_shared(data->dev, QMI_SERVICE_WDS, create_wds_cb, gc,
+ NULL);
+}
+
static void get_data_format_cb(struct qmi_result *result, void *user_data)
{
struct ofono_gprs_context *gc = user_data;
struct gprs_context_data *data = ofono_gprs_context_get_data(gc);
- uint32_t llproto;
- enum qmi_device_expected_data_format expected_llproto;
+ uint32_t llproto, new_llproto = 0;
+ enum qmi_device_expected_data_format expected_llproto, new_expected = 0;
DBG("");
@@ -410,19 +423,41 @@ static void get_data_format_cb(struct qmi_result *result, void *user_data)
if ((llproto == QMI_WDA_DATA_LINK_PROTOCOL_802_3) &&
(expected_llproto ==
QMI_DEVICE_EXPECTED_DATA_FORMAT_RAW_IP)) {
- if (!qmi_device_set_expected_data_format(data->dev,
- QMI_DEVICE_EXPECTED_DATA_FORMAT_802_3))
- DBG("Fail to set expected data to 802.3");
- else
- DBG("expected data set to 802.3");
+ new_llproto = QMI_WDA_DATA_LINK_PROTOCOL_RAW_IP;
+ new_expected = QMI_DEVICE_EXPECTED_DATA_FORMAT_802_3;
} else if ((llproto == QMI_WDA_DATA_LINK_PROTOCOL_RAW_IP) &&
(expected_llproto ==
QMI_DEVICE_EXPECTED_DATA_FORMAT_802_3)) {
- if (!qmi_device_set_expected_data_format(data->dev,
- QMI_DEVICE_EXPECTED_DATA_FORMAT_RAW_IP))
- DBG("Fail to set expected data to raw-ip");
- else
- DBG("expected data set to raw-ip");
+ new_llproto = QMI_WDA_DATA_LINK_PROTOCOL_802_3;
+ new_expected = QMI_DEVICE_EXPECTED_DATA_FORMAT_RAW_IP;
+ }
+
+ /* First, try to change expected data format */
+ if (new_expected) {
+ if (qmi_device_set_expected_data_format(data->dev,
+ QMI_DEVICE_EXPECTED_DATA_FORMAT_RAW_IP)) {
+ DBG("updated expected data format");
+ goto done;
+ }
+
+ DBG("Fail to set expected data format (not qmi_wwan?)");
+ }
+
+ /* Otherwise try to change modem data format */
+ if (new_llproto) {
+ struct qmi_param *param;
+
+ DBG("set WDA data format: %d\n", new_llproto);
+
+ param = qmi_param_new_uint32(QMI_WDA_LL_PROTOCOL, new_llproto);
+ if (!param)
+ goto done;
+
+ if (qmi_service_send(data->wda, QMI_WDA_SET_DATA_FORMAT, param,
+ set_data_format_cb, gc, NULL) > 0)
+ return;
+
+ qmi_param_free(param);
}
done:
diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c
index 4cd1530f..d412adb6 100644
--- a/drivers/qmimodem/qmi.c
+++ b/drivers/qmimodem/qmi.c
@@ -1543,7 +1543,10 @@ enum qmi_device_expected_data_format qmi_device_get_expected_data_format(
interface = get_device_interface(device);
if (!interface) {
- DBG("Error while getting interface name");
+ DBG("Error while getting interface name (not qmi_wwan?)");
+
+ /* Assume that all other network drivers use Raw-IP */
+ expected = QMI_DEVICE_EXPECTED_DATA_FORMAT_RAW_IP;
goto done;
}
--
2.30.1