From: Hui Li <[email protected]>
The original return value is NULL.
---
src/obex.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/src/obex.c b/src/obex.c
index 49d9c18..978894e 100644
--- a/src/obex.c
+++ b/src/obex.c
@@ -1377,8 +1377,7 @@ int obex_session_start(GIOChannel *io, uint16_t tx_mtu, uint16_t rx_mtu,
os = g_new0(struct obex_session, 1);
- os->service = obex_service_driver_find(server->drivers, NULL,
- 0, NULL, 0);
+ os->service = server->drivers->data;
os->server = server;
os->rx_mtu = rx_mtu != 0 ? rx_mtu : DEFAULT_RX_MTU;
os->tx_mtu = tx_mtu != 0 ? tx_mtu : DEFAULT_TX_MTU;
--
1.7.1
On Thu, Jun 30, 2011 at 12:01 PM, Li, Nami <[email protected]> wrote:
> Well, if the profile is OPP, then you can get correct service driver. But if the profile is FTP, because in ftp.c:
>
> static struct obex_service_driver ftp = {
> ? ? ? ?.name = "File Transfer server",
> ? ? ? ?.service = OBEX_FTP,
> ? ? ? ?.channel = FTP_CHANNEL,
> ? ? ? ?.psm = FTP_PSM,
> ? ? ? ?.record = FTP_RECORD,
> ? ? ? ?.target = FTP_TARGET,
> ? ? ? ?.target_size = TARGET_SIZE,
> ? ? ? ?.connect = ftp_connect,
> ? ? ? ?.get = ftp_get,
> ? ? ? ?.put = ftp_put,
> ? ? ? ?.chkput = ftp_chkput,
> ? ? ? ?.setpath = ftp_setpath,
> ? ? ? ?.disconnect = ftp_disconnect
> };
> It`s target is not null, target_size is 16, so " obex_service_driver_find(server->drivers, NULL,0, NULL, 0)" will return null.
>
> And I`m not picking up the first driver in the list, actually it is the only one in the list.
In case of other profiles, there is OBEX connect command required, and
then the appropriate driver will be selected in callback for OBEX
connect event (see cmd_connect()).
--
Slawomir Bochenski
SGksIEx1aXoNCg0KLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCkZyb206IEx1aXogQXVndXN0
byB2b24gRGVudHogW21haWx0bzpsdWl6LmRlbnR6QGdtYWlsLmNvbV0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RQLCBiZWNhdXNl
IGluIGZ0cC5jOg0KDQpzdGF0aWMgc3RydWN0IG9iZXhfc2VydmljZV9kcml2ZXIgZnRwID0gew0K
CS5uYW1lID0gIkZpbGUgVHJhbnNmZXIgc2VydmVyIiwNCgkuc2VydmljZSA9IE9CRVhfRlRQLA0K
CS5jaGFubmVsID0gRlRQX0NIQU5ORUwsDQoJLnBzbSA9IEZUUF9QU00sDQoJLnJlY29yZCA9IEZU
UF9SRUNPUkQsDQoJLnRhcmdldCA9IEZUUF9UQVJHRVQsDQoJLnRhcmdldF9zaXplID0gVEFSR0VU
X1NJWkUsDQoJLmNvbm5lY3QgPSBmdHBfY29ubmVjdCwNCgkuZ2V0ID0gZnRwX2dldCwNCgkucHV0
ID0gZnRwX3B1dCwNCgkuY2hrcHV0ID0gZnRwX2Noa3B1dCwNCgkuc2V0cGF0aCA9IGZ0cF9zZXRw
YXRoLA0KCS5kaXNjb25uZWN0ID0gZnRwX2Rpc2Nvbm5lY3QNCn07DQpJdGBzIHRhcmdldCBpcyBu
b3QgbnVsbCwgdGFyZ2V0X3NpemUgaXMgMTYsIHNvICIgb2JleF9zZXJ2aWNlX2RyaXZlcl9maW5k
KHNlcnZlci0+ZHJpdmVycywgTlVMTCwwLCBOVUxMLCAwKSIgd2lsbCByZXR1cm4gbnVsbC4NCg0K
QW5kIElgbSBub3QgcGlja2luZyB1cCB0aGUgZmlyc3QgZHJpdmVyIGluIHRoZSBsaXN0LCBhY3R1
YWxseSBpdCBpcyB0aGUgb25seSBvbmUgaW4gdGhlIGxpc3QuDQoNCg0KDQpSZWdhcmRzLA0KTmFt
aQ0KDQoNCg0K
Hi,
On Thu, Jun 30, 2011 at 10:34 AM, Hui Li <[email protected]> wrote:
> From: Hui Li <[email protected]>
>
> ?The original return value is NULL.
> ---
> ?src/obex.c | ? ?3 +--
> ?1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/src/obex.c b/src/obex.c
> index 49d9c18..978894e 100644
> --- a/src/obex.c
> +++ b/src/obex.c
> @@ -1377,8 +1377,7 @@ int obex_session_start(GIOChannel *io, uint16_t tx_mtu, uint16_t rx_mtu,
>
> ? ? ? ?os = g_new0(struct obex_session, 1);
>
> - ? ? ? os->service = obex_service_driver_find(server->drivers, NULL,
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0, NULL, 0);
> + ? ? ? os->service = server->drivers->data;
> ? ? ? ?os->server = server;
> ? ? ? ?os->rx_mtu = rx_mtu != 0 ? rx_mtu : DEFAULT_RX_MTU;
> ? ? ? ?os->tx_mtu = tx_mtu != 0 ? tx_mtu : DEFAULT_TX_MTU;
> --
> 1.7.1
>
> --
The idea here is to initialized with OPP driver which has no target
thus the NULL, so picking up the first driver in the list may not
enough. Btw, if passing a NULL was a bug OPP driver would never have
worked, so I wonder how you managed to get no driver as a response to
NULL target?
--
Luiz Augusto von Dentz
SGksIEx1aXoNCg0KLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCkZyb206IEx1aXogQXVndXN0
byB2b24gRGVudHogW21haWx0bzpsdWl6LmRlbnR6QGdtYWlsLmNvbV0gDQpTZW50OiAyMDEx5bm0
N+aciDHml6UgMTQ6NTINClRvOiBMaSwgTmFtaQ0KQ2M6IFNsYXdvbWlyIEJvY2hlbnNraTsgbGlu
dXgtYmx1ZXRvb3RoQHZnZXIua2VybmVsLm9yZw0KU3ViamVjdDogUmU6IFtQQVRDSCBvYmV4ZF0g
UmV0dXJuIGNvcnJlY3Qgb2JleCBzZXJ2aWNlIGRyaXZlciBpbiBvYmV4X3Nlc3Npb25fc3RhcnQN
Cg0KSGksDQoNCk9uIEZyaSwgSnVsIDEsIDIwMTEgYXQgNTo1MCBBTSwgTGksIE5hbWkgPG5hbWlA
cWNhLnF1YWxjb21tLmNvbT4gd3JvdGU6DQo+DQo+DQo+IC0tLS0tT3JpZ2luYWwgTWVzc2FnZS0t
LS0tDQo+IEZyb206IFNsYXdvbWlyIEJ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25lPw0KSWYgT0JFWCBvdmVyIEwyQ0FQIHVz
ZSBTRVFQQUNLRVQsIHRoZW4gSSBuZWVkIHRvIHRlbGwgb3Blbm9iZXggdGhlIGRhdGEgZm9ybWF0
IGlzIFNFUVBBQ0tFVCB0byByZWNlaXZlIGRhdGEgY29ycmVjdGx5IGluY2x1ZGluZyBjb25uZWN0
IGNtZC4gU28gSSBuZWVkIHRvIGtub3cgT0JFWCBvdmVyIEwyQ0FQIG9yIFJGQ09NTSBpbiBvYmV4
X3Nlc3Npb25fc3RhcnQuDQpOb3csIEkgaGF2ZSBhIGRvdWJ0LCB3aHkgd2UgZ2V0IGRyaXZlciBi
eSB0YXJnZXQgYW5kIHdobz8gQ2FuIHdlIGdldCBkcml2ZXIgZGlyZWN0bHkgYnkgY2hhbm5lbCBz
aW5jZSBvYmV4IHByb2ZpbGVzIHVzaW5nIGRpZmZlcmVudCBjaGFubmVscz8gDQoNCg0KDQpSZWdh
cmRzLA0KTmFtaQ0KDQoNCg0K
Hi,
On Fri, Jul 1, 2011 at 5:50 AM, Li, Nami <[email protected]> wrote:
>
>
> -----Original Message-----
> From: Slawomir Bochenski [mailto:[email protected]]
> Sent: 2011年6月30日 18:26
> To: Li, Nami
> Cc: Luiz Augusto von Dentz; [email protected]
> Subject: Re: [PATCH obexd] Return correct obex service driver in obex_session_start
>
> On Thu, Jun 30, 2011 at 12:01 PM, Li, Nami <[email protected]> wrote:
>> Well, if the profile is OPP, then you can get correct service driver. But if the profile is FTP, because in ftp.c:
>>
>> static struct obex_service_driver ftp = {
>> .name = "File Transfer server",
>> .service = OBEX_FTP,
>> .channel = FTP_CHANNEL,
>> .psm = FTP_PSM,
>> .record = FTP_RECORD,
>> .target = FTP_TARGET,
>> .target_size = TARGET_SIZE,
>> .connect = ftp_connect,
>> .get = ftp_get,
>> .put = ftp_put,
>> .chkput = ftp_chkput,
>> .setpath = ftp_setpath,
>> .disconnect = ftp_disconnect
>> };
>> It`s target is not null, target_size is 16, so " obex_service_driver_find(server->drivers, NULL,0, NULL, 0)" will return null.
>>
>> And I`m not picking up the first driver in the list, actually it is the only one in the list.
>
> In case of other profiles, there is OBEX connect command required, and then the appropriate driver will be selected in callback for OBEX connect event (see cmd_connect()).
>
> --
> Slawomir Bochenski
>
>
> Yep, you can get right diver after cmd_connect(). But I think user should get correct driver once obex session start, not after connect cmd. What if user want to use driver in obex_session_start() ? I need to use it when add OBEX over L2CAP.
> For OPP, it doesn`t register target and target size in opp.c. So when you call "obex_service_driver_find(server->drivers, NULL, 0, NULL, 0); ", it also returns on first and only list member:
>
> if (memncmp0(target, target_size, driver->target,driver->target_size) == 0) return driver;
> which is actually ===> if (memncmp0(NULL,0, NULL,0) == 0) return driver;
>
>
> So I think my patch is OK.
There is no guarantee that the opp will be the first in the list, nor
that the first driver will have no target which is consider the
default, so Im not sure why you are needing this for OBEX over L2CAP
since you still need to figure out what is the real driver on
connect_cmd. Also the sentence about the obex_session_start having to
get the correct driver makes no sense to me, we only know the target
on connect_cmd so we can only guess on obex_session_start that it is
an OPP session, or do you have a better default? Btw, if you are
planning to match the psm/channel with service driver, I believe that
is not a good idea since on some transports there could be no such
separation e.g. usb.
--
Luiz Augusto von Dentz
DQoNCi0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tDQpGcm9tOiBTbGF3b21pciBCb2NoZW5za2kg
W21haWx0bzpsa3NsYXdla0BnbWFpbC5jb21dIA0KU2VudDogMjAxMeW5tDbmnIgzMOaXpSAxODoy
Ng0KVG86IExpLCBOYW1pDQpDYzogTHVpeiBBdWd1c3RvIHZvbiBEZW50ejsgbGludXgtYmx1ZXRv
b3RoQHZnZXIua2VybmVsLm9yZw0KU3ViamVjdDogUmU6IFtQQVRDSCBvYmV4ZF0gUmV0dXJuIGNv
cnJlY3Qgb2JleCBzZXJ2aWNlIGRyaXZlciBpbiBvYmV4X3Nlc3Npb25fc3RhcnQNCg0KT24gVGh1
LCBKdW4gMzAsIDIwMTEgYXQgMTI6MDEgUE0sIExpLC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