All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bluez-devel] rfcomm patch
@ 2003-11-05  8:45 Sybren Stuvel
  2003-11-05 10:16 ` Marcel Holtmann
  2003-11-05 15:50 ` Alan Huang
  0 siblings, 2 replies; 9+ messages in thread
From: Sybren Stuvel @ 2003-11-05  8:45 UTC (permalink / raw)
  To: bluez-devel


[-- Attachment #1.1: body text --]
[-- Type: text/plain, Size: 575 bytes --]

Hi there,

I've been working with bluetooth for a few months now, trying to let BlueZ (on 
my PC) talk to Affix (on my Zaurus). One difficulty is that rfcom doesn't 
flush it's stdout when a new (incoming and/or outgoing) connection has been 
made.

With the attached patch, scripts can use rfcomm to connect via bluetooth and 
fork() the process in order to start using the connection (ie. by running 
pppd over it).

Greetings,
Sybren Stuvel
-- 
(o_   Q: God, root, what is difference?
//\   A: God can change the byte order on the CPU, root can't.
V_/_


[-- Attachment #1.2: bluez-utils-2.3-rfcomm.patch --]
[-- Type: text/x-diff, Size: 992 bytes --]

--- work/bluez-utils-2.3/rfcomm/main.c-orig	2003-01-27 12:42:07.000000000 +0100
+++ work/bluez-utils-2.3/rfcomm/main.c	2003-11-04 17:33:13.000000000 +0100
@@ -339,6 +339,11 @@
 	printf("Connected %s to %s on channel %d\n", devname, dst, req.channel);
 	printf("Press CTRL-C for hangup\n");
 
+	/* Added by Sybren Stuvel <sybren AT thirdtower.com> - Flush
+	 * stdout so other scripts can benefit from rfcomm's output and
+	 * react to connections being made. */
+	fflush(stdout);
+
 	memset(&sa, 0, sizeof(sa));
 	sa.sa_flags   = SA_NOCLDSTOP;
 	sa.sa_handler = SIG_IGN;
@@ -443,6 +448,11 @@
 	printf("Connection from %s to %s\n", dst, devname);
 	printf("Press CTRL-C for hangup\n");
 
+	/* Added by Sybren Stuvel <sybren AT thirdtower.com> - Flush
+	 * stdout so other scripts can benefit from rfcomm's output and
+	 * react to connections being made. */
+	fflush(stdout);
+
 	memset(&sa, 0, sizeof(sa));
 	sa.sa_flags   = SA_NOCLDSTOP;
 	sa.sa_handler = SIG_IGN;

[-- Attachment #2: signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [Bluez-devel] rfcomm patch
  2003-11-05  8:45 [Bluez-devel] rfcomm patch Sybren Stuvel
@ 2003-11-05 10:16 ` Marcel Holtmann
  2003-11-05 12:14   ` Sybren Stuvel
  2003-11-05 15:50 ` Alan Huang
  1 sibling, 1 reply; 9+ messages in thread
From: Marcel Holtmann @ 2003-11-05 10:16 UTC (permalink / raw)
  To: Sybren Stuvel; +Cc: BlueZ Mailing List

Hi Sybren,

> I've been working with bluetooth for a few months now, trying to let BlueZ (on 
> my PC) talk to Affix (on my Zaurus). One difficulty is that rfcom doesn't 
> flush it's stdout when a new (incoming and/or outgoing) connection has been 
> made.
> 
> With the attached patch, scripts can use rfcomm to connect via bluetooth and 
> fork() the process in order to start using the connection (ie. by running 
> pppd over it).

I have no problem with the patch, but if you talk about PPP over RFCOMM
you should better use dund. And why do you need this for scripting? You
can bind a RFCOMM channel to a device and all stuff would be done in
background without user interaction.

Regards

Marcel




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] rfcomm patch
  2003-11-05 10:16 ` Marcel Holtmann
@ 2003-11-05 12:14   ` Sybren Stuvel
  2003-11-05 12:22     ` Marcel Holtmann
  2003-11-05 15:00     ` Sybren Stuvel
  0 siblings, 2 replies; 9+ messages in thread
From: Sybren Stuvel @ 2003-11-05 12:14 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: Sybren Stuvel, BlueZ Mailing List

On Wed, Nov 05, 2003 at 11:16:54AM +0100, Marcel Holtmann wrote:
> I have no problem with the patch, but if you talk about PPP over RFCOMM
> you should better use dund.

I tried dund, but I couldn't get it to work together with Affix on my
Sharp Zaurus (running OpenZaurus 3.2). I'll try again and come up with
some info that might actually be useful for solving the mistery ;-)

> And why do you need this for scripting? You can bind a RFCOMM channel
> to a device and all stuff would be done in background without user
> interaction.

I wanted to delay the starting of pppd until the connection was actually
made. I thought it was the easiest to just parse rfcomm's output.

Greetz,
Sybren

PS: What is the list's policy on PGP-signed messages? 
-- 
(o_   Q: God, root, what is difference?
//\   A: God can change the byte order on the CPU, root can't.
V_/_

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

* Re: [Bluez-devel] rfcomm patch
  2003-11-05 12:14   ` Sybren Stuvel
@ 2003-11-05 12:22     ` Marcel Holtmann
  2003-11-05 15:00     ` Sybren Stuvel
  1 sibling, 0 replies; 9+ messages in thread
From: Marcel Holtmann @ 2003-11-05 12:22 UTC (permalink / raw)
  To: Sybren Stuvel; +Cc: BlueZ Mailing List

Hi Sybren,

> > And why do you need this for scripting? You can bind a RFCOMM channel
> > to a device and all stuff would be done in background without user
> > interaction.
> 
> I wanted to delay the starting of pppd until the connection was actually
> made. I thought it was the easiest to just parse rfcomm's output.

try to implement an updetach feature ;) But I prefer that you use this

	rfcomm bind 0 <bdaddr> [channel]	(only once needed)
	pppd /dev/rfcomm0 ...

> PS: What is the list's policy on PGP-signed messages? 

We have no policy about that and I never sign messages that go out to a
mailing list.

Regards

Marcel




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] rfcomm patch
  2003-11-05 12:14   ` Sybren Stuvel
  2003-11-05 12:22     ` Marcel Holtmann
@ 2003-11-05 15:00     ` Sybren Stuvel
  1 sibling, 0 replies; 9+ messages in thread
From: Sybren Stuvel @ 2003-11-05 15:00 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: BlueZ Mailing List

On Wednesday 05 November 2003 13:14, Sybren Stuvel wrote:
> I tried dund, but I couldn't get it to work together with Affix on my
> Sharp Zaurus (running OpenZaurus 3.2). I'll try again and come up with
> some info that might actually be useful for solving the mistery ;-)

Apparently I didn't try dund, or I tried it the wrong way. Now that I'm 
looking at it with a fresh mind it works like a charm:

sybren root # dund --search --nodetach
dund[10733]: DUN daemon ver 1.1
dund[10733]: Inquiring
dund[10733]: Searching for LAP on 00:10:7A:4C:23:02
dund[10733]: Connecting to 00:10:7A:4C:23:02 channel 2
dund[10733]: Connection established
Using interface ppp0
Connect: ppp0 <--> /dev/rfcomm0
local  IP address 172.16.0.2
remote IP address 172.16.0.1
BSD-Compress (15) compression enabled
 
Thank you very much! This saves me a lot of fuss!
You made me a very happy man :)

Greetz,
Sybren
-- 
(o_   Q: God, root, what is difference?
//\   A: God can change the byte order on the CPU, root can't.
V_/_

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

* Re: [Bluez-devel] rfcomm patch
  2003-11-05  8:45 [Bluez-devel] rfcomm patch Sybren Stuvel
  2003-11-05 10:16 ` Marcel Holtmann
@ 2003-11-05 15:50 ` Alan Huang
  2003-11-06  8:39   ` Marcel Holtmann
  1 sibling, 1 reply; 9+ messages in thread
From: Alan Huang @ 2003-11-05 15:50 UTC (permalink / raw)
  To: bluez-devel

Hi,
  Regarding this topic that rfcomm doesn't flush. I just want to ask that,
I'm using an USB Bluetooth dongle that's connected to another Bluetooth
device using the rfcomm program. This other Bluetooth device is connected to
a Windows PC's COM1 port (RS-232) and connected/displayed by
hyperterminal... For some unknown reason, what ever the hyperterminal sends
on the Windows side can be shown
"cat /dev/rfcomm0". But what ever the USB Bluetooth dongle sends (using
"echo hello > /dev/rfcomm0") it can't be shown on the Windows
hyperterminal...

On my Windows side, I have a embedded Bluetooth module (CSR's BC02) and the
signal is connected to a MAX chip converting betweeen BC02's 3.3V and
RS232's logic level.

Regards,

Alan

----- Original Message -----
From: "Sybren Stuvel" <sybren@thirdtower.com>
To: <bluez-devel@lists.sourceforge.net>
Sent: Wednesday, November 05, 2003 10:45 AM
Subject: [Bluez-devel] rfcomm patch


Hi there,

I've been working with bluetooth for a few months now, trying to let BlueZ
(on
my PC) talk to Affix (on my Zaurus). One difficulty is that rfcom doesn't
flush it's stdout when a new (incoming and/or outgoing) connection has been
made.

With the attached patch, scripts can use rfcomm to connect via bluetooth and
fork() the process in order to start using the connection (ie. by running
pppd over it).

Greetings,
Sybren Stuvel
--
(o_   Q: God, root, what is difference?
//\   A: God can change the byte order on the CPU, root can't.
V_/_






-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] rfcomm patch
  2003-11-05 15:50 ` Alan Huang
@ 2003-11-06  8:39   ` Marcel Holtmann
  2003-11-06 20:29     ` [Bluez-users] " Alan Huang
  0 siblings, 1 reply; 9+ messages in thread
From: Marcel Holtmann @ 2003-11-06  8:39 UTC (permalink / raw)
  To: Alan Huang; +Cc: BlueZ Mailing List

Hi Alan,

>   Regarding this topic that rfcomm doesn't flush. I just want to ask that,
> I'm using an USB Bluetooth dongle that's connected to another Bluetooth
> device using the rfcomm program. This other Bluetooth device is connected to
> a Windows PC's COM1 port (RS-232) and connected/displayed by
> hyperterminal... For some unknown reason, what ever the hyperterminal sends
> on the Windows side can be shown
> "cat /dev/rfcomm0". But what ever the USB Bluetooth dongle sends (using
> "echo hello > /dev/rfcomm0") it can't be shown on the Windows
> hyperterminal...

try to use the --raw switch to set the terminal into RAW mode after
connect (this works not for "bind").

Regards

Marcel




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* [Bluez-users] Re: [Bluez-devel] rfcomm patch
  2003-11-06  8:39   ` Marcel Holtmann
@ 2003-11-06 20:29     ` Alan Huang
  2003-11-06 23:44       ` Marcel Holtmann
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Huang @ 2003-11-06 20:29 UTC (permalink / raw)
  To: BlueZ-Users

Hi,
  Thanks again Marcel, for your reply! Can you tell me a bit more how to 
switch to raw terminal mode? Does it mean that I'll have to skip the bind 
action and directly connect after I created the socket?

Hmm... it really seems like I should enhance my socket programming 
knowledge...Any good online guides/tuts or books anyone can recommend ;-)

Thanks~

Alan

 Marcel Holtmann <marcel@holtmann.org>:

> Hi Alan,
> 
> >   Regarding this topic that rfcomm doesn't flush. I just want to ask
> that,
> > I'm using an USB Bluetooth dongle that's connected to another
> Bluetooth
> > device using the rfcomm program. This other Bluetooth device is
> connected to
> > a Windows PC's COM1 port (RS-232) and connected/displayed by
> > hyperterminal... For some unknown reason, what ever the hyperterminal
> sends
> > on the Windows side can be shown
> > "cat /dev/rfcomm0". But what ever the USB Bluetooth dongle sends
> (using
> > "echo hello > /dev/rfcomm0") it can't be shown on the Windows
> > hyperterminal...
> 
> try to use the --raw switch to set the terminal into RAW mode after
> connect (this works not for "bind").
> 
> Regards
> 
> Marcel
> 
> 
> 
> 
> 


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

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

* Re: [Bluez-users] Re: [Bluez-devel] rfcomm patch
  2003-11-06 20:29     ` [Bluez-users] " Alan Huang
@ 2003-11-06 23:44       ` Marcel Holtmann
  0 siblings, 0 replies; 9+ messages in thread
From: Marcel Holtmann @ 2003-11-06 23:44 UTC (permalink / raw)
  To: Alan Huang; +Cc: BlueZ Mailing List

Hi Alan,

>   Thanks again Marcel, for your reply! Can you tell me a bit more how to 
> switch to raw terminal mode? Does it mean that I'll have to skip the bind 
> action and directly connect after I created the socket?

look at the code ;) And the raw stuff is only for TTY terminals and the
RFCOMM emulation of it. If you connect through a socket you won't have
problems with it.

> Hmm... it really seems like I should enhance my socket programming 
> knowledge...Any good online guides/tuts or books anyone can recommend ;-)

The source code of any socket based program ;)

Regards

Marcel




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

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

end of thread, other threads:[~2003-11-06 23:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-05  8:45 [Bluez-devel] rfcomm patch Sybren Stuvel
2003-11-05 10:16 ` Marcel Holtmann
2003-11-05 12:14   ` Sybren Stuvel
2003-11-05 12:22     ` Marcel Holtmann
2003-11-05 15:00     ` Sybren Stuvel
2003-11-05 15:50 ` Alan Huang
2003-11-06  8:39   ` Marcel Holtmann
2003-11-06 20:29     ` [Bluez-users] " Alan Huang
2003-11-06 23:44       ` Marcel Holtmann

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.