Patch support usb device gadgets



Hi,

please include the following patch in 0.8.4 to support usb device gadgets.
I use NM on an embedded device (arm at91) with an USB-B connector
(also used for eg printers).
The device use the g_ether driver and NM needs this patch to handle the device.

With this patch,NM log for my device looks like:

...
NetworkManager[2361]:    SCPlugin-Ifupdown: devices added (path:
/sys/devices/platform/at91_udc/gadget/net/usb0, iface: usb0)
NetworkManager[2361]:    SCPlugin-Ifupdown: device added (path:
/sys/devices/platform/at91_udc/gadget/net/usb0, iface: usb0): no
ifupdown configuration found.
...
NetworkManager[2361]: <error> [1298893539.643863]
[nm-device-ethernet.c:764] real_update_permanent_hw_address(): (usb0):
unable to read permanent MAC address (error 0)
NetworkManager[2361]: <info> (usb0): carrier is OFF
NetworkManager[2361]: <info> (usb0): new Ethernet device (driver:
'at91_udc' ifindex: 2)
NetworkManager[2361]: <info> (usb0): exported as
/org/freedesktop/NetworkManager/Devices/0
NetworkManager[2361]: <info> (usb0): now managed
NetworkManager[2361]: <info> (usb0): device state change: 1 -> 2 (reason 2)
NetworkManager[2361]: <info> (usb0): bringing up device.
NetworkManager[2361]: <info> (usb0): preparing device.
NetworkManager[2361]: <info> (usb0): deactivating device (reason: 2).
/sbin/ifup: interface lo already configured
NetworkManager[2361]: <info> (usb0): carrier now ON (device state 2)
NetworkManager[2361]: <info> (usb0): device state change: 2 -> 3 (reason 40)
...



Cheers,

Tom
From bad909e0eee78b26cd003e60315c26431ea22037 Mon Sep 17 00:00:00 2001
From: Tom Bechtold <toabctl googlemail com>
Date: Mon, 28 Feb 2011 12:55:05 +0100
Subject: [PATCH] try to find driver for embedded usb device gadgets

---
 src/nm-udev-manager.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/nm-udev-manager.c b/src/nm-udev-manager.c
index ff0ef68..f95fac0 100644
--- a/src/nm-udev-manager.c
+++ b/src/nm-udev-manager.c
@@ -361,13 +361,26 @@ device_creator (NMUdevManager *manager,
 		if (parent) {
 			driver = g_udev_device_get_driver (parent);
 			if (!driver) {
-				/* try the grandparent only if it's an ibmebus device */
-				subsys = g_udev_device_get_subsystem (parent);
-				if (subsys && !strcmp (subsys, "ibmebus")) {
+			    /* try the grandparent only if it's an ibmebus device */
+			    subsys = g_udev_device_get_subsystem (parent);
+
+                if (subsys && !strcmp (subsys, "ibmebus")) {
 					grandparent = g_udev_device_get_parent (parent);
 					if (grandparent)
 						driver = g_udev_device_get_driver (grandparent);
 				}
+                /* try to use grandparent driver if subsystem is null.
+                   this is needed by embedded usb device gadgets where 
+                   subsys is (null) but the driver of the grandparent is
+                   eg 'at91_udc' */
+                if (!subsys)
+					{
+						grandparent = g_udev_device_get_parent (parent);
+						if (grandparent)
+							{
+								driver = g_udev_device_get_driver (grandparent);
+							}
+					}
 			}
 		}
 	}
-- 
1.7.2.3



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]