Skip to contentSkip to conversation

Error in rfcomm command

Bluez-devel Dieter Wirtz 2 participants 2 messages Nov 21, 2004 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

Hello,

I've some problems with rfcomm (I use bluez-utils-2.11.tar.gz):

1. rfcomm connect

If I want to connect to a device wich has an entry in rfcomm.conf with "rfcomm connect rfcomm0" I get the message "Can't find a config entry for rfcomm0"! I think it's an error in function "cmd_connect" (./bluez-utils-2.11/rfcomm/main.c):

static void cmd_connect(int ctl, int dev, bdaddr_t *bdaddr, int argc, char **argv)

{
	struct sockaddr_rc laddr, raddr;

...

	if (argc < 2) {
		if (rfcomm_read_config(rfcomm_config_file) < 0) {
			perror("Can't open RFCOMM config file");
			return;
		}

		raddr.rc_family = AF_BLUETOOTH;
		bacpy(&raddr.rc_bdaddr, &rfcomm_opts[dev].bdaddr);
		raddr.rc_channel = rfcomm_opts[dev].channel;

// wrong: if (bacmp(&req.dst, BDADDR_ANY) == 0) {
// must be:

		if (bacmp(&raddr.rc_bdaddr, BDADDR_ANY) == 0) {
			fprintf(stderr, "Can't find a config entry for rfcomm%d\n", dev);

			return;
		}
	} else {
		raddr.rc_family = AF_BLUETOOTH;

...

2. rfcomm bind

If I execute "rfcomm bind rfcomm0" prior to "rfcomm connect rfcomm0" I get the message "Can't connect RFCOMM socket: Host is down"! After a "rfcomm release rfcomm0" and a repeated "rfcomm connect rfcomm0" the connection will establish.

What can it be?

Regards,

Dieter

-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE FREE OODBMS DOWNLOAD - A multidimensional database that combines robust object and relational technologies, making it a perfect match for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#1 lore raw

Hi Dieter,

Quoted 25 lines

1. rfcomm connect

If I want to connect to a device wich has an entry in rfcomm.conf with "rfcomm connect rfcomm0" I get the message "Can't find a config entry for rfcomm0"! I think it's an error in function "cmd_connect" (./bluez-utils-2.11/rfcomm/main.c):

static void cmd_connect(int ctl, int dev, bdaddr_t *bdaddr, int argc, char **argv)

{
	struct sockaddr_rc laddr, raddr;

...

	if (argc < 2) {
		if (rfcomm_read_config(rfcomm_config_file) < 0) {
			perror("Can't open RFCOMM config file");
			return;
		}

		raddr.rc_family = AF_BLUETOOTH;
		bacpy(&raddr.rc_bdaddr, &rfcomm_opts[dev].bdaddr);
		raddr.rc_channel = rfcomm_opts[dev].channel;

// wrong: if (bacmp(&req.dst, BDADDR_ANY) == 0) {
// must be:

Quoted 8 lines
		if (bacmp(&raddr.rc_bdaddr, BDADDR_ANY) == 0) {
			fprintf(stderr, "Can't find a config entry for rfcomm%d\n", dev);

			return;
		}
	} else {
		raddr.rc_family = AF_BLUETOOTH;

...

it thought I tested this and it always worked for me. However you are right and it is fixed in CVS now. Next time send a unified diff, because it is easier to read.

Quoted 6 lines

2. rfcomm bind

If I execute "rfcomm bind rfcomm0" prior to "rfcomm connect rfcomm0" I get the message "Can't connect RFCOMM socket: Host is down"! After a "rfcomm release rfcomm0" and a repeated "rfcomm connect rfcomm0" the connection will establish.

I don't know why it shows "Host is down", but you can't connect and bind the same RFCOMM TTY at the same time. If you binded it, then you should open the TTY to get the connection.

Regards

Marcel

-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE FREE OODBMS DOWNLOAD - A multidimensional database that combines robust object and relational technologies, making it a perfect match for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel