Hi Samuel,
於 五,2010-10-15 於 00:48 +0200,Samuel Ortiz 提到:
> > I also attached it on
> > http://bugs.meego.com/show_bug.cgi?id=8075
> So I've been looking at this issue and this race condition is indeed real, and
> not related to your specific hardware. It will be visible to HW that is either
> removable (e.g. a US dongle) or completely removed from the bus upon rfkill
> commands (e.g. pcie hotpluggable devices).
> When the device shows up through udev/rtnl before wpa_supplicant is started,
> the corresponding element->driver pointer will not be set, and we'll be left
> with a stale connman_device upon removal of the physical device..
>
> Although your patch is correct and does fix the issue, I don't really like
> exporting the whole element probing routine, that should be kept internal to
> the element code.
>
> What I propose is to create a simple __connman_element_set_driver() routine
> that will just set the right driver for a given element. The patch below works
> fine for me, could you please give it a try (It may not apply cleanly
> depending on the ConnMan version you're using) ?
>
Thank's for your review and patch.
This patch works to me on MSI netbook can fix the wifi hotkey issue, it
used pcie hot plug for wifi module.
Thank's
Joey Lee
>
> diff --git a/src/connman.h b/src/connman.h
> index 5c17a68..8aaac3a 100644
> --- a/src/connman.h
> +++ b/src/connman.h
> @@ -190,6 +190,8 @@ gboolean __connman_element_device_isfiltered(const char
> *devname);
> int __connman_detect_init(void);
> void __connman_detect_cleanup(void);
>
> +void __connman_element_set_driver(struct connman_element *element);
> +
> #include <connman/ipconfig.h>
>
> int __connman_ipconfig_init(void);
> diff --git a/src/device.c b/src/device.c
> index 373eb5f..1b721ee 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -586,6 +586,8 @@ static void probe_driver(struct connman_element *element,
> gpointer user_data)
>
> element->device->driver = driver;
>
> + __connman_element_set_driver(element);
> +
> setup_device(element->device);
> }
>
> diff --git a/src/element.c b/src/element.c
> index 74383cc..a5700f2 100644
> --- a/src/element.c
> +++ b/src/element.c
> @@ -1322,6 +1322,28 @@ void connman_element_set_error(struct connman_element
> *element,
> __connman_service_indicate_error(service, convert_error(error));
> }
>
> +void __connman_element_set_driver(struct connman_element *element)
> +{
> + GSList *list;
> +
> + DBG("element %p name %s driver %p", element, element->name,
> + element->driver);
> +
> + if (element->driver)
> + return;
> +
> + for (list = driver_list; list; list = list->next) {
> + struct connman_driver *driver = list->data;
> +
> + if (match_driver(element, driver) == FALSE)
> + continue;
> +
> + element->driver = driver;
> +
> + break;
> + }
> +}
> +
> int __connman_element_init(const char *device, const char *nodevice)
> {
> struct connman_element *element;
>
>
>
>
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman