[ofono] add patch submitted upstream (#630) (#635)

This adds a patch I submitted upstream to ofono: https://lists.ofono.org/pipermail/ofono/2017-September/017557.html
This commit is contained in:
clayton craft 2017-09-27 17:20:44 +00:00 committed by Oliver Smith
parent 4633c69229
commit 0d8260c621
2 changed files with 109 additions and 3 deletions

View file

@ -0,0 +1,104 @@
From 20642bfed99dac5559f88743c3043f33fa3e7796 Mon Sep 17 00:00:00 2001
From: Clayton Craft <clayton@craftyguy.net>
Date: Tue, 26 Sep 2017 19:42:11 -0700
Subject: [PATCH] nokia-gpio: do not create links to gpios in /dev/cmt
The nokia-gpio plugin should not try to create symlinks to relevant gpio
pins under /dev/cmt, since the location it is looking is no longer
correct on newer kernels and it might change again in the future. This
patch removes code from nokia-gpio that tries to create a symlink.
Users will now need to symlink the modem gpios to /dev/cmt themselves.
On the 4.13 kernel, this can be done by, for example, adding a udev rule
to:
# ln -sf /sys/bus/hsi/devices/n900-modem /dev/cmt
---
plugins/nokia-gpio.c | 67 ++++------------------------------------------------
1 file changed, 4 insertions(+), 63 deletions(-)
diff --git a/plugins/nokia-gpio.c b/plugins/nokia-gpio.c
index 7a93106c..1d014337 100644
--- a/plugins/nokia-gpio.c
+++ b/plugins/nokia-gpio.c
@@ -632,74 +632,15 @@ static void phonet_status_cb(GIsiModem *idx, enum GIsiPhonetLinkState state,
static int gpio_probe_links(void)
{
- char const *gpiodir = "/sys/class/gpio";
char const *cmtdir = "/dev/cmt";
- DIR *gpio;
- struct dirent *d;
- if (file_exists(cmtdir)) {
- DBG("Using %s", cmtdir);
- return 0;
- }
-
- DBG("Using %s: trying to make links to %s", gpiodir, cmtdir);
-
- if (!dir_exists(cmtdir)) {
- if (mkdir(cmtdir, 0755) == -1) {
- DBG("%s: %s", cmtdir, strerror(errno));
- return -(errno = ENODEV);
- }
- }
-
- gpio = opendir(gpiodir);
- if (gpio == NULL) {
- DBG("%s: %s", "gpiodir", strerror(errno));
+ if (!file_exists(cmtdir)) {
+ DBG("%s: %s", cmtdir, strerror(errno));
return -(errno = ENODEV);
}
- while ((d = readdir(gpio)) != NULL) {
- char nn[PATH_MAX], name[PATH_MAX], from[PATH_MAX], to[PATH_MAX];
- FILE *nf;
- size_t len;
-
- snprintf(nn, sizeof nn, "%s/%s/name", gpiodir, d->d_name);
-
- nf = fopen(nn, "rb");
- if (nf == NULL) {
- DBG("%s: %s", nn, strerror(errno));
- continue;
- }
-
- len = fread(name, sizeof name, 1, nf);
-
- if (ferror(nf)) {
- DBG("read from %s: %s", nn, strerror(errno));
- fclose(nf);
- continue;
- }
-
- fclose(nf);
-
- if (len < 4)
- continue;
-
- name[--len] = '\0';
-
- if (strncmp(name, "cmt_", 4))
- continue;
-
- snprintf(from, sizeof from, "%s/%s", gpiodir, d->d_name);
- snprintf(to, sizeof to, "%s/%s", cmtdir, name);
-
- if (symlink(from, to) == -1)
- DBG("%s: %s", to, strerror(errno));
- }
-
- DBG("%s: %s", "/sys/class/gpio", strerror(errno));
-
- (void) closedir(gpio);
-
- return -(errno = ENODEV);
+ DBG("Using %s", cmtdir);
+ return 0;
}
--
2.14.1

View file

@ -1,6 +1,6 @@
pkgname=ofono
pkgver=1.20
pkgrel=1
pkgrel=2
pkgdesc="Infrastructure for building mobile telephony (GSM/UMTS) applications"
url="https://01.org/ofono"
arch="all"
@ -15,7 +15,8 @@ source="https://www.kernel.org/pub/linux/network/$pkgname/$pkgname-$pkgver.tar.x
$pkgname.initd
0001-udevng-detect-non-usb.patch
0002-udevng-remove-unneeded-prop.patch
0003-isimodem-fix-sim-state-resp-cb.patch"
0003-isimodem-fix-sim-state-resp-cb.patch
0004-nokia-gpio-do-not-create-links-to-gpios-in-dev-cmt.patch"
builddir="$srcdir"/$pkgname-$pkgver
build() {
@ -39,4 +40,5 @@ sha512sums="8dc86654ae8a1dc1761c95df5f0de55566db20012e523f11bcd5ab5e1540f4cd9fc7
7f17143545e1a229254b34da76a449d2c1dea238ee988d606de1a12a54fe691cd946f73e446ae786624abbcdc539338334c1d3b0d1e49fdd8ba8ba6aa51b15ff ofono.initd
a10f60e0b3b026fcd8e8bba9282c84c7b04f97621c23cdd92a8474cd0d7cd958e4e49433c454dd478b6aaf2b5b0fc5e3d8b1b87ebfef23430acdee408b76e959 0001-udevng-detect-non-usb.patch
ec8b24be9ad5db6ad3a29fb17bcc4ecd0cfc2e41131973ad03037bc5dbd3202504f6b26531f78252d99c24c816a24940dbed1a28347c1361a874eebb1fc91979 0002-udevng-remove-unneeded-prop.patch
18e9be5324babc08a986d56eb896b5bec8c35a37a0ad40c5812f226507f50379da89e469fc7cc0328be8fe49f37fc40ea0b61d053c25e469631538afeb1589cc 0003-isimodem-fix-sim-state-resp-cb.patch"
18e9be5324babc08a986d56eb896b5bec8c35a37a0ad40c5812f226507f50379da89e469fc7cc0328be8fe49f37fc40ea0b61d053c25e469631538afeb1589cc 0003-isimodem-fix-sim-state-resp-cb.patch
a1f66f3f40c1aa4af5f5b66436414408b46f3c90f2a2c88fa12e09ca6a1732334d2f47687478d652a3a176ee93c1905752635246fd01412834565626c021ca64 0004-nokia-gpio-do-not-create-links-to-gpios-in-dev-cmt.patch"