* [Bluez-users] trying to send data at HCI level
@ 2005-02-22 6:24 Mohan K
2005-02-22 7:05 ` Marcel Holtmann
2005-02-24 15:22 ` BZ Benny
0 siblings, 2 replies; 10+ messages in thread
From: Mohan K @ 2005-02-22 6:24 UTC (permalink / raw)
To: bluez-users
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
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Bluez-users] trying to send data at HCI level
2005-02-22 6:24 [Bluez-users] trying to send data at HCI level Mohan K
@ 2005-02-22 7:05 ` Marcel Holtmann
2005-02-22 7:19 ` Mohan K
2005-02-24 15:22 ` BZ Benny
1 sibling, 1 reply; 10+ messages in thread
From: Marcel Holtmann @ 2005-02-22 7:05 UTC (permalink / raw)
To: BlueZ Mailing List
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
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Bluez-users] trying to send data at HCI level
2005-02-22 7:05 ` Marcel Holtmann
@ 2005-02-22 7:19 ` Mohan K
2005-02-22 8:03 ` Marcel Holtmann
0 siblings, 1 reply; 10+ messages in thread
From: Mohan K @ 2005-02-22 7:19 UTC (permalink / raw)
To: bluez-users; +Cc: marcel
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 <marcel@holtmann.org> 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
> Bluez-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bluez-users
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Bluez-users] trying to send data at HCI level
2005-02-22 7:19 ` Mohan K
@ 2005-02-22 8:03 ` Marcel Holtmann
[not found] ` <7aa80ced050222002338e57eaf@mail.gmail.com>
0 siblings, 1 reply; 10+ messages in thread
From: Marcel Holtmann @ 2005-02-22 8:03 UTC (permalink / raw)
To: Mohan K; +Cc: BlueZ Mailing List
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
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Bluez-users] trying to send data at HCI level
[not found] ` <7aa80ced0502220057379ef414@mail.gmail.com>
@ 2005-02-22 9:56 ` Marcel Holtmann
[not found] ` <7aa80ced0502220231161c0a3@mail.gmail.com>
0 siblings, 1 reply; 10+ messages in thread
From: Marcel Holtmann @ 2005-02-22 9:56 UTC (permalink / raw)
To: Mohan K; +Cc: BlueZ Mailing List
Hi Mohan,
> Thank you for your valuable information. I am new to
> Bluetooth. Anyhow I have written L2CAP level send & recv program
> successfully. In the L2CAP level, on the sending end, I created a
> socket and transmitted the data using "send" function. Whereas on recv
> side I created a small server program, which listens for connection
> and receives the data using "read" function. I am trying to use the
> same functions in the HCI level also.
> Can I use the same send and recv functions in the HCI
> level after creating the HCI RAW sockets? If it is not possible, could
> you please tell me which function I have to use to send and recv the
> data in the HCI level?
this won't work, because HCI is a raw socket and L2CAP is sequential
packet socket. If you wanna use HCI then you have to conform to the H:4
specification and send everything in this format.
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
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Bluez-users] trying to send data at HCI level
[not found] ` <7aa80ced0502220231161c0a3@mail.gmail.com>
@ 2005-02-22 10:39 ` Marcel Holtmann
[not found] ` <7aa80ced050222024634dce552@mail.gmail.com>
2005-02-25 8:25 ` BZ Benny
0 siblings, 2 replies; 10+ messages in thread
From: Marcel Holtmann @ 2005-02-22 10:39 UTC (permalink / raw)
To: Mohan K; +Cc: BlueZ Mailing List
Hi Mohan,
> Thanks a lot. Is there any API function available in
> blueZ to send and recv the data at HCI level. I am using USB bluetooth
> dongles on the both PC's
since this is a raw socket you can also use read() and write(), but you
must conform to the H:4 host transport specification.
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
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Fwd: [Bluez-users] trying to send data at HCI level
[not found] ` <7aa80ced050222024634dce552@mail.gmail.com>
@ 2005-02-22 10:51 ` Marcel Holtmann
0 siblings, 0 replies; 10+ messages in thread
From: Marcel Holtmann @ 2005-02-22 10:51 UTC (permalink / raw)
To: Mohan K; +Cc: BlueZ Mailing List
Hi Mohan,
> Whether I want to establish the connection between two
> PC's, like L2CAP?. Can I directly read or write using the raw socket?
> I saw a function "hci_create_connection" in hci.c!
HCI is the host controller interface and you should not use it for
direct communication between two devices. It is the hardware abstraction
of Bluetooth. Use L2CAP instead.
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
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Bluez-users] trying to send data at HCI level
2005-02-22 6:24 [Bluez-users] trying to send data at HCI level Mohan K
2005-02-22 7:05 ` Marcel Holtmann
@ 2005-02-24 15:22 ` BZ Benny
1 sibling, 0 replies; 10+ messages in thread
From: BZ Benny @ 2005-02-24 15:22 UTC (permalink / raw)
To: bluez-users
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
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Bluez-users] trying to send data at HCI level
2005-02-22 10:39 ` Marcel Holtmann
[not found] ` <7aa80ced050222024634dce552@mail.gmail.com>
@ 2005-02-25 8:25 ` BZ Benny
2005-02-25 9:03 ` Marcel Holtmann
1 sibling, 1 reply; 10+ messages in thread
From: BZ Benny @ 2005-02-25 8:25 UTC (permalink / raw)
To: bluez-users
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
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Bluez-users] trying to send data at HCI level
2005-02-25 8:25 ` BZ Benny
@ 2005-02-25 9:03 ` Marcel Holtmann
0 siblings, 0 replies; 10+ messages in thread
From: Marcel Holtmann @ 2005-02-25 9:03 UTC (permalink / raw)
To: bluez-users
Hi Benny,
> 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?
I have no idea what you are doing, but the HCI raw socket allows you to
send any command you like. Look at the library source code for more
information.
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
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2005-02-25 9:03 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-22 6:24 [Bluez-users] trying to send data at HCI level Mohan K
2005-02-22 7:05 ` Marcel Holtmann
2005-02-22 7:19 ` Mohan K
2005-02-22 8:03 ` Marcel Holtmann
[not found] ` <7aa80ced050222002338e57eaf@mail.gmail.com>
[not found] ` <7aa80ced0502220057379ef414@mail.gmail.com>
2005-02-22 9:56 ` Marcel Holtmann
[not found] ` <7aa80ced0502220231161c0a3@mail.gmail.com>
2005-02-22 10:39 ` Marcel Holtmann
[not found] ` <7aa80ced050222024634dce552@mail.gmail.com>
2005-02-22 10:51 ` Fwd: " Marcel Holtmann
2005-02-25 8:25 ` BZ Benny
2005-02-25 9:03 ` Marcel Holtmann
2005-02-24 15:22 ` BZ Benny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox