Re: [PATCH v2] device: Make sure the device is up and running before enabling it

2014-08-07 Thread Richard Röjfors
On Thu, Aug 7, 2014 at 11:05 AM, Tomasz Bursztyka <
tomasz.burszt...@linux.intel.com> wrote:

> It can happen that, after a unproper ConnMan exit, a device is still up.
> Once ConnMan is restarted cleanup_devices() will put this device down.
> But then, it will never set it up again.
>
> 04:08:45 connmand[254]: src/device.c:__connman_device_init()
> 04:08:45 connmand[254]: src/inet.c:__connman_inet_get_address_netmask()
> index 2
> 04:08:45 connmand[254]: src/device.c:cleanup_devices() cleaning up wlan0
> index 2
> (...)
> 04:08:45 connmand[254]: wlan0 {newlink} index 2 operstate 2 
> (...)
> 04:08:45 connmand[254]: plugins/wifi.c:wifi_newlink() index 2 flags 36866
> change 0
> 04:08:45 connmand[254]: src/technology.c:__connman_technology_add_device()
> device 0x35e8a8 type WiFi
> 04:08:45 connmand[254]: src/technology.c:technology_get() type 3
> 04:08:45 connmand[254]: src/technology.c:technology_find() type 3
> 04:08:45 connmand[254]: src/device.c:__connman_device_enable() device
> 0x35e8a8
>
> Reported by Richard Röjfors 
>


Ack from me, now connman can be restarted in my setup without leaving the
wifi interface down.



> ---
>  src/device.c | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/src/device.c b/src/device.c
> index a97d790..1a5f0e6 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -185,6 +185,10 @@ int __connman_device_enable(struct connman_device
> *device)
> if (device->powered_pending == PENDING_NONE && device->powered)
> return -EALREADY;
>
> +   err = connman_inet_ifup(device->index);
> +   if (err < 0 && err != -EALREADY)
> +   return err;
> +
> device->powered_pending = PENDING_ENABLE;
>
> err = device->driver->enable(device);
> --
> 1.8.5.5
>
> ___
> connman mailing list
> connman@connman.net
> https://lists.connman.net/mailman/listinfo/connman
>
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

Re: [PATCH v2] device: Make sure the device is up and running before enabling it

2014-08-08 Thread Patrik Flykt
On Thu, 2014-08-07 at 12:05 +0300, Tomasz Bursztyka wrote:
> It can happen that, after a unproper ConnMan exit, a device is still up.
> Once ConnMan is restarted cleanup_devices() will put this device down.
> But then, it will never set it up again.

Applied, thanks!

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


RE: [PATCH v2] device: Make sure the device is up and running before enabling it

2014-08-13 Thread Pasi Sjöholm
Hi,

this patch will break cellular connectivity when coming out of flight mode as 
the modem is still powered off and will lead to ENODEV-error (19). Therefore it 
should not try to bring cellular-interfaces up or accept ENODEV as valid 
response.

--cut--
connmand[2510]: plugins/ofono.c:modem_probe() /ril_0 device 0x1cc9d10
connmand[2510]: src/technology.c:__connman_technology_add_device() device 
0x1cc9d10 type Cellular
connmand[2510]: src/technology.c:technology_get() type 5
connmand[2510]: src/technology.c:technology_find() type 5
connmand[2510]: src/technology.c:technology_get() technology (nil) driver 
0xacf38
connmand[2510]: src/technology.c:technology_load() technology 0x1cdef58
connmand[2510]: src/storage.c:storage_load() Loading /var/lib/connman/settings
connmand[2510]: src/technology.c:technology_get() technology 0x1cdef58
connmand[2510]: src/device.c:__connman_device_enable() device 0x1cc9d10
connmand[2510]: src/device.c:__connman_device_enable() device 0x1cc9d10, err -19
connmand[2510]: src/storage.c:storage_load() Loading /var/lib/connman/settings
connmand[2510]: plugins/ofono.c:modem_set_online() /ril_0 online 1
connmand[2510]: plugins/ofono.c:set_property() /ril_0 path /ril_0 
org.ofono.Modem.Online
connmand[2510]: src/device.c:connman_device_set_powered() driver 0x1cc9d10 
powered 0
connmand[2510]: plugins/ofono.c:modem_changed() /ril_0 Interfaces 0x05
connmand[2510]: plugins/ofono.c:modem_update_interfaces() /ril_0
connmand[2510]: plugins/ofono.c:api_added() cm added
connmand[2510]: plugins/ofono.c:get_properties() /ril_0 path /ril_0 
org.ofono.ConnectionManager
connmand[2510]: plugins/ofono.c:cm_get_contexts() /ril_0
connmand[2510]: plugins/ofono.c:modem_changed() /ril_0 Serial 359745050002549
connmand[2510]: src/service.c:connman_service_create() service 0x1cdb8d0
connmand[2510]: src/service.c:service_initialize() service 0x1cdb8d0
connmand[2510]: src/service.c:service_load() service 
cellular_244919750451136_context1
connmand[2510]: src/storage.c:storage_load() Loading 
/var/lib/connman/cellular_244919750451136_context1/settings
connmand[2510]: src/service.c:connman_service_create() service 0x1cdb8d0
connmand[2510]: src/service.c:service_initialize() service 0x1cdb8d0
--cut--

Br,
Pasi


From: connman [connman-boun...@connman.net] on behalf of Tomasz Bursztyka 
[tomasz.burszt...@linux.intel.com]
Sent: Thursday, August 07, 2014 12:05
To: connman@connman.net
Subject: [PATCH v2] device: Make sure the device is up and running before 
enabling it

It can happen that, after a unproper ConnMan exit, a device is still up.
Once ConnMan is restarted cleanup_devices() will put this device down.
But then, it will never set it up again.

04:08:45 connmand[254]: src/device.c:__connman_device_init()
04:08:45 connmand[254]: src/inet.c:__connman_inet_get_address_netmask() index 2
04:08:45 connmand[254]: src/device.c:cleanup_devices() cleaning up wlan0 index 2
(...)
04:08:45 connmand[254]: wlan0 {newlink} index 2 operstate 2 
(...)
04:08:45 connmand[254]: plugins/wifi.c:wifi_newlink() index 2 flags 36866 
change 0
04:08:45 connmand[254]: src/technology.c:__connman_technology_add_device() 
device 0x35e8a8 type WiFi
04:08:45 connmand[254]: src/technology.c:technology_get() type 3
04:08:45 connmand[254]: src/technology.c:technology_find() type 3
04:08:45 connmand[254]: src/device.c:__connman_device_enable() device 0x35e8a8

Reported by Richard Röjfors 
---
 src/device.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/device.c b/src/device.c
index a97d790..1a5f0e6 100644
--- a/src/device.c
+++ b/src/device.c
@@ -185,6 +185,10 @@ int __connman_device_enable(struct connman_device *device)
if (device->powered_pending == PENDING_NONE && device->powered)
return -EALREADY;

+   err = connman_inet_ifup(device->index);
+   if (err < 0 && err != -EALREADY)
+   return err;
+
device->powered_pending = PENDING_ENABLE;

err = device->driver->enable(device);
--
1.8.5.5

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH v2] device: Make sure the device is up and running before enabling it

2014-08-15 Thread Tomasz Bursztyka

Hi Pasi,


connmand[2510]: src/device.c:__connman_device_enable() device 0x1cc9d10
connmand[2510]: src/device.c:__connman_device_enable() device 0x1cc9d10, err -19


Can you print also the device index to see it's value?

Tomasz
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


RE: [PATCH v2] device: Make sure the device is up and running before enabling it

2014-08-15 Thread Pasi Sjöholm
Hi Tomasz,

>> connmand[2510]: src/device.c:__connman_device_enable() device 0x1cc9d10
>> connmand[2510]: src/device.c:__connman_device_enable() device 0x1cc9d10, err 
>> -19
>Can you print also the device index to see it's value?

connmand[21072]: src/device.c:__connman_device_enable() device 0x1326e98, err 
-19, index: 0

So I guess it could be sufficient to check if index != 0?

Br,
Pasi
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH v2] device: Make sure the device is up and running before enabling it

2014-08-15 Thread Tomasz Bursztyka

Hi Pasi,


connmand[2510]: src/device.c:__connman_device_enable() device 0x1cc9d10
connmand[2510]: src/device.c:__connman_device_enable() device 0x1cc9d10, err -19

Can you print also the device index to see it's value?

connmand[21072]: src/device.c:__connman_device_enable() device 0x1326e98, err 
-19, index: 0

So I guess it could be sufficient to check if index != 0?


Yep, that's what I was guessing. Ofono plugin does not set any device 
index, it's handled differently.


I'll send a fix.

Tomasz
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman