Feature/rx51 ofono (#567)

* [rx-51] remove pm=0 for nokia-modem
* Add ofono-1.20 + n900/isimodem fixes
* [rx51] Enable ofono support
This commit is contained in:
clayton craft 2017-09-13 12:20:46 -07:00 committed by Oliver Smith
parent a31cd0897b
commit 07ab405cc3
10 changed files with 168 additions and 7 deletions

View File

@ -1,11 +1,11 @@
pkgname=device-nokia-rx51
pkgver=1
pkgrel=14
pkgrel=15
pkgdesc="Nokia N900"
url="https://github.com/postmarketOS"
arch="noarch"
license="MIT"
depends="linux-postmarketos uboot-tools linux-firmware kbd kbd-bkeymaps"
depends="linux-postmarketos uboot-tools linux-firmware kbd kbd-bkeymaps ofono"
makedepends="uboot-tools kbd kbd-bkeymaps"
install="$pkgname.post-install"
subpackages=""
@ -13,7 +13,8 @@ source="
deviceinfo
uboot-script.cmd
backlight-enable.sh
90-touchscreen-dev.rules
udev/90-touchscreen-dev.rules
udev/10-nokia-modem.rules
acpi_handler.sh
acpi.map
keymaps/rx51_us.map
@ -36,22 +37,31 @@ package() {
"$pkgdir"/boot/boot.scr
install -D -m644 "$srcdir"/backlight-enable.sh \
"$pkgdir"/etc/postmarketos-mkinitfs/hooks/00-${pkgname}-backlight.sh
# Udev rules
install -D -m644 "$srcdir"/90-touchscreen-dev.rules \
"$pkgdir"/etc/udev/rules.d/90-touchscreen-dev.rules
mkdir "$pkgdir"/etc/acpi
install -D -m644 "$srcdir"/10-nokia-modem.rules \
"$pkgdir"/etc/udev/rules.d/10-nokia-modem.rules
# ACPI
mkdir "$pkgdir"/etc/acpi
install -D -m755 "$srcdir"/acpi_handler.sh\
"$pkgdir"/etc/acpi/handler.sh
install -D -m644 "$srcdir"/acpi.map\
"$pkgdir"/etc/acpi.map
# Keymap
install -D -m644 "$srcdir"/keymaps/rx51_us.bmap.gz\
"$pkgdir"/usr/share/bkeymaps/us/rx51_us.bmap.gz
}
sha512sums="cecba9a4a5ba6ddd736e4a46eecac20865d6c4d7a2d95efbbc33d1e8cacf9e3583aa80118fd5044da6ee08997d9d2c59af4f896692859b6e2e39e55fa515b566 deviceinfo
a6d1c097bdc06f6d93527487d3779e20d16e290421615de5fa13a3b41bc318f44a35ec9058acd107290ce407f99f74f7dbfcf48b363c9f580c394cec4ba50e77 uboot-script.cmd
1b89309dd4fe7ee0ba37c6224a0152d6864bb1c7bc4e96918a57e01bebc4173559855ae9673887223de4a8baa3191c8ad88ec8594776a4110cdb19a7be790db4 uboot-script.cmd
3d55e34b95791636e44a5f41754f3d0de039dbba41f7a556d43a95c9e64afcfa930046b4b96b40020b6f196096ffba93514682927e32fa4488686fdd19c6da5a backlight-enable.sh
98c554a709d6e8da5835bd792d833355d830fca1cfea12ec7fe4f41d1d1126389c51a8a392a7f94093473c19263cc6846cc40d7e179c2facf12db2d68ff923f9 90-touchscreen-dev.rules
57191060775a2ef002df78e5c43df233885ae130ac636fea332b7c15abe8d1bd97f984b8c4b724b62f38a9f3507948dc1be7dd6fe6fd2395d970497ff49a8274 10-nokia-modem.rules
df5dcae9a32d04ba2fed8b4dbb8722f8d56d063a288dfbaeca37806bdbb8ba4de639b392859b9f24040a1032456d5dcd754f51314e3ab66515b91ae1e03c93a7 acpi_handler.sh
7761aec6e6e219245b006e7bdc1d19812e9c5915cf3e64bb3dd46bb4b5570c1715650b53a1fc1007cb814076b5d81be0a66ba7ebf06d9a1fa4e364725c3ee633 acpi.map
c9ff8b5968fe94007e1139db5ae76f3ee6c214356bff297b9672276c6adb332ba2342b6ca54cf7992d6556f3c68a13ef49ae5e61abe86154935514034170e228 rx51_us.map
f5be149afc242543e4683532a703d7451e1b934e6c23363ea3bd38df307ae7cf657ac875cfb36152ad82f2dc056885fae8e65082eb8e3c73bd01ae44ed2224e8 device-nokia-rx51.post-install"
f340da5af204292350969cfdc0e541b96aec5857deeb20d3db5fe6cbb7d84c21cceb505f80db0df5486d9eb325cdce140255f227ed3ac1abc162fc9724e2d9a3 device-nokia-rx51.post-install"

View File

@ -11,6 +11,18 @@ rc-update add acpid default
rc-update add hwdrivers boot
# Enable networking service (requires /etc/interfaces, which is configured below)
rc-update add networking default
# Trigger udev on boot (necessary to get the nokia-modem stuff to register with udev)
rc-update add udev-trigger default
# Dbus is required by ofono
rc-update add dbus default
# Enable ofono
rc-update add ofono default
# Load nokia-modem module on boot
NMC=/etc/modules-load.d/nokia-modem.conf
if [ ! -f $NMC ] || [ -z "$(grep nokia-modem $NMC)" ]; then
echo "nokia-modem" >> /etc/modules-load.d/nokia-modem.conf
fi
# Add /boot mount point in fstab
if [ -z "$(grep /boot /etc/fstab)" ]; then

View File

@ -2,7 +2,7 @@ setenv mmcnum 0
setenv mmcpart 1
setenv mmctype ext2
setenv setup_omap_atag 1
setenv bootargs init=/init.sh rw console=tty0 console=tty02 nokia-modem.pm=0
setenv bootargs init=/init.sh rw console=tty0 console=tty02
setenv mmckernfile /uImage-postmarketos
setenv mmcinitrdfile /uInitrd-postmarketos
setenv mmcscriptfile

View File

@ -0,0 +1,2 @@
# Export GPIOs for nokia-modem
DRIVER=="nokia-modem" RUN+="/bin/ln -sf /sys/bus/hsi/devices/n900-modem /dev/cmt"

View File

@ -0,0 +1,29 @@
--- a/plugins/udevng.c
+++ b/plugins/udevng.c
@@ -1325,7 +1325,7 @@ static void add_serial_device(struct udev_device *dev)
devnode = udev_device_get_devnode(dev);
- if (!syspath || !devname || !devpath || !devnode)
+ if (!syspath || !devpath)
return;
modem = g_hash_table_lookup(modem_list, syspath);
@@ -1337,7 +1337,7 @@ static void add_serial_device(struct udev_device *dev)
modem->type = MODEM_TYPE_SERIAL;
modem->syspath = g_strdup(syspath);
modem->devname = g_strdup(devname);
- modem->driver = g_strdup("legacy");
+ modem->driver = g_strdup(driver);
g_hash_table_replace(modem_list, modem->syspath, modem);
}
@@ -1357,7 +1357,7 @@ static void add_serial_device(struct udev_device *dev)
info->subsystem = g_strdup(subsystem);
info->dev = udev_device_ref(dev);
- modem->devices = g_slist_append(modem->devices, info);
+ modem->serial = info;
}
static void add_device(const char *syspath, const char *devname,

View File

@ -0,0 +1,10 @@
--- a/plugins/udevng.c
+++ b/plugins/udevng.c
@@ -1013,8 +1013,6 @@ static gboolean setup_isi_serial(struct modem_info* modem)
if (value)
ofono_modem_set_integer(modem->modem, "Address", atoi(value));
- ofono_modem_set_string(modem->modem, "Device", info->devnode);
-
return TRUE;
}

View File

@ -0,0 +1,36 @@
--- a/drivers/isimodem/sim.c
+++ b/drivers/isimodem/sim.c
@@ -646,8 +646,31 @@ error:
/* ISI callback: PIN state (enabled/disabled) query */
static void sec_code_state_resp_cb(const GIsiMessage *msg, void *opaque)
{
- check_sec_response(msg, opaque, SEC_CODE_STATE_OK_RESP,
- SEC_CODE_STATE_FAIL_RESP);
+ struct isi_cb_data *cbd = opaque;
+ ofono_query_facility_lock_cb_t cb = cbd->cb;
+ int locked;
+ uint8_t state;
+ uint8_t status;
+
+ if (!g_isi_msg_data_get_byte(msg, 0, &state) ||
+ !g_isi_msg_data_get_byte(msg, 1, &status))
+ goto error;
+
+ if (state != SEC_CODE_STATE_OK_RESP)
+ goto error;
+
+ if (status == SEC_CODE_ENABLE)
+ locked = 1;
+ else if (status == SEC_CODE_DISABLE)
+ locked = 0;
+ else
+ goto error;
+
+ CALLBACK_WITH_SUCCESS(cb, locked, cbd->data);
+ return;
+
+error:
+ CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
}
static void isi_query_locked(struct ofono_sim *sim,

View File

@ -0,0 +1,42 @@
pkgname=ofono
pkgver=1.20
pkgrel=1
pkgdesc="Infrastructure for building mobile telephony (GSM/UMTS) applications"
url="https://01.org/ofono"
arch="all"
license="GPL2"
depends="bluez mobile-broadband-provider-info"
makedepends="glib-dev dbus-dev eudev-dev libc-dev
linux-headers bsd-compat-headers libexecinfo-dev
mobile-broadband-provider-info"
options="!check"
subpackages="$pkgname-dev $pkgname-doc"
source="https://www.kernel.org/pub/linux/network/$pkgname/$pkgname-$pkgver.tar.xz
$pkgname.initd
0001-udevng-detect-non-usb.patch
0002-udevng-remove-unneeded-prop.patch
0003-isimodem-fix-sim-state-resp-cb.patch"
builddir="$srcdir"/$pkgname-$pkgver
build() {
cd "$builddir"
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--sbindir=/usr/sbin
make
}
package() {
cd "$builddir"
make DESTDIR="$pkgdir" install
install -Dm755 "$srcdir/$pkgname.initd" "$pkgdir/etc/init.d/$pkgname"
install -Dm644 "$srcdir/$pkgname-${pkgver}/plugins/ofono.rules" "$pkgdir/usr/lib/udev/rules.d/60-ofono.rules"
}
sha512sums="8dc86654ae8a1dc1761c95df5f0de55566db20012e523f11bcd5ab5e1540f4cd9fc7bd6bf1665dcbeb31f2925f9322c21fd05fb00034e408b5d85b265e2fe840 ofono-1.20.tar.xz
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"

View File

@ -0,0 +1,20 @@
#!/sbin/runscript
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Purpose License v2
# $Header: ./gentoo-x86-cvsroot/net-misc/ofono/files/ofono.initd,v 1.1 2009/08/24 13:20:40 dagger Exp $
depend() {
need dbus
}
start() {
ebegin "Starting oFono"
start-stop-daemon --start --quiet --exec /usr/sbin/ofonod
eend $?
}
stop() {
ebegin "Stopping oFono"
start-stop-daemon --stop --quiet --exec /usr/sbin/ofonod
eend $?
}