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
>From 79cc63c30dded269cdb8e8dbba78036847f6357e Mon Sep 17 00:00:00 2001 From: Neil Jerram <n...@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
_______________________________________________ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono