ng_btsocket_rfcomm_receive_msc: Got MSC on dlci=18 in invalid state=5

Jack T jackt123 at gmail.com
Fri Apr 20 13:34:18 UTC 2007


Hi all: As part of my class project, I chose to write a simple
application using the Bluetooth Stack on FreeBSD.
My first task is to generate and receive OBEX messages.
Here is my code, and it does work (I get the correct reply codes
from my Bluetooth cellphone), but each time after my program ends,
the FreeBSD console emits the following 2 messages:

ng_btsocket_rfcomm_receive_msc: Got MSC on dlci=18 in invalid state=5
ng_btsocket_rfcomm_receive_dm: Got DM for non-existing dlci=18

Could someone point me in the right direction on
where I'm doing wrong? Thank you!

-- Here is the code for sending OBEX Connect --

// Populate my bluetooth socket
struct sockaddr_rfcomm me;
bzero(&me, sizeof(me));
me.rfcomm_family = AF_BLUETOOTH;
me.rfcomm_channel = 0;

// Populate peer bluetooth socket
struct sockaddr_rfcomm peer;
bzero(&peer, sizeof(peer));
peer.rfcomm_family = AF_BLUETOOTH;
peer.rfcomm_channel = 9;
bt_aton(peerAddress, &(peer.rfcomm_bdaddr));

// connect
int f = socket(AF_BLUETOOTH, SOCK_STREAM, BLUETOOTH_PROTO_RFCOMM);
if (bind(f, (void*)(&me), sizeof(me))!=0) { error... }
if (connect(f, (void*)(&peer), sizeof(peer))!=0) { error... }

// Send "CONNECT MSG" {Length=7; Version=0x10; Flags=0; MaxPacket=255}
unsigned char x[128] = { 0x80, 0, 7, 0x10, 0, 0, 0xff };
if (write(f,x,7)!=7) { error... }

// Read the reply
if (read(f,x,7)!=7) { error... }
printf("peer version = %d\n", (int)(x[3]));
printf("peer flag = 0x%02X\n", (int) (x[4]));
printf("max packet size = %d\n", (int)m);
fflush(stdout);


More information about the freebsd-bluetooth mailing list