linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Wagner <wagi@monom.org>
To: Dan Williams <dcbw@redhat.com>
Cc: Johannes Berg <johannes@sipsolutions.net>,
	linux-wireless@vger.kernel.org, networkmanager-list@gnome.org
Subject: Re: NetworkManager and mac80211_hwsim
Date: Wed, 18 Feb 2009 09:06:36 +0100	[thread overview]
Message-ID: <20090218080636.GA25504@toronto053.server4you.de> (raw)
In-Reply-To: <1234807251.1666.9.camel@localhost.localdomain>

On Mon, Feb 16, 2009 at 01:00:51PM -0500, Dan Williams wrote:
> On Mon, 2009-02-16 at 18:25 +0100, Daniel Wagner wrote:
> > On Mon, Feb 16, 2009 at 05:04:44PM +0100, Johannes Berg wrote:
> > > On Mon, 2009-02-16 at 17:00 +0100, Daniel Wagner wrote:
> > > 
> > > > hotplug_event_begin_add_dev (..., parent_dev = NULL, ...)
> > > >   net_add(..., parent_dev = NULL, ...)
> > > >   {
> > > >   	if (parent_dev == NULL)
> > > > 		goto error;
> > > >   }
> > > > 
> > > > Before I go deeper into that thing, does someone has
> > > > an idea what could go wrong here with mac80211_hwsim?
> > > 
> > > hwsim phys have no parents in sysfs since they're virtual.
> > 
> > Do you propose to patch hald to handle this situation then?
> 
> The patch (for now) would have to go in hal, since obviously if HAL
> can't see it, NM won't.  Until we port over to DeviceKit of course.

Thanks for the information. After looking at HAL for a while and 
knowing that it will be replaced in the near future I decided 
not to write a proper patch. Instead I came up with a big hack. 
With this hack NM sees the mac80211_hwsim devices :)

daniel

---
 hald/linux/device.c |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/hald/linux/device.c b/hald/linux/device.c
index e48548e..699d26b 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -497,20 +497,22 @@ net_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
 	guint media_type;
 	gint flags;
 
-	d = NULL;
-
-	if (parent_dev == NULL)
-		goto error;
-
 	d = hal_device_new ();
 	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
-	hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+	if (parent_dev != NULL) {
+		hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+		hal_device_property_set_string (d, "net.originating_device", hal_device_get_udi (parent_dev));
+	} else {
+		hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
+		hal_device_property_set_string (d, "net.originating_device", "/org/freedesktop/Hal/devices/computer");
+		hal_device_property_set_string (d, "info.linux.driver", "mac80211_hwsim");
+		parent_dev = hal_device_store_find (hald_get_gdl (), "/org/freedesktop/Hal/devices/computer");
+		hal_device_property_set_string (parent_dev, "info.linux.driver", "mac80211");
+	}
 
 	hal_device_property_set_string (d, "info.category", "net");
 	hal_device_add_capability (d, "net");
 
-	hal_device_property_set_string (d, "net.originating_device", hal_device_get_udi (parent_dev));
-
 	ifname = hal_util_get_last_element (sysfs_path);
 	hal_device_property_set_string (d, "net.interface", ifname);
 
@@ -530,7 +532,7 @@ net_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
 	media_type = hal_device_property_get_int (d, "net.arp_proto_hw_id");
 	if (media_type == ARPHRD_ETHER) {
 		const char *addr;
-		const char *parent_subsys;
+		const char *parent_subsys = 0;
 		char bridge_path[HAL_PATH_MAX];
 		char wireless_path[HAL_PATH_MAX];
 		char wiphy_path[HAL_PATH_MAX];
@@ -557,7 +559,8 @@ net_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
 		snprintf (wireless_path, HAL_PATH_MAX, "%s/wireless", sysfs_path);
 		/* wireless dscape stack e.g. from rt2500pci driver*/
 		snprintf (wiphy_path, HAL_PATH_MAX, "%s/wiphy", sysfs_path);
-		parent_subsys = hal_device_property_get_string (parent_dev, "info.subsystem");
+		if (parent_dev)
+			parent_subsys = hal_device_property_get_string (parent_dev, "info.subsystem");
 
 		if (parent_subsys && strcmp(parent_subsys, "bluetooth") == 0) {
 			hal_device_property_set_string (d, "info.product", "Bluetooth Interface");
-- 
1.6.0.2.GIT


  reply	other threads:[~2009-02-18  8:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-16 16:00 NetworkManager and mac80211_hwsim Daniel Wagner
2009-02-16 16:04 ` Johannes Berg
2009-02-16 17:25   ` Daniel Wagner
2009-02-16 18:00     ` Dan Williams
2009-02-18  8:06       ` Daniel Wagner [this message]
2009-02-18  8:35         ` Johannes Berg
2009-02-19  7:01           ` Daniel Wagner
2009-02-19 14:17         ` Kevin Wilson
2009-02-19 17:20           ` Daniel Wagner
2009-02-20 14:57             ` Daniel Wagner

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=20090218080636.GA25504@toronto053.server4you.de \
    --to=wagi@monom.org \
    --cc=dcbw@redhat.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=networkmanager-list@gnome.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).