linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Bluez-devel] L2CAP chnnel
@ 2005-09-14  6:54 Артем Бизюков
  2005-09-14  9:20 ` Stephen Crane
  2005-09-14 13:15 ` Marcel Holtmann
  0 siblings, 2 replies; 3+ messages in thread
From: Артем Бизюков @ 2005-09-14  6:54 UTC (permalink / raw)
  To: bluez-devel


Hellow all.

    I`m try to write application that send and recive data over L2CAP channel, between PC and my custom arm board. I have a next problem. I dont understand haw create a socket, if PC must inquirying and connect to my board. Device must remain slave in piconnect.
    I`m try run next simpl daemon on my custom arm board:

	struct sockaddr_l2 L2capAddr;
	int iSockFd;
	iSockFd = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_L2CAP);
	if (iSockFd == -1) {
		TRACE1("opening L2CAP socket: %s", strerror(errno));
		return -1;
	};
	L2capAddr.l2_bdaddr = *BDADDR_ANY;
	/*L2capAddr.l2_bdaddr = *strtoba( strdup("78:A1:1F:96:A0:00"));*/
	L2capAddr.l2_family = AF_BLUETOOTH;
	L2capAddr.l2_psm    = htobs(SDP_PSM); // I sigth this valuer in Tsimbal code
	if(0 > bind(iSockFd, (struct sockaddr *)&L2capAddr, sizeof(L2capAddr)))
	{
		TRACE1("binding L2CAP socket: %s", strerror(errno));
		return -1;
	}
	incoming = listen(iSockFd, ACTIVE_CONN_MAX);

But ACL connection don`t establishing. The hcidump on board give next chat

> HCI Event: Connect Request (0x04) plen 10
  78 A1 1F 96 A0 00 04 5F 00 01
< HCI Command: Accept Connection Request (0x01|0x0009) plen 7
  78 A1 1F 96 A0 00 01
> HCI Event: Command Status (0x0f) plen 4
  00 01 09 04
> HCI Event: Link Key Request (0x17) plen 6
  78 A1 1F 96 A0 00
< HCI Command: Link Key Request Negative Reply (0x01|0x000c) plen 6
  78 A1 1F 96 A0 00
> HCI Event: Command Complete (0x0e) plen 10
  01 0C 04 00 78 A1 1F 96 A0 00
> HCI Event: PIN Code Request (0x16) plen 6
  78 A1 1F 96 A0 00
< HCI Command: PIN Code Request Reply (0x01|0x000d) plen 23
  78 A1 1F 96 A0 00 10 xx xx xx xx xx xx xx xx xx xx xx xx xx
  xx xx xx
> HCI Event: Command Complete (0x0e) plen 10
  01 0D 04 00 78 A1 1F 96 A0 00
< HCI Command: Accept Connection Request (0x01|0x0009) plen 7
  78 A1 1F 96 A0 00 01
> HCI Event: Command Status (0x0f) plen 4
  0C 01 09 04
> HCI Event: Link Key Notification (0x18) plen 23
  78 A1 1F 96 A0 00 xx xx xx xx xx xx xx xx xx xx xx xx xx xx
  xx xx xx
> HCI Event: Connect Complete (0x03) plen 11
  00 28 00 78 A1 1F 96 A0 00 01 00
< HCI Command: Change Connection Packet Type (0x01|0x000f) plen 4
  28 00 18 CC
> HCI Event: Page Scan Repetition Mode Change (0x20) plen 7
  78 A1 1F 96 A0 00 01
> HCI Event: Command Status (0x0f) plen 4
  00 01 0F 04
> HCI Event: Connection Packet Type Changed (0x1d) plen 5
  00 28 00 18 CC
> HCI Event: Max Slots Change (0x1b) plen 3
  28 00 05
< HCI Command: PIN Code Request Reply (0x01|0x000d) plen 4
  28 00 00 00
> HCI Event: Command Complete (0x0e) plen 10
  01 0D 04 12 28 00 00 00 00 00
< HCI Command: Write Scan Enable (0x03|0x001a) plen 1
  00
> HCI Event: Command Complete (0x0e) plen 4
  01 1A 0C 00
> HCI Event: QoS Setup Complete (0x0d) plen 21
  00 28 00 00 01 00 00 00 00 00 00 00 00 FF FF FF FF FF FF FF
  FF
> ACL data: handle 0x0028 flags 0x02 dlen 12
    L2CAP(s): Connect req: psm 1 scid 0x0040
< ACL data: handle 0x0028 flags 0x02 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0000 scid 0x0040 result 2 status 0
> HCI Event: Number of Completed Packets (0x13) plen 5
  01 28 00 01 00
> HCI Event: Disconn Complete (0x05) plen 4
  00 28 00 13

And my board don`t response on HCI inquiryng from PC. I must restart hciattach.
I think, i incorrectly open L2CAP socket. Somebody help me please.






-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. 
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] L2CAP chnnel
  2005-09-14  6:54 [Bluez-devel] L2CAP chnnel Артем Бизюков
@ 2005-09-14  9:20 ` Stephen Crane
  2005-09-14 13:15 ` Marcel Holtmann
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Crane @ 2005-09-14  9:20 UTC (permalink / raw)
  To: bluez-devel

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

Try replacing SOCK_RAW with SOCK_SEQPACKET. SOCK_RAW is only for raw HCI
sockets.

On Wed, 2005-09-14 at 10:54 +0400, Артем Бизюков wrote:
> Hellow all.
> 
>     I`m try to write application that send and recive data over L2CAP channel, between PC and my custom arm board. I have a next problem. I dont understand haw create a socket, if PC must inquirying and connect to my board. Device must remain slave in piconnect.
>     I`m try run next simpl daemon on my custom arm board:
> 
> 	struct sockaddr_l2 L2capAddr;
> 	int iSockFd;
> 	iSockFd = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_L2CAP);
> 	if (iSockFd == -1) {
> 		TRACE1("opening L2CAP socket: %s", strerror(errno));
> 		return -1;
> 	};
> 	L2capAddr.l2_bdaddr = *BDADDR_ANY;
> 	/*L2capAddr.l2_bdaddr = *strtoba( strdup("78:A1:1F:96:A0:00"));*/
> 	L2capAddr.l2_family = AF_BLUETOOTH;
> 	L2capAddr.l2_psm    = htobs(SDP_PSM); // I sigth this valuer in Tsimbal code
> 	if(0 > bind(iSockFd, (struct sockaddr *)&L2capAddr, sizeof(L2capAddr)))
> 	{
> 		TRACE1("binding L2CAP socket: %s", strerror(errno));
> 		return -1;
> 	}
> 	incoming = listen(iSockFd, ACTIVE_CONN_MAX);
> 
> But ACL connection don`t establishing. The hcidump on board give next chat
> 
> > HCI Event: Connect Request (0x04) plen 10
>   78 A1 1F 96 A0 00 04 5F 00 01
> < HCI Command: Accept Connection Request (0x01|0x0009) plen 7
>   78 A1 1F 96 A0 00 01
> > HCI Event: Command Status (0x0f) plen 4
>   00 01 09 04
> > HCI Event: Link Key Request (0x17) plen 6
>   78 A1 1F 96 A0 00
> < HCI Command: Link Key Request Negative Reply (0x01|0x000c) plen 6
>   78 A1 1F 96 A0 00
> > HCI Event: Command Complete (0x0e) plen 10
>   01 0C 04 00 78 A1 1F 96 A0 00
> > HCI Event: PIN Code Request (0x16) plen 6
>   78 A1 1F 96 A0 00
> < HCI Command: PIN Code Request Reply (0x01|0x000d) plen 23
>   78 A1 1F 96 A0 00 10 xx xx xx xx xx xx xx xx xx xx xx xx xx
>   xx xx xx
> > HCI Event: Command Complete (0x0e) plen 10
>   01 0D 04 00 78 A1 1F 96 A0 00
> < HCI Command: Accept Connection Request (0x01|0x0009) plen 7
>   78 A1 1F 96 A0 00 01
> > HCI Event: Command Status (0x0f) plen 4
>   0C 01 09 04
> > HCI Event: Link Key Notification (0x18) plen 23
>   78 A1 1F 96 A0 00 xx xx xx xx xx xx xx xx xx xx xx xx xx xx
>   xx xx xx
> > HCI Event: Connect Complete (0x03) plen 11
>   00 28 00 78 A1 1F 96 A0 00 01 00
> < HCI Command: Change Connection Packet Type (0x01|0x000f) plen 4
>   28 00 18 CC
> > HCI Event: Page Scan Repetition Mode Change (0x20) plen 7
>   78 A1 1F 96 A0 00 01
> > HCI Event: Command Status (0x0f) plen 4
>   00 01 0F 04
> > HCI Event: Connection Packet Type Changed (0x1d) plen 5
>   00 28 00 18 CC
> > HCI Event: Max Slots Change (0x1b) plen 3
>   28 00 05
> < HCI Command: PIN Code Request Reply (0x01|0x000d) plen 4
>   28 00 00 00
> > HCI Event: Command Complete (0x0e) plen 10
>   01 0D 04 12 28 00 00 00 00 00
> < HCI Command: Write Scan Enable (0x03|0x001a) plen 1
>   00
> > HCI Event: Command Complete (0x0e) plen 4
>   01 1A 0C 00
> > HCI Event: QoS Setup Complete (0x0d) plen 21
>   00 28 00 00 01 00 00 00 00 00 00 00 00 FF FF FF FF FF FF FF
>   FF
> > ACL data: handle 0x0028 flags 0x02 dlen 12
>     L2CAP(s): Connect req: psm 1 scid 0x0040
> < ACL data: handle 0x0028 flags 0x02 dlen 16
>     L2CAP(s): Connect rsp: dcid 0x0000 scid 0x0040 result 2 status 0
> > HCI Event: Number of Completed Packets (0x13) plen 5
>   01 28 00 01 00
> > HCI Event: Disconn Complete (0x05) plen 4
>   00 28 00 13
> 
> And my board don`t response on HCI inquiryng from PC. I must restart hciattach.
> I think, i incorrectly open L2CAP socket. Somebody help me please.
> 
> 
> 
> 
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo App Server. 
> Download it for free - -and be entered to win a 42" plasma tv or your very
> own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
> _______________________________________________
> Bluez-devel mailing list
> Bluez-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
-- 
Stephen Crane, Rococo Software Ltd. http://www.rococosoft.com
steve.crane@rococosoft.com +353-1-6601315 (ext 209)

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [Bluez-devel] L2CAP chnnel
  2005-09-14  6:54 [Bluez-devel] L2CAP chnnel Артем Бизюков
  2005-09-14  9:20 ` Stephen Crane
@ 2005-09-14 13:15 ` Marcel Holtmann
  1 sibling, 0 replies; 3+ messages in thread
From: Marcel Holtmann @ 2005-09-14 13:15 UTC (permalink / raw)
  To: bluez-devel

Hi,

>     I`m try to write application that send and recive data over L2CAP channel, between PC and my custom arm board. I have a next problem. I dont understand haw create a socket, if PC must inquirying and connect to my board. Device must remain slave in piconnect.
>     I`m try run next simpl daemon on my custom arm board:
> 
> 	struct sockaddr_l2 L2capAddr;
> 	int iSockFd;
> 	iSockFd = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_L2CAP);
> 	if (iSockFd == -1) {
> 		TRACE1("opening L2CAP socket: %s", strerror(errno));
> 		return -1;
> 	};
> 	L2capAddr.l2_bdaddr = *BDADDR_ANY;
> 	/*L2capAddr.l2_bdaddr = *strtoba( strdup("78:A1:1F:96:A0:00"));*/
> 	L2capAddr.l2_family = AF_BLUETOOTH;
> 	L2capAddr.l2_psm    = htobs(SDP_PSM); // I sigth this valuer in Tsimbal code
> 	if(0 > bind(iSockFd, (struct sockaddr *)&L2capAddr, sizeof(L2capAddr)))
> 	{
> 		TRACE1("binding L2CAP socket: %s", strerror(errno));
> 		return -1;
> 	}
> 	incoming = listen(iSockFd, ACTIVE_CONN_MAX);
> 
> But ACL connection don`t establishing. The hcidump on board give next chat

what about using "hcidump -X -V", because I am no longer decoding hex
numbers.

Regards

Marcel




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. 
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

end of thread, other threads:[~2005-09-14 13:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-14  6:54 [Bluez-devel] L2CAP chnnel Артем Бизюков
2005-09-14  9:20 ` Stephen Crane
2005-09-14 13:15 ` Marcel Holtmann

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).