Hi, Luiz -----Original Message----- From: Luiz Augusto von Dentz [mailto:luiz.dentz@xxxxxxxxx] Sent: 2011年6月30日 16:25 To: Li, Nami Cc: linux-bluetooth@xxxxxxxxxxxxxxx; Li, Nami Subject: Re: [PATCH obexd] Return correct obex service driver in obex_session_start Hi, On Thu, Jun 30, 2011 at 10:34 AM, Hui Li <nami.li@xxxxxxxxxxx> wrote: > From: Hui Li <nami@xxxxxxxxxxxxxxxx> > > 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 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. Regards, Nami ��.n��������+%������w��{.n�����{����^n�r������&��z�ޗ�zf���h���~����������_��+v���)ߣ�