CUPS backend fixes
Heya,
A few fixes, spotted by Tim Waugh.
- Use CUPS error codes:
https://bugzilla.redhat.com/show_bug.cgi?id=435082
- Output STATE information (we still need to do that when we add retry support):
https://bugzilla.redhat.com/show_bug.cgi?id=435083
- Use DEVICE_URI envvar if available:
https://bugzilla.redhat.com/show_bug.cgi?id=435080
- Also add better error reporting from hcrp_print() and spp_print()
There's 2 other bugs that are closely related and need more code movement:
https://bugzilla.redhat.com/show_bug.cgi?id=435084
https://bugzilla.redhat.com/show_bug.cgi?id=435081
Cheers
PS: Resend
Index: hcrp.c
===================================================================
RCS file: /cvsroot/bluez/utils/cups/hcrp.c,v
retrieving revision 1.7
hcrp.c +9 -0
@@ -233,6 +233,8 @@ int hcrp_print(bdaddr_t *src, bdaddr_t *return 1 ; } + fputs ("STATE: -connecting-to-device\n", stderr): +memset (&opts,0 ,sizeof (opts)); size =sizeof (opts);
@@ -300,6 +302,13 @@ int hcrp_print(bdaddr_t *src, bdaddr_t *break ; len =write (data_sk, buf, count); +if (len <0 ) { +perror ("ERROR: Error writing to device" ); +close (data_sk); +close (ctrl_sk); +return 1 ; + } +if (len != count)fprintf (stderr,"ERROR: Can't send complete data\n" );
Index: main.c
===================================================================
RCS file: /cvsroot/bluez/utils/cups/main.c,v
retrieving revision 1.8
main.c +40 -18
166 lines not on this page · raw message
Index: spp.c
===================================================================
RCS file: /cvsroot/bluez/utils/cups/spp.c,v
retrieving revision 1.5
spp.c +8 -1
@@ -65,6 +65,8 @@ int spp_print(bdaddr_t *src, bdaddr_t *dreturn 1 ; } + fputs ("STATE: -connecting-to-device\n", stderr): +/* Ignore SIGTERM signals if printing from stdin */ if (fd ==0 ) {#ifdef HAVE_SIGSET
@@ -86,9 +88,14 @@ int spp_print(bdaddr_t *src, bdaddr_t *dlseek (fd,0 ,SEEK_SET ); } -while ((len =read (fd, buf,sizeof (buf))) >0 ) { +while ((len =read (fd, buf,sizeof (buf))) >0 && err >=0 ) { err =write (sk, buf, len); } +if (err <0 ) { +perror ("ERROR: Error writing to device" ); +close (sk); +return 1 ; + } }
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel Holtmann
maintainerHi Bastien,
Quoted 10 lines
A few fixes, spotted by Tim Waugh.
- Use CUPS error codes:
https://bugzilla.redhat.com/show_bug.cgi?id=435082
- Output STATE information (we still need to do that when we add retry support):
https://bugzilla.redhat.com/show_bug.cgi?id=435083
- UseDEVICE_URIenvvar if available:
https://bugzilla.redhat.com/show_bug.cgi?id=435080
- Also add better error reporting fromhcrp_print()andspp_print()
the patch has been applied. However I had to fix up the coding style and actually fix an issue within the error handling in one of the loops. If gcc gives you a warning about an uninitialized variable, please don't ignore it. Most of the times there is something behind it.
Regards
Marcel
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bluez-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel