All of lore.kernel.org
 help / color / mirror / Atom feed
* PATCH: Enable udev-based autodetection of calypso modem on Freerunner
@ 2010-12-15 22:12 Neil Jerram
  2010-12-20 23:39 ` Denis Kenzior
  0 siblings, 1 reply; 13+ messages in thread
From: Neil Jerram @ 2010-12-15 22:12 UTC (permalink / raw)
  To: ofono

[-- 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


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: PATCH: Enable udev-based autodetection of calypso modem on Freerunner
  2010-12-15 22:12 PATCH: Enable udev-based autodetection of calypso modem on Freerunner Neil Jerram
@ 2010-12-20 23:39 ` Denis Kenzior
  2010-12-21 12:01   ` Neil Jerram
  0 siblings, 1 reply; 13+ messages in thread
From: Denis Kenzior @ 2010-12-20 23:39 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1306 bytes --]

Hi Neil,

On 12/15/2010 04:12 PM, Neil Jerram wrote:
> 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.)

We prefer if you use git send-email to format the patch for submission.
 For now I applied your patch without the ofono.rules changes.

> 
> 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
> 

I think the better way would be to drop a udev rule directly into
/etc/udev.d or similar.  The rule should be as simple as:
KERNEL=="ttySAC0", ENV{OFONO_DRIVER}="calypso"

Let me know if this works for you and I can add a comment in the calypso
plugin.

Reg

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: PATCH: Enable udev-based autodetection of calypso modem on Freerunner
  2010-12-20 23:39 ` Denis Kenzior
@ 2010-12-21 12:01   ` Neil Jerram
  2010-12-21 18:01     ` Denis Kenzior
  0 siblings, 1 reply; 13+ messages in thread
From: Neil Jerram @ 2010-12-21 12:01 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 561 bytes --]

Denis Kenzior <denkenz@gmail.com> writes:

> We prefer if you use git send-email to format the patch for
> submission.

Sure, I will do that in future.  Thanks for looking at the patch anyway.

> I think the better way would be to drop a udev rule directly into
> /etc/udev.d or similar.  The rule should be as simple as:
> KERNEL=="ttySAC0", ENV{OFONO_DRIVER}="calypso"

Do you mean in another file than 97-ofono.rules?

> Let me know if this works for you and I can add a comment in the calypso
> plugin.

Will do.  Thanks again,

    Neil

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: PATCH: Enable udev-based autodetection of calypso modem on Freerunner
  2010-12-21 12:01   ` Neil Jerram
@ 2010-12-21 18:01     ` Denis Kenzior
  2010-12-21 18:13       ` Marcel Holtmann
  0 siblings, 1 reply; 13+ messages in thread
From: Denis Kenzior @ 2010-12-21 18:01 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 279 bytes --]

Hi Neil,

>> I think the better way would be to drop a udev rule directly into
>> /etc/udev.d or similar.  The rule should be as simple as:
>> KERNEL=="ttySAC0", ENV{OFONO_DRIVER}="calypso"
> 
> Do you mean in another file than 97-ofono.rules?

Yep.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: PATCH: Enable udev-based autodetection of calypso modem on Freerunner
  2010-12-21 18:01     ` Denis Kenzior
@ 2010-12-21 18:13       ` Marcel Holtmann
  2010-12-21 18:16         ` Denis Kenzior
  0 siblings, 1 reply; 13+ messages in thread
From: Marcel Holtmann @ 2010-12-21 18:13 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 662 bytes --]

Hi Denis,

> >> I think the better way would be to drop a udev rule directly into
> >> /etc/udev.d or similar.  The rule should be as simple as:
> >> KERNEL=="ttySAC0", ENV{OFONO_DRIVER}="calypso"
> > 
> > Do you mean in another file than 97-ofono.rules?
> 
> Yep.

I prefer not to have this inside ofono.git at all. We also leave the IFX
specific ones out. It is really up to the package maintainers to get
this sorted.

We could document this as Freerunner specific notes to point people into
the right direction. And we should maybe to the same for IFX since that
is currently only documented in the GIT commit logs.

Regards

Marcel



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: PATCH: Enable udev-based autodetection of calypso modem on Freerunner
  2010-12-21 18:13       ` Marcel Holtmann
@ 2010-12-21 18:16         ` Denis Kenzior
  2010-12-21 19:05           ` Marcel Holtmann
  0 siblings, 1 reply; 13+ messages in thread
From: Denis Kenzior @ 2010-12-21 18:16 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 960 bytes --]

Hi Marcel,

On 12/21/2010 12:13 PM, Marcel Holtmann wrote:
> Hi Denis,
> 
>>>> I think the better way would be to drop a udev rule directly into
>>>> /etc/udev.d or similar.  The rule should be as simple as:
>>>> KERNEL=="ttySAC0", ENV{OFONO_DRIVER}="calypso"
>>>
>>> Do you mean in another file than 97-ofono.rules?
>>
>> Yep.
> 
> I prefer not to have this inside ofono.git at all. We also leave the IFX
> specific ones out. It is really up to the package maintainers to get
> this sorted.
> 

That is actually what I had in mind.  Maybe I didn't communicate this
properly.

> We could document this as Freerunner specific notes to point people into
> the right direction. And we should maybe to the same for IFX since that
> is currently only documented in the GIT commit logs.

Documentation inside the individual modem driver is the way to go.  And
IFX isn't even documented in git commit logs.  I looked ;)

Regards,
-Denis

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: PATCH: Enable udev-based autodetection of calypso modem on Freerunner
  2010-12-21 18:16         ` Denis Kenzior
@ 2010-12-21 19:05           ` Marcel Holtmann
  2010-12-21 19:18             ` Denis Kenzior
  0 siblings, 1 reply; 13+ messages in thread
From: Marcel Holtmann @ 2010-12-21 19:05 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1076 bytes --]

Hi Denis,

> > We could document this as Freerunner specific notes to point people into
> > the right direction. And we should maybe to the same for IFX since that
> > is currently only documented in the GIT commit logs.
> 
> Documentation inside the individual modem driver is the way to go.  And
> IFX isn't even documented in git commit logs.  I looked ;)

commit 3443a7a177fbaca24c84658968aff0a55db8a51d
Author: Marcel Holtmann <marcel@holtmann.org>
Date:   Sat Sep 18 22:08:41 2010 +0900

    udev: Add support for IFX device detection
    
    The IFX device detection is pretty static, but instead of using
    a static configuration file it is important to know when the device
    node is actually present. For this udev is perfect. Adding a simple
    udev rule is all that it takes:
    
    KERNEL=="ttyIFX[0-9]*", ENV{OFONO_DRIVER}="ifx"
    
    With this rule for every TTY with the kernel name like ttyIFX0, a new
    modem will be added and the IFX modem plugin driver requested for it.

this is not enough?

Regards

Marcel



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: PATCH: Enable udev-based autodetection of calypso modem on Freerunner
  2010-12-21 19:05           ` Marcel Holtmann
@ 2010-12-21 19:18             ` Denis Kenzior
  2010-12-21 19:22               ` Marcel Holtmann
  0 siblings, 1 reply; 13+ messages in thread
From: Denis Kenzior @ 2010-12-21 19:18 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1324 bytes --]

Hi Marcel,

On 12/21/2010 01:05 PM, Marcel Holtmann wrote:
> Hi Denis,
> 
>>> We could document this as Freerunner specific notes to point people into
>>> the right direction. And we should maybe to the same for IFX since that
>>> is currently only documented in the GIT commit logs.
>>
>> Documentation inside the individual modem driver is the way to go.  And
>> IFX isn't even documented in git commit logs.  I looked ;)
> 
> commit 3443a7a177fbaca24c84658968aff0a55db8a51d
> Author: Marcel Holtmann <marcel@holtmann.org>
> Date:   Sat Sep 18 22:08:41 2010 +0900
> 
>     udev: Add support for IFX device detection
>     
>     The IFX device detection is pretty static, but instead of using
>     a static configuration file it is important to know when the device
>     node is actually present. For this udev is perfect. Adding a simple
>     udev rule is all that it takes:
>     
>     KERNEL=="ttyIFX[0-9]*", ENV{OFONO_DRIVER}="ifx"
>     
>     With this rule for every TTY with the kernel name like ttyIFX0, a new
>     modem will be added and the IFX modem plugin driver requested for it.
> 
> this is not enough?

Then I didn't look far back enough (or I'm simply blind).  But I still
prefer this to be inside the driver or HACKING.calypso for easier access.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: PATCH: Enable udev-based autodetection of calypso modem on Freerunner
  2010-12-21 19:18             ` Denis Kenzior
@ 2010-12-21 19:22               ` Marcel Holtmann
  2010-12-21 19:33                 ` Denis Kenzior
  0 siblings, 1 reply; 13+ messages in thread
From: Marcel Holtmann @ 2010-12-21 19:22 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1520 bytes --]

Hi Denis,

> >>> We could document this as Freerunner specific notes to point people into
> >>> the right direction. And we should maybe to the same for IFX since that
> >>> is currently only documented in the GIT commit logs.
> >>
> >> Documentation inside the individual modem driver is the way to go.  And
> >> IFX isn't even documented in git commit logs.  I looked ;)
> > 
> > commit 3443a7a177fbaca24c84658968aff0a55db8a51d
> > Author: Marcel Holtmann <marcel@holtmann.org>
> > Date:   Sat Sep 18 22:08:41 2010 +0900
> > 
> >     udev: Add support for IFX device detection
> >     
> >     The IFX device detection is pretty static, but instead of using
> >     a static configuration file it is important to know when the device
> >     node is actually present. For this udev is perfect. Adding a simple
> >     udev rule is all that it takes:
> >     
> >     KERNEL=="ttyIFX[0-9]*", ENV{OFONO_DRIVER}="ifx"
> >     
> >     With this rule for every TTY with the kernel name like ttyIFX0, a new
> >     modem will be added and the IFX modem plugin driver requested for it.
> > 
> > this is not enough?
> 
> Then I didn't look far back enough (or I'm simply blind).  But I still
> prefer this to be inside the driver or HACKING.calypso for easier access.

I am with you that this needs to be documented better than GIT commit
logs.

However I do prefer doc/calypso-modem.txt and doc/ifx-modem.txt though
since I don't wanna clutter the root directory.

Regards

Marcel



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: PATCH: Enable udev-based autodetection of calypso modem on Freerunner
  2010-12-21 19:22               ` Marcel Holtmann
@ 2010-12-21 19:33                 ` Denis Kenzior
  2010-12-21 21:34                   ` Neil Jerram
  0 siblings, 1 reply; 13+ messages in thread
From: Denis Kenzior @ 2010-12-21 19:33 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 428 bytes --]

Hi Marcel,

>> Then I didn't look far back enough (or I'm simply blind).  But I still
>> prefer this to be inside the driver or HACKING.calypso for easier access.
> 
> I am with you that this needs to be documented better than GIT commit
> logs.
> 
> However I do prefer doc/calypso-modem.txt and doc/ifx-modem.txt though
> since I don't wanna clutter the root directory.
> 

Sounds good to me.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: PATCH: Enable udev-based autodetection of calypso modem on Freerunner
  2010-12-21 19:33                 ` Denis Kenzior
@ 2010-12-21 21:34                   ` Neil Jerram
  2010-12-22 13:37                     ` Marcel Holtmann
  0 siblings, 1 reply; 13+ messages in thread
From: Neil Jerram @ 2010-12-21 21:34 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 820 bytes --]

Denis Kenzior <denkenz@gmail.com> writes:

> Hi Marcel,
>
>>> Then I didn't look far back enough (or I'm simply blind).  But I still
>>> prefer this to be inside the driver or HACKING.calypso for easier access.
>> 
>> I am with you that this needs to be documented better than GIT commit
>> logs.
>> 
>> However I do prefer doc/calypso-modem.txt and doc/ifx-modem.txt though
>> since I don't wanna clutter the root directory.
>> 
>
> Sounds good to me.

Cool.  Once I've worked out the simplest udev rule for calypso, I'll
submit a patch to create doc/calypso-modem.txt to document that.

(I don't yet understand why it makes sense for calypso to be handled
differently from other cases in plugins/ofono.rules, but I'm happy to
trust that there is a good reason for this.)

Regards,
       Neil

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: PATCH: Enable udev-based autodetection of calypso modem on Freerunner
  2010-12-21 21:34                   ` Neil Jerram
@ 2010-12-22 13:37                     ` Marcel Holtmann
  2010-12-23 12:02                       ` Neil Jerram
  0 siblings, 1 reply; 13+ messages in thread
From: Marcel Holtmann @ 2010-12-22 13:37 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1056 bytes --]

Hi Neil,

> >>> Then I didn't look far back enough (or I'm simply blind).  But I still
> >>> prefer this to be inside the driver or HACKING.calypso for easier access.
> >> 
> >> I am with you that this needs to be documented better than GIT commit
> >> logs.
> >> 
> >> However I do prefer doc/calypso-modem.txt and doc/ifx-modem.txt though
> >> since I don't wanna clutter the root directory.
> >> 
> >
> > Sounds good to me.
> 
> Cool.  Once I've worked out the simplest udev rule for calypso, I'll
> submit a patch to create doc/calypso-modem.txt to document that.
> 
> (I don't yet understand why it makes sense for calypso to be handled
> differently from other cases in plugins/ofono.rules, but I'm happy to
> trust that there is a good reason for this.)

the other cases come from an unique vendor and product ID. The Calypso
and also IFX modems are based on device nodes. These are not unique.
They are platform specific. Not all platform will have a Calypso modem
behind /dev/ttySAC0 for example.

Regards

Marcel



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: PATCH: Enable udev-based autodetection of calypso modem on Freerunner
  2010-12-22 13:37                     ` Marcel Holtmann
@ 2010-12-23 12:02                       ` Neil Jerram
  0 siblings, 0 replies; 13+ messages in thread
From: Neil Jerram @ 2010-12-23 12:02 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

Marcel Holtmann <marcel@holtmann.org> writes:

> Hi Neil,
>
>> (I don't yet understand why it makes sense for calypso to be handled
>> differently from other cases in plugins/ofono.rules, but I'm happy to
>> trust that there is a good reason for this.)
>
> the other cases come from an unique vendor and product ID. The Calypso
> and also IFX modems are based on device nodes. These are not unique.
> They are platform specific. Not all platform will have a Calypso modem
> behind /dev/ttySAC0 for example.

Ah yes, that makes sense.  Thanks for explaining.

     Neil

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2010-12-23 12:02 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-15 22:12 PATCH: Enable udev-based autodetection of calypso modem on Freerunner Neil Jerram
2010-12-20 23:39 ` 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

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.