• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Help! Sending RFCOMM packet over L2CAP fails.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help! Sending RFCOMM packet over L2CAP fails.


  • Subject: Re: Help! Sending RFCOMM packet over L2CAP fails.
  • From: Marco Pontil <email@hidden>
  • Date: Fri, 11 Nov 2005 08:45:59 -0800

This happens because the Apple RFCOMM implementation matches
on the L2CAP channel with PSM 3 much before yours, and then makes
that L2CAP channel unavailable to anybody else (there can be only one client).


I would recommend you to use the Apple OBEX implementation, aside
of the fact that it would workaround this specific issue it will save you a
lot of work, it has really easy to use apis, and has been extensively tested.


Should you decide to use your own obex, just build the connection over
the RFCOMM APIs instead than building your own RFCOMM stack.

	... Marco



On Nov 11, 2005, at 3:54 AM, Esa Karjalainen wrote:

Greetings.

I've been working on an application, which builds an RFCOMM (OBEX)
packet directly on top of L2Cap. The initialization of  the connection
seems to go okay.

However, Writing, i.e. writeSync always fails. it returns
kIOReturnNotPrivileged. (0xe00002c1). Is L2Cap access somehow restricted,
to disallow direct creation of RFCOMM connections?


I ran the program as root. ( I sudo'ed the application, I sudo su'd, _then_
ran it - didn't help. )


Interestingly enough, SDP works fine built over L2Cap.

Another question:

The class IOBluetoothHCIController. Does any documentation exist of
that class? I'd very much like being able to access the HCI layer.


Thanks,

 - Esa






Here's the relevant parts of the code:

Creating the connection:
---------------
NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init];
IOBluetoothDevice* blue_device = [super getDevice:target];
if (blue_device == NULL) {
if (debug) {
printf("Unable to get the Bluetooth device\n");
}
[super connectionAttempt:false];
[localPool release];
return false;
}
if ([blue_device openConnection] != kIOReturnSuccess) {
if (debug) {
printf("Failed to open a connection to the bluetooth device. \n");
}
[super connectionAttempt:false];
[localPool release];
return false;
}
IOReturn ioret = [blue_device openL2CAPChannelSync:&l2capChannel
withPSM:psm delegate:self];
[l2capChannel retain];
if (ioret != kIOReturnSuccess) {
if (debug) {
printf("Failed to open a L2CAP channel. \n");
}
[super connectionAttempt:false];
[localPool release];
return false;
}


  [super connectionAttempt:true];
  [localPool release];

  return true;
}

---------------
Send:
---------------

- (bool)send:(char*)data len:(int)len
{
  IOReturn ioret;
  ioret = [l2capChannel writeSync:data length:len];
  if (ioret != kIOReturnSuccess) {
    if (debug){
      printf("RAWDEBUG: Write failed, ioret: 0x%x\n", ioret);
    }
    return false;
  }
  return true;
}


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Bluetooth-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40apple.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Bluetooth-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Help! Sending RFCOMM packet over L2CAP fails. (From: Esa Karjalainen <email@hidden>)

  • Prev by Date: Help! Sending RFCOMM packet over L2CAP fails.
  • Next by Date: Re: Bluetooth-dev Digest, Vol 2, Issue 85
  • Previous by thread: Help! Sending RFCOMM packet over L2CAP fails.
  • Next by thread: Re: Bluetooth-dev Digest, Vol 2, Issue 85
  • Index(es):
    • Date
    • Thread