From: Neil Jerram <neil@ossau.uklinux.net>
To: ofono@ofono.org
Subject: PATCH: Enable udev-based autodetection of calypso modem on Freerunner
Date: Wed, 15 Dec 2010 22:12:16 +0000 [thread overview]
Message-ID: <87ipyud6tb.fsf@ossau.uklinux.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 874 bytes --]
Hi all,
With the patch below, ofono-0.36 (the current Debian unstable version)
detects the calypso modem on my freerunner. (Whereas without it, it
doesn't.)
I don't feel confident that the ofono.rules change is in its nicest
possible form, and (IIUC) it's dependent on these earlier rules in
/lib/udev/rules.d/55-openmoko-gta01-gta02.rules on my phone:
# Samsung UARTS
KERNEL=="s3c2410_serial[0-9]", NAME="ttySAC%n"
KERNEL=="ttySAC[0-9]", NAME="ttySAC%n"
Given that the actual udev DB entry, under 2.6.34, is:
P: /devices/platform/s3c2440-uart.0/tty/ttySAC0
N: ttySAC0
S: char/204:64
E: UDEV_LOG=3
E: DEVPATH=/devices/platform/s3c2440-uart.0/tty/ttySAC0
E: MAJOR=204
E: MINOR=64
E: DEVNAME=/dev/ttySAC0
E: SUBSYSTEM=tty
E: DEVLINKS=/dev/char/204:64
what's the neatest way of writing a udev rule for that?
Regards,
Neil
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Enable-udev-based-autodetection-of-calypso-modem-on-.patch --]
[-- Type: text/x-diff, Size: 2105 bytes --]
>From 79cc63c30dded269cdb8e8dbba78036847f6357e Mon Sep 17 00:00:00 2001
From: Neil Jerram <neil@ossau.uklinux.net>
Date: Wed, 15 Dec 2010 21:56:50 +0000
Subject: [PATCH] Enable udev-based autodetection of calypso modem on Freerunner
As https://ofono.org/wiki/ofono-supported-modems says for calypso: "It
works with modem.conf. However it may need udev rule now." This patch
addresses that.
* plugins/udev.c (add_calypso): New function.
(add_modem): Call add_calypso for "calypso" driver.
* plugins/ofono.rules: Add udev rules for Freerunner calypso under
2.6.29 and 2.6.34 kernels.
---
plugins/ofono.rules | 7 +++++++
plugins/udev.c | 16 ++++++++++++++++
2 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/plugins/ofono.rules b/plugins/ofono.rules
index da8a8ef..a0fdc96 100644
--- a/plugins/ofono.rules
+++ b/plugins/ofono.rules
@@ -2,6 +2,13 @@
ACTION!="add|change", GOTO="ofono_end"
+SUBSYSTEM!="tty", GOTO="ofono_calypso_end"
+NAME!="ttySAC0*", GOTO="ofono_calypso_end"
+
+ENV{OFONO_DRIVER}="calypso"
+
+LABEL="ofono_calypso_end"
+
SUBSYSTEM!="tty", GOTO="ofono_tty_end"
KERNEL!="ttyUSB[0-9]*", GOTO="ofono_tty_end"
diff --git a/plugins/udev.c b/plugins/udev.c
index 255755e..837ee9c 100644
--- a/plugins/udev.c
+++ b/plugins/udev.c
@@ -449,6 +449,20 @@ static void add_isi(struct ofono_modem *modem,
ofono_modem_register(modem);
}
+static void add_calypso(struct ofono_modem *modem,
+ struct udev_device *udev_device)
+{
+ struct udev_list_entry *entry;
+ const char *devnode;
+
+ DBG("modem %p", modem);
+
+ devnode = udev_device_get_devnode(udev_device);
+ ofono_modem_set_string(modem, "Device", devnode);
+
+ ofono_modem_register(modem);
+}
+
static void add_modem(struct udev_device *udev_device)
{
struct ofono_modem *modem;
@@ -533,6 +547,8 @@ done:
add_isi(modem, udev_device);
else if (g_strcmp0(driver, "n900") == 0)
add_isi(modem, udev_device);
+ else if (g_strcmp0(driver, "calypso") == 0)
+ add_calypso(modem, udev_device);
}
static gboolean devpath_remove(gpointer key, gpointer value, gpointer user_data)
--
1.7.1
next reply other threads:[~2010-12-15 22:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-15 22:12 Neil Jerram [this message]
2010-12-20 23:39 ` PATCH: Enable udev-based autodetection of calypso modem on Freerunner Denis Kenzior
2010-12-21 12:01 ` Neil Jerram
2010-12-21 18:01 ` Denis Kenzior
2010-12-21 18:13 ` Marcel Holtmann
2010-12-21 18:16 ` Denis Kenzior
2010-12-21 19:05 ` Marcel Holtmann
2010-12-21 19:18 ` Denis Kenzior
2010-12-21 19:22 ` Marcel Holtmann
2010-12-21 19:33 ` Denis Kenzior
2010-12-21 21:34 ` Neil Jerram
2010-12-22 13:37 ` Marcel Holtmann
2010-12-23 12:02 ` Neil Jerram
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ipyud6tb.fsf@ossau.uklinux.net \
--to=neil@ossau.uklinux.net \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.