Skip to contentSkip to conversation

multiple rfcomm listeners

Bluez-devel Brad Midgley 3 participants 9 messages Nov 27, 2005 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

Hey

I have been playing around with gpsd, DGPS and repeating gps data over bluetooth. I'm considering how feasible it would be to run two rfcomm SP listeners on one computer. Essentially I want to repeat the (dgps-corrected) data to more than one bluetooth gps client.

If I run rfcomm listeners on two channels, can I just remove and add the SP service on the alternate channel when a client connects?

I've heard that bluetooth clients are supposed to check for the SP channel via sdp on every connect, but bluez doesn't do that in its rfcomm bindings, eh? Do other devices check the channel only when pairing?

Is there a daemon to help with firing up the listener as soon as the connection is made? I saw a script on my gumstix that uses rfcomm to poll the rfcomm state and fire up a getty when connected. But will an app with an rfcomm device open get sighup'd when the connection is broken?

Brad

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#1 lore raw

Hi Brad,

just for one of your topics :

Quoted 7 lines · Brad Midgley

Hey

I have been playing around with gpsd, DGPS and repeating gps data over bluetooth. I'm considering how feasible it would be to run two rfcomm SP listeners on one computer. Essentially I want to repeat the (dgps-corrected) data to more than one bluetooth gps client.

Quoted 6 lines

If I run rfcomm listeners on two channels, can I just remove and add the SP service on the alternate channel when a client connects?

I've heard that bluetooth clients are supposed to check for the SP channel via sdp on every connect, but bluez doesn't do that in its rfcomm bindings, eh? Do other devices check the channel only when pairing?

This behaviour is completly implementation depended. The Widcom stack and even some other implementaions do request the server channel number for a service just before connection setup. Other implementations just store the server channel during pairing. The SDP variant has the problem that it is not realy possible to distinguish between two identical services which only have different server channels, e.g. many mobile phones and some other devices offer two SPP channels. With the SDP variant it is likely that you connect to the wrong service.
The pairing variant has the drawback that you can not connect to a service anymore if its server channel changes dynamicly. This again is implementation depoendent on the client side. However, most devices I'm aware off use fixed server channels.

Quoted 6 lines

Is there a daemon to help with firing up the listener as soon as the connection is made? I saw a script on my gumstix that uses rfcomm to poll the rfcomm state and fire up a getty when connected. But will an app with an rfcomm device open get sighup'd when the connection is broken?

Brad

Peter

Quoted 11 lines

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

|	Peter Wippich 			Voice: +49 30 46776411		|
|	G&W Instruments GmbH		fax:   +49 30 46776419		|
|	Gustav-Meyer-Allee 25, Geb. 12	Email: [email protected]	|
|	D-13355 Berlin  / Germany					|

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#2 lore raw

Hi Peter,

Quoted 15 lines
Quoted 3 lines

I've heard that bluetooth clients are supposed to check for the SP channel via sdp on every connect, but bluez doesn't do that in its rfcomm bindings, eh? Do other devices check the channel only when pairing?

This behaviour is completly implementation depended. The Widcom stack and even some other implementaions do request the server channel number for a service just before connection setup. Other implementations just store the server channel during pairing. The SDP variant has the problem that it is not realy possible to distinguish between two identical services which only have different server channels, e.g. many mobile phones and some other devices offer two SPP channels. With the SDP variant it is likely that you connect to the wrong service.
The pairing variant has the drawback that you can not connect to a service anymore if its server channel changes dynamicly. This again is implementation depoendent on the client side. However, most devices I'm aware off use fixed server channels.

this is a problem with the Bluetooth specification and its qualication. The SDP defines a time-to-live for the service record, but nobody uses it. However I can remember what's the default behavior if this attribute doesn't exists.

Regards

Marcel

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#3 lore raw

Marcel

Quoted 3 lines
Quoted 2 lines
Quoted 2 lines

I've heard that bluetooth clients are supposed to check for the SP channel via sdp

this is a problem with the Bluetooth specification and its qualication.

this got me thinking that SP is the wrong service for gps. They should have chosen a protocol that allows for multiple simultaneous plain l2cap connections.

but... would it be possible for me to write an app that listens on an l2cap socket on the right psm and implements a pseudo-rfcomm protocol that allows for multiple simultaneous connections? if it can be done, then sdp would just advertise a single SP service and multiple clients could use it. they wouldn't even know about the fakery.

it would be sort of gross, but as long as it doesn't require surgery to the stack or unloading rfcomm.ko, it wouldn't be that bad, eh?

brad

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#4 lore raw

Hi Brad,

Quoted 8 lines
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines

I've heard that bluetooth clients are supposed to check for the SP channel via sdp

this is a problem with the Bluetooth specification and its qualication.

this got me thinking that SP is the wrong service for gps. They should have chosen a protocol that allows for multiple simultaneous plain l2cap connections.

Quoted 5 lines

but... would it be possible for me to write an app that listens on an l2cap socket on the right psm and implements a pseudo-rfcomm protocol that allows for multiple simultaneous connections? if it can be done, then sdp would just advertise a single SP service and multiple clients could use it. they wouldn't even know about the fakery.

the L2CAP supports multiple connections to the same PSM from the same device (you need this for AVDTP). For RFCOMM these connections must come from a different device. Meaning that the underlying L2CAP link must be different.

Actually the concept of RFCOMM was bad in the first place, because an L2CAP with flow control would have been solved almost everything.

Quoted 2 lines

it would be sort of gross, but as long as it doesn't require surgery to the stack or unloading rfcomm.ko, it wouldn't be that bad, eh?

You can do whatever you like. Use UUID-128 to identify your service and use PSM numbers starting with 4097 (0x1001).

Regards

Marcel

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#5 lore raw

Marcel

Quoted 2 lines

You can do whatever you like. Use UUID-128 to identify your service and use PSM numbers starting with 4097 (0x1001).

I'm trying to have it coexist with gps clients (like pocketpc pda) that are looking for the real rfcomm on psm 3. I suspect from looking in the kernel that the rfcomm kernel module really has to be unloaded before you can bind a server socket with psm 3. That's just a little too gross.

Brad

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#6 lore raw

Hi Brad,

Quoted 7 lines
Quoted 2 lines

You can do whatever you like. Use UUID-128 to identify your service and use PSM numbers starting with 4097 (0x1001).

I'm trying to have it coexist with gps clients (like pocketpc pda) that are looking for the real rfcomm on psm 3. I suspect from looking in the kernel that the rfcomm kernel module really has to be unloaded before you can bind a server socket with psm 3. That's just a little too gross.

as I said, you can have multiple connections to the same PSM. However these must be handled by the same listener. So you need to replace (or unload) the RFCOMM module. However this will not give you anything, because you still have to speak RFCOMM to these clients.

What you might wanna do is to modify the sdpd server to handle out different service records (based on the remote BD_ADDR).

Regards

Marcel

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#7 lore raw

Marcel

Quoted 2 lines

What you might wanna do is to modify the sdpd server to handle out different service records (based on the remote BD_ADDR).

Yeah... I was considering how sdpd could have a pool of service records and record which addrs it had handed them out to. (I am thinking of the generic solution, not one in which all the addrs are known in advance)

Brad

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#8 lore raw

Hi Brad,

Quoted 6 lines
Quoted 2 lines

What you might wanna do is to modify the sdpd server to handle out different service records (based on the remote BD_ADDR).

Yeah... I was considering how sdpd could have a pool of service records and record which addrs it had handed them out to. (I am thinking of the generic solution, not one in which all the addrs are known in advance)

you can assign the channel number to a specific BD_ADDR on the first time a request for that service records comes in.

However I don't think there is a general solution for this problem. The problem with the multiple serial port services has been addressed by Microsoft ActiveSync and Palm HotSync already. They first look for a specific UUID-128 service and only fallback to SP when this is not available. This of course need better clients. A really good client would also try to match the additional attributes to correctly identify the service, but this is not specified anywhere in the specification and I doubt that any client is doing this.

Regards

Marcel

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel