Problem swithing devices/dongles [bluez]

35 views
Skip to first unread message

scumbag

unread,
Oct 14, 2009, 12:00:48 PM10/14/09
to bluecove-users
When try switching between my 3 usb dongles using the next code:

BlueCoveImpl.setConfigProperty("bluecove.deviceID", "hci1"); //
changed in threads

Bluecove always use the same device, hci0.

I used this code to:

BlueCoveImpl.useThreadLocalBluetoothStack();
BlueCoveImpl.setConfigProperty("bluecove.deviceID", "0");
final Object id1 = BlueCoveImpl.getThreadBluetoothStackID();

Thread t1 = new Thread()
{
public void run()
{
BlueCoveImpl.setThreadBluetoothStackID(id1);
agent = LocalDevice.getLocalDevice().getDiscoveryAgent();
...
}
};
t1.start();

Located here: http://bluecove.org/bluecove/apidocs/com/intel/bluetooth/BlueCoveImpl.html#useThreadLocalBluetoothStack()

And manually change the device ID but always the hci0 is used.

Note: With hcitool i can use this my three devices very well.

Jorge Carrasco

unread,
Oct 14, 2009, 12:54:50 PM10/14/09
to bluecov...@googlegroups.com
I think you should use:

BlueCoveImpl.setConfigProperty("bluecove.deviceID", "1");

instead of


BlueCoveImpl.setConfigProperty("bluecove.deviceID", "hci1");


Although hci1 string is indeed the one returned in the list when calling:

BlueCoveImpl.getLocalDevicesID()

Somewhat weird, I think "bluecove.deviceID" property needs device index (1) and not the id (hci1) itself.

Give it a try, regards


2009/10/14 scumbag <elias....@gmail.com>

scumbag

unread,
Oct 14, 2009, 2:24:44 PM10/14/09
to bluecove-users
Actually i use:

BlueCoveImpl.setConfigProperty("bluecove.deviceID", "1");

The code that I posted come from a test build.

Something more wired is when i ejecute this code:

Object id = BlueCoveImpl.getThreadBluetoothStackID();
System.out.println(id);

I have diferents values for every device:

bluez:0, bluez:1 and bluez:2 respectively.

Actually if i inspect in tthe debugger the (Object) id has diferrente
values;

For:

BlueCoveImpl.setConfigProperty("bluecove.deviceID", "0");
Object id show: DeviceDescriptor = 11 and DeviceID = 0

and for:

BlueCoveImpl.setConfigProperty("bluecove.deviceID", "1");
Object id show: DeviceDescriptor = 12 and DeviceID = 1

and so on for the trhid dongle.

But bluecove still send the information through the first dongle.

On Oct 14, 11:54 am, Jorge Carrasco <cokem...@gmail.com> wrote:
> I think you should use:
>
> *BlueCoveImpl.setConfigProperty("bluecove.deviceID", "1");*
>
> instead of
> *
> BlueCoveImpl.setConfigProperty("bluecove.deviceID", "hci1");*
>
> Although hci1 string is indeed the one returned in the list when calling:
>
> *BlueCoveImpl.getLocalDevicesID()*
>
> Somewhat weird, I think "bluecove.deviceID" property needs device index (1)
> and not the id (hci1) itself.
>
> Give it a try, regards
>
> 2009/10/14 scumbag <elias.rin...@gmail.com>
>
>
>
> > When try switching between my 3 usb dongles using the next code:
>
> >    BlueCoveImpl.setConfigProperty("bluecove.deviceID", "hci1"); //
> > changed in threads
>
> > Bluecove always use the same device, hci0.
>
> > I used this code to:
>
> >    BlueCoveImpl.useThreadLocalBluetoothStack();
> >    BlueCoveImpl.setConfigProperty("bluecove.deviceID", "0");
> >    final Object id1 = BlueCoveImpl.getThreadBluetoothStackID();
>
> >    Thread t1 = new Thread()
> >    {
> >        public void run()
> >        {
> >            BlueCoveImpl.setThreadBluetoothStackID(id1);
> >            agent = LocalDevice.getLocalDevice().getDiscoveryAgent();
> >            ...
> >        }
> >     };
> >    t1.start();
>
> > Located here:
> >http://bluecove.org/bluecove/apidocs/com/intel/bluetooth/BlueCoveImpl...()<http://bluecove.org/bluecove/apidocs/com/intel/bluetooth/BlueCoveImpl...>

Jorge Carrasco

unread,
Oct 15, 2009, 3:10:28 PM10/15/09
to bluecov...@googlegroups.com
You are using BlueZ thrpugh D-Bus, dont you? I switched to dbus today and began having the same problem of yours. Have you found a solution yet? I will try to fix it tomorrow otherwise and will report if I successusfully solve the issue.

Regards

2009/10/14 scumbag <elias....@gmail.com>

scumbag

unread,
Oct 16, 2009, 9:37:16 AM10/16/09
to bluecove-users
Yes, i use bluez, and keep trying to solve the problem, any new will
be posted.

Thanks!!

On Oct 15, 2:10 pm, Jorge Carrasco <cokem...@gmail.com> wrote:
> You are using BlueZ thrpugh D-Bus, dont you? I switched to dbus today and
> began having the same problem of yours. Have you found a solution yet? I
> will try to fix it tomorrow otherwise and will report if I successusfully
> solve the issue.
>
> Regards
>
> 2009/10/14 scumbag <elias.rin...@gmail.com>

scumbag

unread,
Oct 20, 2009, 12:07:37 PM10/20/09
to bluecove-users
Now i get a Exception, while trying to connect with the mobile since
the second thread.

I use this code:

BlueCoveImpl.setConfigProperty("bluecove.deviceID",
"0"); // Here i change device between 0,1 and 2
clientSession = (ClientSession)Connector.open(this.url);

And the first thread start send information but the second and thrid
thread, throws an exception: Failed to connect. [31] Too many links,
here is the stack trace.

java.io.IOException: Failed to connect. [31] Too many links
at
com.intel.bluetooth.BluetoothStackBlueZ.connectionRfOpenClientConnectionImpl
(Native Method)
at
com.intel.bluetooth.BluetoothStackBlueZ.connectionRfOpenClientConnection
(BluetoothStackBlueZ.java:574)
at com.intel.bluetooth.BluetoothRFCommClientConnection.<init>
(BluetoothRFCommClientConnection.java:37)
at com.intel.bluetooth.MicroeditionConnector.openImpl
(MicroeditionConnector.java:387)
at com.intel.bluetooth.MicroeditionConnector.open
(MicroeditionConnector.java:162)
at javax.microedition.io.Connector.open(Connector.java:83)

Thanks!!

Jorge Carrasco

unread,
Oct 21, 2009, 4:29:15 AM10/21/09
to bluecov...@googlegroups.com
Have you checked if all threads use different devices? Last time I checked all threads ended using the same LocalDevice although I started each thread calling for a different device as you are doing.

2009/10/20 scumbag <elias....@gmail.com>

scumbag

unread,
Oct 22, 2009, 10:10:24 AM10/22/09
to bluecove-users
Yes, thats the problem.

But looks more like a Linux issue, because, th bluetooth deamin (and
in the hci.conf) use the autoinit value, so 2 dongles start with the
same address. You can see this with hcitool.

Now i'm trying to start 2 dongles with differents address.

On Oct 21, 3:29 am, Jorge Carrasco <cokem...@gmail.com> wrote:
> Have you checked if all threads use different devices? Last time I checked
> all threads ended using the same LocalDevice although I started each thread
> calling for a different device as you are doing.
>
> 2009/10/20 scumbag <elias.rin...@gmail.com>
Reply all
Reply to author
Forward
0 new messages