All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bluez-devel] Role switch: Detecting, predicting, preventing
@ 2007-02-15  6:04 Art Rothstein
  2007-02-15  8:18 ` Marcel Holtmann
  0 siblings, 1 reply; 4+ messages in thread
From: Art Rothstein @ 2007-02-15  6:04 UTC (permalink / raw)
  To: Bluez-devel

I am running two BTPROTO_RFCOMM applications on a PC with Ubuntu 2.6.17-11-386, 
each bound to its own USB dongle.  One is a client, the other a server.  Both 
use the existing link mode settings of SLAVE ACCEPT.  Yet an Accept Connection 
Request (traced with hcidump) shows Role Master, and the client receives a Role 
Change.

If I put the same application, with the same USB dongles, on a PC running 
Xubuntu 2.6.17-10-generic, the server's Accept Connection Request shows Role 
Slave, and the Role Change packet does not flow.

My questions:

(1) What causes the role switch?

(2) Can I detect the role switch programmatically after it has occurred?  Both 
hci_devinfo and getsockopt( s, SOL_RFCOMM, RFCOMM_LM, ...  ) claim the server is 
still a slave.

(3) Can I predict the role switch before it occurs?  Again, hci_devinfo and 
getsockopt provide no clues.

(4) Can I programmatically instruct the 2.6.17-11-386 server not to perform the 
role switch?  If hci_devinfo is already set to SLAVE, calling 
ioctl(HCISETLINKMODE) sounds unpromising.

What makes the role switch interesting, and undesirable, is that several 
Bluetooth devices (all devices with link manager 1.x?) are limited to two slave 
connections.  A third Create Connection fails with Command Disallowed, reflected 
to the Linux client application as "File descriptor in bad state".

As for motivation, I plan to use one Linux PC with lots of dongles to model the 
behavior of a large piconet.  A configuration that includes PCs running 
Microsoft's stack, or Macs running Apple's stack, is stuck with the role switch, 
but there are lots of configurations that use only peer-friendly devices.
-----
McKinley Systems
San Francisco
415-827-7575
http://www.mojo-working.com

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] Role switch: Detecting, predicting, preventing
  2007-02-15  6:04 [Bluez-devel] Role switch: Detecting, predicting, preventing Art Rothstein
@ 2007-02-15  8:18 ` Marcel Holtmann
  2007-02-15 23:30   ` Art Rothstein
  2007-03-02 17:35   ` Art Rothstein
  0 siblings, 2 replies; 4+ messages in thread
From: Marcel Holtmann @ 2007-02-15  8:18 UTC (permalink / raw)
  To: BlueZ development

Hi Art,

> I am running two BTPROTO_RFCOMM applications on a PC with Ubuntu 2.6.17-11-386, 
> each bound to its own USB dongle.  One is a client, the other a server.  Both 
> use the existing link mode settings of SLAVE ACCEPT.  Yet an Accept Connection 
> Request (traced with hcidump) shows Role Master, and the client receives a Role 
> Change.
> 
> If I put the same application, with the same USB dongles, on a PC running 
> Xubuntu 2.6.17-10-generic, the server's Accept Connection Request shows Role 
> Slave, and the Role Change packet does not flow.
> 
> My questions:
> 
> (1) What causes the role switch?

no idea for your case. I need to see your code and hcidump first.

> (2) Can I detect the role switch programmatically after it has occurred?  Both 
> hci_devinfo and getsockopt( s, SOL_RFCOMM, RFCOMM_LM, ...  ) claim the server is 
> still a slave.

You need to check hci_conn_info.

> (3) Can I predict the role switch before it occurs?  Again, hci_devinfo and 
> getsockopt provide no clues.

No.

> (4) Can I programmatically instruct the 2.6.17-11-386 server not to perform the 
> role switch?  If hci_devinfo is already set to SLAVE, calling 
> ioctl(HCISETLINKMODE) sounds unpromising.

Not that I know of. The slave mode is passive and an active MASTER wins.
However you can disable the role switch link policy, but be aware of
that this might cause other problems.

> What makes the role switch interesting, and undesirable, is that several 
> Bluetooth devices (all devices with link manager 1.x?) are limited to two slave 
> connections.  A third Create Connection fails with Command Disallowed, reflected 
> to the Linux client application as "File descriptor in bad state".
> 
> As for motivation, I plan to use one Linux PC with lots of dongles to model the 
> behavior of a large piconet.  A configuration that includes PCs running 
> Microsoft's stack, or Macs running Apple's stack, is stuck with the role switch, 
> but there are lots of configurations that use only peer-friendly devices.

Large piconets have never been easy and even if BlueZ supports multiple
dongles on one host, there might be some drawbacks because of this.

Regards

Marcel



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] Role switch: Detecting, predicting, preventing
  2007-02-15  8:18 ` Marcel Holtmann
@ 2007-02-15 23:30   ` Art Rothstein
  2007-03-02 17:35   ` Art Rothstein
  1 sibling, 0 replies; 4+ messages in thread
From: Art Rothstein @ 2007-02-15 23:30 UTC (permalink / raw)
  To: BlueZ development

I have incorporated your hci_conn_info test into a minimal test case derived 
from my application.  You can find source, executable, and hcidump traces at 
http://65.104.11.121/TwoAdapters .  Both cases were run on the same desktop PC, 
with the same two USB dongles.  The client adapter was a Motorola PC850, and the 
server an IOGear GBU211.  Both run LM 1.2 on a member of the Broadcom 2035 
family.  The -386 traces were run with Ubuntu 2.6.17-11-386 installed on a hard 
disk.  The -generic traces were run with Ubuntu 2.6.17-10-generic, booted from 
the Ubuntu 6.10 live CD.  As before, hciconfig always reports SLAVE ACCEPT, and 
the role change flows in the -386 case.

Thanks very much for your help.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] Role switch: Detecting, predicting, preventing
  2007-02-15  8:18 ` Marcel Holtmann
  2007-02-15 23:30   ` Art Rothstein
@ 2007-03-02 17:35   ` Art Rothstein
  1 sibling, 0 replies; 4+ messages in thread
From: Art Rothstein @ 2007-03-02 17:35 UTC (permalink / raw)
  To: BlueZ development

It's been two weeks since I staged my source code and traces.  Did I provide 
insufficient information, or do I need to be more patient?

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

end of thread, other threads:[~2007-03-02 17:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-15  6:04 [Bluez-devel] Role switch: Detecting, predicting, preventing Art Rothstein
2007-02-15  8:18 ` Marcel Holtmann
2007-02-15 23:30   ` Art Rothstein
2007-03-02 17:35   ` Art Rothstein

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.