* [PATCH] modem: Make it possible to identify the physical device of the modem
@ 2012-11-01 10:39 Holger Hans Peter Freyther
2012-11-01 9:49 ` Denis Kenzior
2012-11-01 10:41 ` [PATCH] modem: Make it possible to identify the physical device of the modem Holger Freyther
0 siblings, 2 replies; 5+ messages in thread
From: Holger Hans Peter Freyther @ 2012-11-01 10:39 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1883 bytes --]
From: Holger Hans Peter Freyther <hfreyther@sysmocom.de>
The naming of modems might not reflect the physical order of devices.
E.g. /dev/ttyUSB0 might end up as /wavecom_3 and /dev/ttyUSB2 might be
/wavecom_1. Add a 'Device' property to be able to identify the port.
An application can then use sysfs to identify the bus and device to
rebuild the physical order. This way we can map the modem path to the
port number on our modem bank.
---
doc/modem-api.txt | 5 +++++
src/modem.c | 6 ++++++
2 files changed, 11 insertions(+)
diff --git a/doc/modem-api.txt b/doc/modem-api.txt
index 1c4e440..68e719e 100644
--- a/doc/modem-api.txt
+++ b/doc/modem-api.txt
@@ -168,3 +168,8 @@ Properties boolean Powered [readwrite]
supported by this modem.
Possible values are "hfp", "sap" and "hardware".
+
+ string Device [readonly, optional]
+
+ The physical device the modem is connected to. This
+ can be used to identify the physical port of the modem.
diff --git a/src/modem.c b/src/modem.c
index db62e2d..e542fac 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -771,6 +771,7 @@ void __ofono_modem_append_properties(struct ofono_modem *modem,
struct ofono_devinfo *info;
dbus_bool_t emergency = ofono_modem_get_emergency_mode(modem);
const char *strtype;
+ const char *device;
ofono_dbus_dict_append(dict, "Online", DBUS_TYPE_BOOLEAN,
&modem->online);
@@ -826,6 +827,11 @@ void __ofono_modem_append_properties(struct ofono_modem *modem,
strtype = modem_type_to_string(modem->driver->modem_type);
ofono_dbus_dict_append(dict, "Type", DBUS_TYPE_STRING, &strtype);
+
+ device = ofono_modem_get_string(modem, "Device");
+ if (device)
+ ofono_dbus_dict_append(dict, "Device", DBUS_TYPE_STRING,
+ &device);
}
static DBusMessage *modem_get_properties(DBusConnection *conn,
--
1.7.10.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] modem: Make it possible to identify the physical device of the modem
2012-11-01 10:39 [PATCH] modem: Make it possible to identify the physical device of the modem Holger Hans Peter Freyther
@ 2012-11-01 9:49 ` Denis Kenzior
2012-11-01 16:16 ` [PATCH] modem: Make it possible to identify the physical device of the modemy Holger Hans Peter Freyther
2012-11-01 10:41 ` [PATCH] modem: Make it possible to identify the physical device of the modem Holger Freyther
1 sibling, 1 reply; 5+ messages in thread
From: Denis Kenzior @ 2012-11-01 9:49 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1834 bytes --]
Hi Holger,
On 11/01/2012 05:39 AM, Holger Hans Peter Freyther wrote:
> From: Holger Hans Peter Freyther<hfreyther@sysmocom.de>
>
> The naming of modems might not reflect the physical order of devices.
> E.g. /dev/ttyUSB0 might end up as /wavecom_3 and /dev/ttyUSB2 might be
> /wavecom_1. Add a 'Device' property to be able to identify the port.
>
Aren't your devices serial port based and detected via udev rules?
Anyway, I can understand the need here but...
> An application can then use sysfs to identify the bus and device to
> rebuild the physical order. This way we can map the modem path to the
> port number on our modem bank.
> ---
> doc/modem-api.txt | 5 +++++
> src/modem.c | 6 ++++++
> 2 files changed, 11 insertions(+)
>
> diff --git a/doc/modem-api.txt b/doc/modem-api.txt
> index 1c4e440..68e719e 100644
> --- a/doc/modem-api.txt
> +++ b/doc/modem-api.txt
> @@ -168,3 +168,8 @@ Properties boolean Powered [readwrite]
> supported by this modem.
>
> Possible values are "hfp", "sap" and "hardware".
> +
> + string Device [readonly, optional]
> +
> + The physical device the modem is connected to. This
> + can be used to identify the physical port of the modem.
I really do not think exposing the device name is a good idea. First of
all, no normal application can make use of it anyway. Once the modem is
powered on oFono takes exclusive rights to it. Secondly, most USB
sticks are actually multi-device groupings anyway, so this property
really makes no sense.
Why don't you simply assign a name to the modem using
ofono_modem_set_name. This can be done by assigning the name directly
in the udev rule and having the necessary magic inside plugins/udev.c.
The name can be anything you wish in that case.
Regards,
-Denis
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] modem: Make it possible to identify the physical device of the modemy
2012-11-01 9:49 ` Denis Kenzior
@ 2012-11-01 16:16 ` Holger Hans Peter Freyther
2012-11-01 12:39 ` Denis Kenzior
0 siblings, 1 reply; 5+ messages in thread
From: Holger Hans Peter Freyther @ 2012-11-01 16:16 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 942 bytes --]
On Thu, Nov 01, 2012 at 04:49:37AM -0500, Denis Kenzior wrote:
> Hi Holger,
> I really do not think exposing the device name is a good idea.
> First of all, no normal application can make use of it anyway. Once
> the modem is powered on oFono takes exclusive rights to it.
> Secondly, most USB sticks are actually multi-device groupings
> anyway, so this property really makes no sense.
the alternative would be to add the sysfs path directly but this
probably doesn't change your argument.
>
> Why don't you simply assign a name to the modem using
> ofono_modem_set_name. This can be done by assigning the name
> directly in the udev rule and having the necessary magic inside
> plugins/udev.c. The name can be anything you wish in that case.
I will have to take a look at this. I never wrote advanced udev
rules and I don't know how much sense it makes to put handling
for our product into plugins/udev.c.
h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] modem: Make it possible to identify the physical device of the modem
2012-11-01 10:39 [PATCH] modem: Make it possible to identify the physical device of the modem Holger Hans Peter Freyther
2012-11-01 9:49 ` Denis Kenzior
@ 2012-11-01 10:41 ` Holger Freyther
1 sibling, 0 replies; 5+ messages in thread
From: Holger Freyther @ 2012-11-01 10:41 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 173 bytes --]
Holger Hans Peter Freyther <holger@...> writes:
>
Hi,
this is mostly an RFC right now and I still need to implement the
searching through sysfs.
holger
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-11-01 16:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-01 10:39 [PATCH] modem: Make it possible to identify the physical device of the modem Holger Hans Peter Freyther
2012-11-01 9:49 ` Denis Kenzior
2012-11-01 16:16 ` [PATCH] modem: Make it possible to identify the physical device of the modemy Holger Hans Peter Freyther
2012-11-01 12:39 ` Denis Kenzior
2012-11-01 10:41 ` [PATCH] modem: Make it possible to identify the physical device of the modem Holger Freyther
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.