Skip to contentSkip to conversation

more on this bug (was: rfcomm bind fails with obscure error message)

Bluez-devel Filippo Giunchedi 2 participants 4 messages May 19, 2006 – Jun 4, 2006 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

tags 322732 + upstream
thanks

Quoted 9 lines

Hello

When the 'rfcomm' kernel module isn't compiled with CONFIG_BT_RFCOMM_TTY enabled, 'rfcomm bind' will fail with an obscure error message, "Can't create device: Operation not supported". It does this when it's trying to bind to a device in /dev.

Could this be changed to report something more useful, such as "Check rfcomm.ko is compiled with TTY support"?

Hi,
I agree with this bug and the ioctl is mostly likely to fail when there is no rfcomm tty support, here is my proposed patch:

main.c (working copy) renamed from main.c (revision 154) +3 -1
@@ -172,8 +172,10 @@
                        req.channel = 1;
        }
 
-       if ((err = ioctl(ctl, RFCOMMCREATEDEV, &req)) < 0 )
+       if ((err = ioctl(ctl, RFCOMMCREATEDEV, &req)) < 0 ){
                perror("Can't create device");
+               fprintf(stderr, "Check RFCOMM TTY availabily");
+    }
 
        return err;
 }

comments?

thanks,
filippo
--
Filippo Giunchedi - http://esaurito.net
PGP key: 0x6B79D401
random quote follows:

What a strange illusion it is to suppose that beauty is goodness. -- Lev Tolstoj

maintainer
#1 lore raw

[Pkg-bluetooth-maintainers] Bug#322732: [Bluez-devel] more on this bug (was: rfcomm bind fails with obscure error message)

Hi Filippo,

Quoted 27 lines
Quoted 7 lines

When the 'rfcomm' kernel module isn't compiled with CONFIG_BT_RFCOMM_TTY enabled, 'rfcomm bind' will fail with an obscure error message, "Can't create device: Operation not supported". It does this when it's trying to bind to a device in /dev.

Could this be changed to report something more useful, such as "Check rfcomm.ko is compiled with TTY support"?

Hi,
I agree with this bug and the ioctl is mostly likely to fail when there is no rfcomm tty support, here is my proposed patch:

main.c (working copy) renamed from main.c (revision 154) +3 -1
@@ -172,8 +172,10 @@
                        req.channel = 1;
        }
 
-       if ((err = ioctl(ctl, RFCOMMCREATEDEV, &req)) < 0 )
+       if ((err = ioctl(ctl, RFCOMMCREATEDEV, &req)) < 0 ){
                perror("Can't create device");
+               fprintf(stderr, "Check RFCOMM TTY availabily");
+    }
 
        return err;
 }
Quoted 1 line

comments?

check for EOPNOTSUPP error code and only then print this error.

Regards

Marcel

_______________________________________________
Pkg-bluetooth-maintainers mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/pkg-bluetooth-maintainers

#2 lore raw

Bug#322732: [Pkg-bluetooth-maintainers] Bug#322732: [Bluez-devel] more on this bug (was: rfcomm bind fails with obscure error message)

Quoted 3 lines · Marcel Holtmann
Quoted 1 line

comments?

check for EOPNOTSUPP error code and only then print this error.

allright, I fixed this with the attached patch

thanks,
filippo
--
Filippo Giunchedi - http://esaurito.net
PGP key: 0x6B79D401
random quote follows:

Either this man is dead or my watch has stopped.
-- Groucho Marx

main.c +6 -2
@@ -172,8 +172,12 @@
 			req.channel = 1;
 	}
 
-	if ((err = ioctl(ctl, RFCOMMCREATEDEV, &req)) < 0 )
-		perror("Can't create device");
+	if ((err = ioctl(ctl, RFCOMMCREATEDEV, &req)) < 0 ) {
+		if (err == EOPNOTSUPP)
+			fprintf(stderr, "RFCOMM TTY support not available\n");
+		else
+			perror("Can't create device");
+	}
 
 	return err;
 }

_______________________________________________
Pkg-bluetooth-maintainers mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/pkg-bluetooth-maintainers

maintainer
#3 lore raw

Bug#322732: [Bluez-devel] [Pkg-bluetooth-maintainers] Bug#322732: more on this bug (was: rfcomm bind fails with obscure error message)

Hi Filippo,

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

comments?

check for EOPNOTSUPP error code and only then print this error.

allright, I fixed this with the attached patch

the patch has been applied to the CVS now. Thanks.

Regards

Marcel

_______________________________________________
Pkg-bluetooth-maintainers mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/pkg-bluetooth-maintainers