linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aleksandar Kanchev <kanchev@in.tum.de>
To: bluez-users@lists.sourceforge.net
Subject: Re: [Bluez-users] broadcast packets
Date: Sun, 05 Feb 2006 22:54:05 +0100	[thread overview]
Message-ID: <43E673FD.8040005@in.tum.de> (raw)
In-Reply-To: <1136968575.26114.8.camel@localhost.localdomain>

Hi Marcel,

I was away for a while :) But here's what I'm trying to do:
I'm using 2 laptops with 2 Belkin class 2 USB bluetooth dongles. Both 
laptops are running linux with bluez.
I want to broadcast packets from the one side to the other. To do that 
I'm connection both laptops with the hcitool and then from the master 
side I'm using the following code:
  int dd, i, ret = -1, hci_dev;
  u_short handle, flags;

  char buf[HCI_ACL_HDR_SIZE + L2CAP_SIZE];
  hci_acl_hdr *acl_hdr = (hci_acl_hdr *) buf;
  l2cap_hdr *l2hdr = (l2cap_hdr *) (buf + HCI_ACL_HDR_SIZE);
  uint16_t *psm = (uint16_t *) (((char *) l2hdr) + L2CAP_HDR_SIZE);
  char *l2cap_data = ((char *) psm) + sizeof(uint16_t);

  struct iovec iv[2];
  uint8_t type = HCI_ACLDATA_PKT;

  hci_dev = hci_get_route(NULL);
  dd = hci_open_dev(hci_dev);

  handle = 1;
  flags |= ACL_START;
  flags |= ACL_ACTIVE_BCAST;
  acl_hdr->handle = htobs(acl_handle_pack(handle, flags));
  acl_hdr->dlen = htobs(L2CAP_SIZE);

  l2hdr->len = htobs(sizeof(uint16_t) + L2CAP_DATA_SIZE);
  l2hdr->cid = htobs(0x0002);
  *psm = htobs(4097);

  for (i = 0; i < L2CAP_DATA_SIZE; i++)
    l2cap_data[i] = 'A';

  iv[0].iov_base = &type;
  iv[0].iov_len = 1;
  iv[1].iov_base = buf;
  iv[1].iov_len = sizeof(buf);
  writev(dd, iv, 2);

I can see the packet being transmitted on the local master side (with 
hcidump) but the other end doesn't seem to see it. At least hcidump is 
not dumping the packet.

Thanks

Marcel Holtmann wrote:

>Hi Aleksandar,
>
>  
>
>>Marcel, could you please answer me that ? :)
>>    
>>
>
>I already told you everything I know and I have no idea why you still
>stick to the broadcast thing. Once you have established the piconet
>between two devices, you can use it to transfer data. Doing everything
>on HCI level is not a good idea. Use at least the L2CAP level for it,
>but you might need to add some kernel code to make it work properly. The
>broadcast stuff is not really used in any Bluetooth application so far.
>
>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://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
>_______________________________________________
>Bluez-users mailing list
>Bluez-users@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/bluez-users
>
>  
>



-------------------------------------------------------
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-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

  reply	other threads:[~2006-02-05 21:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-04 23:14 [Bluez-users] ms intellimouse/wheel p er
2006-01-05  0:26 ` Marcel Holtmann
2006-01-05 13:06   ` dave sailer
2006-01-07 17:24   ` [Bluez-users] " Nicolas STRANSKY
2006-01-08 15:53     ` [Bluez-users] broadcast packets Aleksandar Kanchev
2006-01-11  8:30       ` Aleksandar Kanchev
2006-01-11  8:36         ` Marcel Holtmann
2006-02-05 21:54           ` Aleksandar Kanchev [this message]
     [not found] <443E0664.50904@sacet.com>
     [not found] ` <443E08C5.7010307@sacet.com>
2006-04-13  8:22   ` [bluez-users] Broadcast Packets Laurent DANIEL

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=43E673FD.8040005@in.tum.de \
    --to=kanchev@in.tum.de \
    --cc=bluez-users@lists.sourceforge.net \
    /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;
as well as URLs for NNTP newsgroup(s).