Hi Martin, On Tue, Mar 23, 2010 at 05:27:46PM +0800, martin...@intel.com wrote: > From: Martin Xu <martin...@intel.com> > > __connman_inet_get_device_type can't be used to acquire connman_device_type > by itself, because it can't decide the Wireless WAN device and > Ethernet device. consequently, when inserting 3G card such as Dell 5530/5540 > the 3G service and wired service will show at the same time and ConnMan > will mess up. > udev_device_get_devtype can get the devtype, such as Wireless WAN and > Wireless LAN device. But at some cases it just return NULL to Ethernet and > "Bluetooth" device. At this case, __connman_inet_get_device_type is used to > decide the Ethernet and "Bluetooth" device. > --- > src/udev.c | 31 ++++++++++++++++++++++++++++++- > 1 files changed, 30 insertions(+), 1 deletions(-) Patch applied, thanks.
Cheers, Samuel. > diff --git a/src/udev.c b/src/udev.c > index fe814b8..79df87c 100644 > --- a/src/udev.c > +++ b/src/udev.c > @@ -54,6 +54,30 @@ static struct connman_device *find_device(int index) > return NULL; > } > > +static enum connman_device_type string2devtype(const char *devtype) > +{ > + if (g_strcmp0(devtype, "wlan") == 0) > + return CONNMAN_DEVICE_TYPE_WIFI; > + else if (g_strcmp0(devtype, "wimax") == 0) > + return CONNMAN_DEVICE_TYPE_WIMAX; > + else if (g_strcmp0(devtype, "wwan") == 0) > + return CONNMAN_DEVICE_TYPE_CELLULAR; > + > + return CONNMAN_DEVICE_TYPE_UNKNOWN; > +} > + > +static enum connman_device_type get_device_type( > + struct udev_device *udev_device, int index) > +{ > + const char *devtype; > + > + devtype = udev_device_get_devtype(udev_device); > + if (devtype == NULL) > + return __connman_inet_get_device_type(index); > + > + return string2devtype(devtype); > +} > + > static void add_net_device(struct udev_device *udev_device) > { > struct udev_list_entry *entry; > @@ -84,7 +108,9 @@ static void add_net_device(struct udev_device *udev_device) > if (index < 0) > return; > > - devtype = __connman_inet_get_device_type(index); > + devtype = get_device_type(udev_device, index); > + > + DBG("devtype %d", devtype); > > switch (devtype) { > case CONNMAN_DEVICE_TYPE_UNKNOWN: > @@ -325,6 +351,9 @@ static void print_device(struct udev_device *device, > const char *action) > } > > devtype = udev_device_get_devtype(device); > + > + DBG("devtype %s", devtype); > + > sysname = udev_device_get_sysname(device); > > driver = udev_device_get_driver(parent); > -- > 1.6.1.3 > > _______________________________________________ > connman mailing list > connman@connman.net > http://lists.connman.net/listinfo/connman -- Intel Open Source Technology Centre http://oss.intel.com/ _______________________________________________ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman