2005-02-22 06:24:45

by Mohan K

[permalink] [raw]
Subject: [Bluez-users] trying to send data at HCI level

Hi all,
I am using two USB dongles on two different PCs. I want to send
and receive data on the either side at HCI level. I wrote one program
to send and receive the data, which is not working. I don't know how
to send and recevie the data at the HCI level. Previously I wrote
program for L2CAP level, which is working.
Can any any one help me to do at HCI level. I am using blueZ
stack in linux platform
The program is as follows:

/* program*/

size_t datlen;
int nb;
bdaddr_t bdaddr;
int opt, ptype, dd;
uint16_t handle;
uint8_t role;

role = 0x01;
ptype = HCI_DM1 | HCI_DM3 | HCI_DM5 | HCI_DH1 | HCI_DH3 | HCI_DH5;

str2ba("00:0B:0D:33:DA:F9", &bdaddr);

if (dev_id < 0) {
dev_id = hci_get_route(&bdaddr);
if (dev_id < 0) {
fprintf(stderr, "Device is not available.\n");
exit(1);
}
}

dd = hci_open_dev(dev_id);
if (dd < 0) {
perror("HCI device open failed");
exit(1);
}

if (hci_create_connection(dd, &bdaddr, htobs(ptype),
0, role, &handle, 25000) < 0)
perror("Can't create connection");

datlen=formpacket(0x01,0x04);

if ((nb=send(dd,&packet[0],(datlen+4),MSG_DONTWAIT))< 0)
{
perror("\nCan't send data.\n");
}
else
{
printf("\nNo. of bytes sent=%d\n",nb);
}


hci_close_dev(dd);


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users


2005-02-24 15:22:04

by BZ Benny

[permalink] [raw]
Subject: Re: [Bluez-users] trying to send data at HCI level

Hi,

I was trying to send HCI command i define all the
debug tools of buetooth.ko.
Therfore I create AF_Bluetooth socket family.
My data isn't received by my dongle.

for debuging I was searching for the command read()
from socket in the hci_sock.c side.
But I didn't find it.
I think that it's hci_sock_sendmsg() wich forward my
HCI command to hci_usb.ko.

but how bluetooth.ko layer catch my HCI command?

regards
benny








D?couvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
Cr?ez votre Yahoo! Mail sur http://fr.mail.yahoo.com/


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-22 08:03:19

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] trying to send data at HCI level

Hi Mohan,

> Thank you for your response. I need some clarifications.
> How to set the device device in RAW mode? In my program I opened the
> socket in RAW mode. Is it sufficient?

no, that is not enough. You must use "ioctl(dd, HCISETRAW, 1)".

Regards

Marcel




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users

2005-02-22 07:19:14

by Mohan K

[permalink] [raw]
Subject: Re: [Bluez-users] trying to send data at HCI level

Hi marcel,
Thank you for your response. I need some clarifications.
How to set the device device in RAW mode? In my program I opened the
socket in RAW mode. Is it sufficient?

Regards
Mohan

On Tue, 22 Feb 2005 08:05:31 +0100, Marcel Holtmann <[email protected]> wrote:
> Hi Mohan,
>
> > I am using two USB dongles on two different PCs. I want to send
> > and receive data on the either side at HCI level. I wrote one program
> > to send and receive the data, which is not working. I don't know how
> > to send and recevie the data at the HCI level. Previously I wrote
> > program for L2CAP level, which is working.
>
> it is a bad idea to send data directly at HCI level. However it is
> possible with BlueZ and in this case you must set the device into RAW
> mode, because otherwise L2CAP will handle incoming data.
>
> Regards
>
> Marcel
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Bluez-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-users
>

2005-02-22 07:05:31

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-users] trying to send data at HCI level

Hi Mohan,

> I am using two USB dongles on two different PCs. I want to send
> and receive data on the either side at HCI level. I wrote one program
> to send and receive the data, which is not working. I don't know how
> to send and recevie the data at the HCI level. Previously I wrote
> program for L2CAP level, which is working.

it is a bad idea to send data directly at HCI level. However it is
possible with BlueZ and in this case you must set the device into RAW
mode, because otherwise L2CAP will handle incoming data.

Regards

Marcel




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-users