linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Bluez-devel] sdp_record_register()
@ 2006-02-07 11:44 Ari Paavilainen
  2006-02-07 23:56 ` Marcel Holtmann
  0 siblings, 1 reply; 8+ messages in thread
From: Ari Paavilainen @ 2006-02-07 11:44 UTC (permalink / raw)
  To: bluez-devel

Hi,

Function call:
err = sdp_record_register(session, record, 0);
returns zero and error is 'Illegal seek'.
Arguments should be ok (session is return value of successful call to
sdp_connect() and record works ok with another function calls).
What might be wrong?

-Ari




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Bluez-devel] sdp_record_register()
  2006-02-07 11:44 Ari Paavilainen
@ 2006-02-07 23:56 ` Marcel Holtmann
  2006-02-08 11:27   ` Ari Paavilainen
  0 siblings, 1 reply; 8+ messages in thread
From: Marcel Holtmann @ 2006-02-07 23:56 UTC (permalink / raw)
  To: bluez-devel

Hi Ari,

> Function call:
> err = sdp_record_register(session, record, 0);
> returns zero and error is 'Illegal seek'.
> Arguments should be ok (session is return value of successful call to
> sdp_connect() and record works ok with another function calls).
> What might be wrong?

the sdp_connect() has been done to the local SDP server, right. You
can't register SDP records for remote connections.

Regards

Marcel




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Bluez-devel] sdp_record_register()
  2006-02-07 23:56 ` Marcel Holtmann
@ 2006-02-08 11:27   ` Ari Paavilainen
  2006-02-08 12:48     ` Marcel Holtmann
  0 siblings, 1 reply; 8+ messages in thread
From: Ari Paavilainen @ 2006-02-08 11:27 UTC (permalink / raw)
  To: bluez-devel

On Wed, 2006-02-08 at 00:56 +0100, Marcel Holtmann wrote:
> Hi Ari,
> 
> > Function call:
> > err = sdp_record_register(session, record, 0);
> > returns zero and error is 'Illegal seek'.
> > Arguments should be ok (session is return value of successful call to
> > sdp_connect() and record works ok with another function calls).
> > What might be wrong?
> 
> the sdp_connect() has been done to the local SDP server, right. You
> can't register SDP records for remote connections.
> 

In sdp_record_register() there is:

        if (!session->local) {
          errno = EREMOTE;
          return -1;
        }

Did you mean this by the remote connection (the program passes this test)? 
Anyway, it seems to be that the only way to sdp_record_register() return ESPIPE (Illegal seek) error is when call to sdp_send_req_w4_rsp() fails. Does this give any hint?

-Ari




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Bluez-devel] sdp_record_register()
  2006-02-08 11:27   ` Ari Paavilainen
@ 2006-02-08 12:48     ` Marcel Holtmann
  2006-02-10 11:45       ` Ari Paavilainen
  0 siblings, 1 reply; 8+ messages in thread
From: Marcel Holtmann @ 2006-02-08 12:48 UTC (permalink / raw)
  To: bluez-devel

Hi Ari,

> > > Function call:
> > > err = sdp_record_register(session, record, 0);
> > > returns zero and error is 'Illegal seek'.
> > > Arguments should be ok (session is return value of successful call to
> > > sdp_connect() and record works ok with another function calls).
> > > What might be wrong?
> > 
> > the sdp_connect() has been done to the local SDP server, right. You
> > can't register SDP records for remote connections.
> > 
> 
> In sdp_record_register() there is:
> 
>         if (!session->local) {
>           errno = EREMOTE;
>           return -1;
>         }
> 
> Did you mean this by the remote connection (the program passes this test)? 
> Anyway, it seems to be that the only way to sdp_record_register() return ESPIPE (Illegal seek) error is when call to sdp_send_req_w4_rsp() fails. Does this give any hint?

make sure that sdpd process is running. Follow the examples from sdptool
or pand.

Regards

Marcel




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Bluez-devel] sdp_record_register()
  2006-02-08 12:48     ` Marcel Holtmann
@ 2006-02-10 11:45       ` Ari Paavilainen
  2006-02-10 11:53         ` Bastien Nocera
  0 siblings, 1 reply; 8+ messages in thread
From: Ari Paavilainen @ 2006-02-10 11:45 UTC (permalink / raw)
  To: bluez-devel

On Wed, 2006-02-08 at 13:48 +0100, Marcel Holtmann wrote:
> Hi Ari,
> 
> > > > Function call:
> > > > err = sdp_record_register(session, record, 0);
> > > > returns zero and error is 'Illegal seek'.
> > > > Arguments should be ok (session is return value of successful call to
> > > > sdp_connect() and record works ok with another function calls).
> > > > What might be wrong?
> > > 
> > > the sdp_connect() has been done to the local SDP server, right. You
> > > can't register SDP records for remote connections.
> > > 
> > 
> > In sdp_record_register() there is:
> > 
> >         if (!session->local) {
> >           errno = EREMOTE;
> >           return -1;
> >         }
> > 
> > Did you mean this by the remote connection (the program passes this test)? 
> > Anyway, it seems to be that the only way to sdp_record_register() return ESPIPE (Illegal seek) error is when call to sdp_send_req_w4_rsp() fails. Does this give any hint?
> 
> make sure that sdpd process is running. Follow the examples from sdptool
> or pand.
> 

sdpd is running. In 'sdptool.c' there is no call to
'sdp_record_register()'. Is there any other examples of registering a
service record?

-Ari



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Bluez-devel] sdp_record_register()
  2006-02-10 11:45       ` Ari Paavilainen
@ 2006-02-10 11:53         ` Bastien Nocera
  0 siblings, 0 replies; 8+ messages in thread
From: Bastien Nocera @ 2006-02-10 11:53 UTC (permalink / raw)
  To: bluez-devel

On Fri, 2006-02-10 at 13:45 +0200, Ari Paavilainen wrote:
> On Wed, 2006-02-08 at 13:48 +0100, Marcel Holtmann wrote:
> > Hi Ari,
> > 
> > > > > Function call:
> > > > > err = sdp_record_register(session, record, 0);
> > > > > returns zero and error is 'Illegal seek'.
> > > > > Arguments should be ok (session is return value of successful call to
> > > > > sdp_connect() and record works ok with another function calls).
> > > > > What might be wrong?
> > > > 
> > > > the sdp_connect() has been done to the local SDP server, right. You
> > > > can't register SDP records for remote connections.
> > > > 
> > > 
> > > In sdp_record_register() there is:
> > > 
> > >         if (!session->local) {
> > >           errno = EREMOTE;
> > >           return -1;
> > >         }
> > > 
> > > Did you mean this by the remote connection (the program passes this test)? 
> > > Anyway, it seems to be that the only way to sdp_record_register() return ESPIPE (Illegal seek) error is when call to sdp_send_req_w4_rsp() fails. Does this give any hint?
> > 
> > make sure that sdpd process is running. Follow the examples from sdptool
> > or pand.
> > 
> 
> sdpd is running. In 'sdptool.c' there is no call to
> 'sdp_record_register()'. Is there any other examples of registering a
> service record?

This is the code to register Obex push support for GNOME's Bluetooth
utilities:
http://cvs.gnome.org/viewcvs/libbtctl/src/obexsdp.c?view=markup

---
Bastien Nocera <hadess@hadess.net> 
How can you be so serious on a film where you are dodging explosions and
running away with [...] an eight-foot monkey on this side, and the
eight-foot monkey is the one flying the spaceship? -- Mark Hamill



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bluez-devel] sdp_record_register()
@ 2006-02-20  8:39 ari.paavilainen
  2006-02-20 16:18 ` Albert Huang
  0 siblings, 1 reply; 8+ messages in thread
From: ari.paavilainen @ 2006-02-20  8:39 UTC (permalink / raw)
  To: bluez-devel

Hi,

I found following thing in sdp_record_register():
The comment in source code tells that the function returns non-null pointer on 
success and -1 on failure. I have investigated the code and found out that the 
function returns only 0 or -1:
There are two return commands in the function: return -1; and return status; 
and for status: status=-1; and status = sdp_send_req_w4_rsp(...); In 
sdp_send_req_w4_rsp() there is three times return -1; and one return 0;
So, is the return value zero success here?

But the main problem here is that I can't register a bluetooth service with 
the sdp_record_register() ('sdptool browse local' doesn't list it). I have used 
following code (by Albert Huang):
All function calls succeed.

sdp_session_t *register_service()
{
    int ret;
    uint32_t service_uuid_int[] = { 0, 0, 0, 0xABCD };
    uint8_t rfcomm_channel = 11;
    const char *service_name = "Name";
    const char *service_dsc = "Description";
    const char *service_prov = "Service provider";

    uuid_t root_uuid, l2cap_uuid, rfcomm_uuid, svc_uuid;
    sdp_list_t *l2cap_list = 0, 
               *rfcomm_list = 0,
               *root_list = 0,
               *proto_list = 0, 
               *access_proto_list = 0;
    sdp_data_t *channel = 0, *psm = 0;

    sdp_record_t *record = sdp_record_alloc();

    // set the general service ID
    sdp_uuid128_create( &svc_uuid, &service_uuid_int );
    sdp_set_service_id(record, svc_uuid );

    // make the service record publicly browsable
    sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP); 
    root_list = sdp_list_append(0, &root_uuid);
    sdp_set_browse_groups(record, root_list );

    // set l2cap information
    sdp_uuid16_create(&l2cap_uuid, L2CAP_UUID);
    l2cap_list = sdp_list_append( 0, &l2cap_uuid );
    proto_list = sdp_list_append( 0, l2cap_list );

    // set rfcomm information
    sdp_uuid16_create(&rfcomm_uuid, RFCOMM_UUID); 
    channel = sdp_data_alloc(SDP_UINT8, &rfcomm_channel);
    rfcomm_list = sdp_list_append( 0, &rfcomm_uuid );
    sdp_list_append( rfcomm_list, channel ); 
    sdp_list_append( proto_list, rfcomm_list );

    // attach protocol information to service record
    access_proto_list = sdp_list_append( 0, proto_list );
    sdp_set_access_protos( record, access_proto_list );

    // set the name, provider, and description
    sdp_set_info_attr(record, service_name, service_prov, service_dsc);

    int err = 0;
    sdp_session_t *session = 0;
    // connect to the local SDP server, register the service record, and 
    // disconnect
    session = sdp_connect( BDADDR_ANY, BDADDR_LOCAL, SDP_RETRY_IF_BUSY );
    err = sdp_record_register(session, record, 0);

    // cleanup
    sdp_data_free( channel );
    sdp_list_free( l2cap_list, 0 );
    sdp_list_free( rfcomm_list, 0 );
    sdp_list_free( root_list, 0 );
    sdp_list_free( access_proto_list, 0 );

    return session;
}



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Bluez-devel] sdp_record_register()
  2006-02-20  8:39 [Bluez-devel] sdp_record_register() ari.paavilainen
@ 2006-02-20 16:18 ` Albert Huang
  0 siblings, 0 replies; 8+ messages in thread
From: Albert Huang @ 2006-02-20 16:18 UTC (permalink / raw)
  To: bluez-devel

[-- Attachment #1: Type: text/plain, Size: 661 bytes --]

> I found following thing in sdp_record_register():
> The comment in source code tells that the function returns non-null
> pointer on
> success and -1 on failure. I have investigated the code and found out that
> the
> function returns only 0 or -1:


what version of bluez are you using?  The latest versions don't say this, in
either sdp.h or sdp_lib.h

There are two return commands in the function: return -1; and return status;
> and for status: status=-1; and status = sdp_send_req_w4_rsp(...); In
> sdp_send_req_w4_rsp() there is three times return -1; and one return 0;
> So, is the return value zero success here?
>

yes.

-albert

[-- Attachment #2: Type: text/html, Size: 1001 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-02-20 16:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-20  8:39 [Bluez-devel] sdp_record_register() ari.paavilainen
2006-02-20 16:18 ` Albert Huang
  -- strict thread matches above, loose matches on Subject: below --
2006-02-07 11:44 Ari Paavilainen
2006-02-07 23:56 ` Marcel Holtmann
2006-02-08 11:27   ` Ari Paavilainen
2006-02-08 12:48     ` Marcel Holtmann
2006-02-10 11:45       ` Ari Paavilainen
2006-02-10 11:53         ` Bastien Nocera

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).