Linux bluetooth development
 help / color / mirror / Atom feed
From: jan d tux <janice@asti.dost.gov.ph>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: BlueZ Mailing List <bluez-users@lists.sourceforge.net>
Subject: Re: [Bluez-users] bizzare result when getting the bluetooth address
Date: 03 Feb 2004 10:57:27 +0800	[thread overview]
Message-ID: <1075777047.1362.42.camel@Asgard> (raw)
In-Reply-To: <1075722905.29899.10.camel@pegasus>

Thanks Marcel.

I have already inserted a len=sizeof(sa) before calling getpeername but
the result is still the same.

On Mon, 2004-02-02 at 19:55, Marcel Holtmann wrote:
> Hi Jan,
> 
> > Can anybody help me figure out why the bluetooth address I am getting is
> > not right?
> > 
> > What I am trying to do is get the bluetooth address of the sender/peer
> > to my obex server.
> > 
> > Here are the obex calls I made:
> > --------
> > 	handle = OBEX_Init(OBEX_TRANS_BLUETOOTH, obex_event, 0);
> > 
> > 	BtOBEX_ServerRegister(handle, NULL, OBEX_PUSH_HANDLE);
> > 
> > 	btobex_accept(handle);
> > 
> > 	OBEX_HandleInput(handle, 1);
> > 
> > 	//get addresss
> > 	
> > 	fd = OBEX_GetFD(handle);
> > 	if( fd < 0 )
> > 		return 0;
> > 
> > 	getpeername(fd,(struct sockaddr *)&sa,&len)
> > 		return 0;
> > 
> > 	baswap(&bdaddr, &sa.rc_bdaddr);
> > 	printf("\tADDRESS: %s\n", batostr(&bdaddr));
> > --------
> > 
> > 
> > when i run the program, i was able to get the following:
> >         channel: 10	
> >         family: 31
> >         ADDRESS 2: 00:0A:00:02:EE:69 -> this is not the bluetooth
> > address of the sender!!! Its address is 00:02:EE:69:E1:88. The last for
> > digits displayed are the 1st four digits of the device's real address. I
> > tried it with another device and the result is the same, from the
> > original address (00:E0:03:74:38:8E) to 00:0A:00:E0:03:74.
> 
> insert a "len = sizeof(sa)" before you call getpeername().
> 
> Regards
> 
> Marcel
> 

  reply	other threads:[~2004-02-03  2:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-02  9:34 [Bluez-users] bizzare result when getting the bluetooth address jan d tux
2004-02-02 11:55 ` Marcel Holtmann
2004-02-03  2:57   ` jan d tux [this message]
2004-02-03 11:30     ` Marcel Holtmann
2004-02-04  1:33       ` jan d tux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1075777047.1362.42.camel@Asgard \
    --to=janice@asti.dost.gov.ph \
    --cc=bluez-users@lists.sourceforge.net \
    --cc=marcel@holtmann.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox