Hi, Patrik

> -----Original Message-----
> From: Patrik Flykt [mailto:[email protected]]
> Sent: Thursday, March 27, 2014 11:21 PM
> To: Zhang, Zhengguang
> Cc: [email protected]; [email protected]
> Subject: Re: [PATCH] bluetooth: Unify bluetooth tethering enable logic
> 
> On Thu, 2014-03-27 at 10:53 +0800, [email protected] wrote:
> > From: Zhang zhengguang <[email protected]>
> >
> > In bluez 4.x plugin, when bluetooth tethering is enabled,
> > set_tethering() returns 0, while in bluez 5.x plugin, it returns
> > -EINPROGRESS, which is not compatiable for ConnMan to handle both of
> > them, this patch makes bluez 5.x tethering enable logic consistent
> > with bluez 4.x.
> > ---
> >  plugins/bluetooth.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c index
> > ae3ac60..6bea834 100644
> > --- a/plugins/bluetooth.c
> > +++ b/plugins/bluetooth.c
> > @@ -865,7 +865,7 @@ static int bluetooth_tech_set_tethering(struct
> connman_technology *technology,
> >     if (i == 0)
> >             return -ENODEV;
> >
> > -       return -EINPROGRESS;
> > +   return 0;
> 
> NAK. This is not a problem and exactly what is intended. Bluetooth will take a
> D-Bus message round-trip time to conclude whether tethering is enabled or not,
> meanwhile it better signal -EINPROGRESS for consistency.
> If bluetooth_legacy.c is not doing the same, it is the one in need of more 
> fixing.
> I don't see bluetooth_legacy having any issues in this respect, though.
> 
In Bluetooth_legacy.c, set_tethering() returns 0 directly and it can work 
correctly and no any issues.
My understanding is that set_tethering() is just a normal function call and it 
has nothing to do with tethering enable status.
So when it returns 0, it just means the function call is successful, and the 
tethering enable state change is notified by an asynchronous function 
Connman_technology_tethering_notify(). set_tethering() in bluetooth plugin 
returning 0 directly matches with the logic of set_property in technology.c.

> Is there some problem with ConnMan handling this return value?
> 
If it returns -EINPROGRESS, ConnMan will treat it as an exception and print the 
error message:
./enable-tethering bluetooth
Enabling bluetooth tethering
Traceback (most recent call last):
  File "./enable-tethering", line 68, in <module>
    tech = technology_enable_tethering(path, sys.argv[1], "", "", "")
  File "./enable-tethering", line 51, in technology_enable_tethering
    tech.SetProperty("Tethering", dbus.Boolean(1))
  File "/usr/lib/python2.7/site-packages/dbus/proxies.py", line 145, in __call__
    **keywords)
  File "/usr/lib/python2.7/site-packages/dbus/connection.py", line 651, in 
call_blocking
    message, timeout)
dbus.exceptions.DBusException: net.connman.Error.InProgress: In progress

In fact, "InProgress" dbus return in ConnMan generally means something is 
onging, and then it is launched again, which leads to the "InProgress" 
exception. We can see that it doesn't has the same meaning with -EINPROGRESS in 
Bluetooth.c.

Check it please, thanks!
 

Cheers,
Zhang Zhengguang



_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman

Reply via email to