RE: [PATCH] Fix BMC 8074 fail to enable technology after rfkill

2010-11-07 Thread Marcel Holtmann
Hi,

> I verified your patch on 0.60 stable branch, and it works well on my 
> problematic netbook.

please do NOT top post on this mailing list. I would appreciate if you
follow the mailing list netiquette.

Regards

Marcel


___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


RE: [PATCH] Fix BMC 8074 fail to enable technology after rfkill

2010-11-07 Thread Deng, Ying An
Hi, Samuel,

I verified your patch on 0.60 stable branch, and it works well on my 
problematic netbook.

Best regards,
DengYingAn

> -Original Message-
> From: connman-boun...@connman.net [mailto:connman-boun...@connman.net]
> On Behalf Of Deng, Ying An
> Sent: Friday, November 05, 2010 8:19 AM
> To: Samuel Ortiz
> Cc: connman@connman.net
> Subject: RE: [PATCH] Fix BMC 8074 fail to enable technology after
> rfkill
> 
> Thanks for your suggestion, I will try it after get back from sick
> leave.
> 
> Best regards,
> DengYingAn
> 
> > -Original Message-
> > From: Samuel Ortiz [mailto:sa...@linux.intel.com]
> > Sent: Thursday, November 04, 2010 7:23 AM
> > To: Deng, Ying An
> > Cc: connman@connman.net
> > Subject: Re: [PATCH] Fix BMC 8074 fail to enable technology after
> > rfkill
> >
> > Hi Ying,
> >
> > On Fri, Oct 29, 2010 at 04:41:39PM +0800, Deng, Ying An wrote:
> > > Dear Samuel,
> > >
> > > Please find the following flow after an analysis on the different
> > behavior of the netbook, which removed the pci-E wifi device when
> > rfkill key pressed down. It is different from common rfkill operation
> > implemented on other netbooks.
> > >
> > > When RFKILL button pressed down to power off RF device...
> > Thanks for the detailed explanation, I appreciate.
> > Now that I understand the root cause of that issue, I managed to
> > reproduce it
> > with my wifi dongle.
> > I think the real problem here is that remove_device() is calling
> > __connman_technology_disable_device() when the driver disable routine
> > is
> > returning EINPROGRESS. This was a fix for the old oFono plugin, and
> > with the
> > new one it doesn't make sense anymore.
> >
> > Could you please try this patch then ?
> >
> >
> > diff --git a/src/device.c b/src/device.c
> > index f79e991..0e31b04 100644
> > --- a/src/device.c
> > +++ b/src/device.c
> > @@ -593,13 +593,9 @@ static void probe_driver(struct connman_element
> > *element, gpointer user_data)
> >
> >  static void remove_device(struct connman_device *device)
> >  {
> > -   int err;
> > -
> > DBG("device %p", device);
> >
> > -   err = __connman_device_disable(device);
> > -   if (err < 0 && err == -EINPROGRESS)
> > -   __connman_technology_disable_device(device);
> > +   __connman_device_disable(device);
> >
> > switch (device->mode) {
> > case CONNMAN_DEVICE_MODE_UNKNOWN:
> >
> > --
> > Intel Open Source Technology Centre
> > http://oss.intel.com/
> ___
> connman mailing list
> connman@connman.net
> http://lists.connman.net/listinfo/connman
___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


RE: [PATCH] Fix BMC 8074 fail to enable technology after rfkill

2010-11-04 Thread Deng, Ying An
Thanks for your suggestion, I will try it after get back from sick leave.

Best regards,
DengYingAn

> -Original Message-
> From: Samuel Ortiz [mailto:sa...@linux.intel.com]
> Sent: Thursday, November 04, 2010 7:23 AM
> To: Deng, Ying An
> Cc: connman@connman.net
> Subject: Re: [PATCH] Fix BMC 8074 fail to enable technology after
> rfkill
> 
> Hi Ying,
> 
> On Fri, Oct 29, 2010 at 04:41:39PM +0800, Deng, Ying An wrote:
> > Dear Samuel,
> >
> > Please find the following flow after an analysis on the different
> behavior of the netbook, which removed the pci-E wifi device when
> rfkill key pressed down. It is different from common rfkill operation
> implemented on other netbooks.
> >
> > When RFKILL button pressed down to power off RF device...
> Thanks for the detailed explanation, I appreciate.
> Now that I understand the root cause of that issue, I managed to
> reproduce it
> with my wifi dongle.
> I think the real problem here is that remove_device() is calling
> __connman_technology_disable_device() when the driver disable routine
> is
> returning EINPROGRESS. This was a fix for the old oFono plugin, and
> with the
> new one it doesn't make sense anymore.
> 
> Could you please try this patch then ?
> 
> 
> diff --git a/src/device.c b/src/device.c
> index f79e991..0e31b04 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -593,13 +593,9 @@ static void probe_driver(struct connman_element
> *element, gpointer user_data)
> 
>  static void remove_device(struct connman_device *device)
>  {
> - int err;
> -
>   DBG("device %p", device);
> 
> - err = __connman_device_disable(device);
> - if (err < 0 && err == -EINPROGRESS)
> - __connman_technology_disable_device(device);
> + __connman_device_disable(device);
> 
>   switch (device->mode) {
>   case CONNMAN_DEVICE_MODE_UNKNOWN:
> 
> --
> Intel Open Source Technology Centre
> http://oss.intel.com/
___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


Re: [PATCH] Fix BMC 8074 fail to enable technology after rfkill

2010-11-03 Thread Samuel Ortiz
Hi Ying,

On Fri, Oct 29, 2010 at 04:41:39PM +0800, Deng, Ying An wrote:
> Dear Samuel,
> 
> Please find the following flow after an analysis on the different behavior of 
> the netbook, which removed the pci-E wifi device when rfkill key pressed 
> down. It is different from common rfkill operation implemented on other 
> netbooks.
> 
> When RFKILL button pressed down to power off RF device...
Thanks for the detailed explanation, I appreciate.
Now that I understand the root cause of that issue, I managed to reproduce it
with my wifi dongle.
I think the real problem here is that remove_device() is calling
__connman_technology_disable_device() when the driver disable routine is
returning EINPROGRESS. This was a fix for the old oFono plugin, and with the
new one it doesn't make sense anymore.

Could you please try this patch then ?


diff --git a/src/device.c b/src/device.c
index f79e991..0e31b04 100644
--- a/src/device.c
+++ b/src/device.c
@@ -593,13 +593,9 @@ static void probe_driver(struct connman_element *element, 
gpointer user_data)
 
 static void remove_device(struct connman_device *device)
 {
-   int err;
-
DBG("device %p", device);
 
-   err = __connman_device_disable(device);
-   if (err < 0 && err == -EINPROGRESS)
-   __connman_technology_disable_device(device);
+   __connman_device_disable(device);
 
switch (device->mode) {
case CONNMAN_DEVICE_MODE_UNKNOWN:

-- 
Intel Open Source Technology Centre
http://oss.intel.com/
___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


RE: [PATCH] Fix BMC 8074 fail to enable technology after rfkill

2010-10-29 Thread Deng, Ying An
Dear Samuel,

Please find the following flow after an analysis on the different behavior of 
the netbook, which removed the pci-E wifi device when rfkill key pressed down. 
It is different from common rfkill operation implemented on other netbooks.

When RFKILL button pressed down to power off RF device...

 ...
  remove_device()
  |
  V
  __connman_device_disable() 
  |
  |
   Call __connman_technology_disable_device() : 1st calling Since err == 
-EINPROGRESS   
  |
  V
   device->driver->disable()   
  |
  V
   wifi_disable()  
  |
  V
   supplicant_stop()   
  |
  V
   remove_interface()  
  |
  V
   SEND CMD -> SUPPLICANT  
  |
  V
   Register the callback  
   remove_interface_reply() ___   --> Exit from here: wifi_disable() return 
err INPROGRESS
 | |
 | |
 | |
 | V
 | __connman_technology_disable_device() (NOT RUN)
 . |
 . V
 .   __connman_notifier_disable() (NOT RUN)
 | 
 | 
 | 
 remove_interface_reply(): The callback is invoked by supplicant after 
some time ...
 |
 V
 connman_device_set_powered(): Here the device->powered value is still 
TRUE(should be FALSE)
 |
 V
 __connman_device_disable(): Return EOPNOTSUPP since driver->disable is 
not available now
 |
 V
 __connman_technology_disable_device(): 2nd calling
 | 
 V 
 __connman_notifier_disable(): It should NOT be here anyway...


The __connman_notifier_disable() function is called twice, and the last time it 
was called when supplicant replies to connman, and tries to power down the wifi 
device in function connman_device_set_powered(). But at that time, the device 
is already down.

I created a new patch for this bug which is more clear than last one, although 
the last one contains less code to modify.
The new patch is attached (also commited request sent to stable tree).

Please help review it.

Thanks.
Best regards,
DengYingAn



> -Original Message-
> From: Samuel Ortiz [mailto:sa...@linux.intel.com]
> Sent: Wednesday, October 27, 2010 10:56 PM
> To: Deng, Ying An
> Cc: connman@connman.net
> Subject: Re: [PATCH] Fix BMC 8074 fail to enable technology after
> rfkill
> 
> Hi Ying,
> 
> On Thu, Oct 28, 2010 at 04:10:26PM +0800, ying.an.d...@intel.com wrote:
> > From: DengYingAn 
> >
> > Fix the issue cannot enable technologies if devices are rfkilled. The
> unregistered device should not be powered down.
> >
> Could you please elaborate on that ?
> How can a non registered device be powered down ? And how is that
> related to
> not being able to enable technologies ?
> 
> Cheers,
> Samuel.
> 
> --
> Intel Open Source Technology Centre
> http://oss.intel.com/
--- Begin Message ---
From: DengYingAn 

It fails to enable technologies if devices are rfkilled on netbook with the way 
to remove pci-e wifi device when rfkill key pressed. The device is indeed 
removed. The patch sync the power state between supplicant and connman driver 
layer, and prevent the attempt power off operation to an plugged-out device.
---
 include/device.h |2 ++
 plugins/supplicant.c |2 ++
 src/device.c |   10 ++
 3 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/include/device.h b/include/device.h
index b4bb297..4bd774f 100644
--- a/include/device.h
+++ b/include/device.h
@@ -75,6 +75,8 @@ void connman_device_set_mode(struct connman_device *device,
enum connman_device_mode mode);
 enum connman_device_mode connman_device_get_mode(struct connman_device 
*device);

+void connman_sync_power_status_in_callback (struct connman_device *device);
+
 int connman_device_set_powered(struct connman_device *device,
connman_bool_t powered);
 int connman_device_set_scanning(struct connman_device *device,
diff --git a/plugins/supplicant.c b/plugins/supplicant.c
index f17edc5..e77a6a5 100644
--- a/plugins/supplicant.c
+++ b/plug

[PATCH] Fix BMC 8074 fail to enable technology after rfkill

2010-10-29 Thread ying . an . deng
From: DengYingAn 

It fails to enable technologies if devices are rfkilled on netbook with the way 
to remove pci-e wifi device when rfkill key pressed. The device is indeed 
removed. The patch sync the power state between supplicant and connman driver 
layer, and prevent the attempt power off operation to an plugged-out device.
---
 include/device.h |2 ++
 plugins/supplicant.c |2 ++
 src/device.c |   10 ++
 3 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/include/device.h b/include/device.h
index b4bb297..4bd774f 100644
--- a/include/device.h
+++ b/include/device.h
@@ -75,6 +75,8 @@ void connman_device_set_mode(struct connman_device *device,
enum connman_device_mode mode);
 enum connman_device_mode connman_device_get_mode(struct connman_device 
*device);
 
+void connman_sync_power_status_in_callback (struct connman_device *device);
+
 int connman_device_set_powered(struct connman_device *device,
connman_bool_t powered);
 int connman_device_set_scanning(struct connman_device *device,
diff --git a/plugins/supplicant.c b/plugins/supplicant.c
index f17edc5..e77a6a5 100644
--- a/plugins/supplicant.c
+++ b/plugins/supplicant.c
@@ -790,6 +790,8 @@ static void remove_interface_reply(DBusPendingCall *call, 
void *user_data)
 
reply = dbus_pending_call_steal_reply(call);
 
+   connman_sync_power_status_in_callback(task->device);
+
connman_device_set_powered(task->device, FALSE);
 
connman_device_unref(task->device);
diff --git a/src/device.c b/src/device.c
index 4ea24d1..a15b19f 100644
--- a/src/device.c
+++ b/src/device.c
@@ -990,6 +990,16 @@ enum connman_device_mode connman_device_get_mode(struct 
connman_device *device)
 }
 
 /**
+ * sync the power status in callback function
+ */
+void connman_sync_power_status_in_callback (struct connman_device *device)
+{
+if (device->driver == NULL) {
+device->powered = FALSE;
+}
+}
+
+/**
  * connman_device_set_powered:
  * @device: device structure
  * @powered: powered state
-- 
1.7.2.2

___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


[PATCH] Fix BMC 8074 fail to enable technology after rfkill

2010-10-27 Thread ying . an . deng
From: DengYingAn 

Fix the issue cannot enable technologies if devices are rfkilled. The 
unregistered device should not be powered down.
---
 src/device.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/device.c b/src/device.c
index 4ea24d1..9d34079 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1001,6 +1001,9 @@ int connman_device_set_powered(struct connman_device 
*device,
 {
DBG("driver %p powered %d", device, powered);
 
+   if ((powered == FALSE) && (device->registered == FALSE))
+   return -EOPNOTSUPP;
+
if (device->timeout > 0) {
g_source_remove(device->timeout);
device->timeout = 0;
-- 
1.7.2.2

___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman