From: Bastien Nocera <hadess@hadess.net>
To: linux-bluetooth@vger.kernel.org
Subject: Broken SDP parsing?
Date: Fri, 06 Mar 2009 01:00:26 +0000 [thread overview]
Message-ID: <1236301226.3602.2314.camel@cookie.hadess.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 947 bytes --]
Heya,
In bluez 3.x, I used to get something like that:
<attribute id="0x0300">
<text value="MFG:HP;MDL:Photosmart 380
series_BT;CMD:PCL,DW-PCL,DESKJET,DYN;CLS:PRINTER;DES:385;" />
</attribute>
Now I get:
<attribute id="0x0300">
<text value="" />
</attribute>
$ sdptool search --raw --bdaddr 00:0C:55:5E:07:E1 HCRP
Attribute 0x0300
Data 00 55 4d 46 47 3a 48 50 3b 4d 44 4c 3a 50 68 6f 74 6f 73 6d 61 72
74 20 33 38 30 20 73 65 72 69 65 73 5f 42 54 3b 43 4d 44 3a 50 43 4c 2c
44 57 2d 50 43 4c 2c 44 45 53 4b 4a 45 54 2c 44 59 4e 3b 43 4c 53 3a 50
52 49 4e 54 45 52 3b 44 45 53 3a 33 38 35 3b 00
With the attached patch:
<attribute id="0x0300">
<text value="�UMFG:HP;MDL:Photosmart 380
series_BT;CMD:PCL,DW-PCL,DESKJET,DYN;CLS:PRINTER;DES:385;" />
</attribute>
The first 2 chars in the IEEE1284 ID are supposed to be the length of
the string. This should enable me to make the CUPS backend's discovery
work again.
Cheers
[-- Attachment #2: bluez-sdp-xml-with-nulls.patch --]
[-- Type: text/x-patch, Size: 1192 bytes --]
diff --git a/common/sdp-xml.c b/common/sdp-xml.c
index 0403dcd..5f314b7 100644
--- a/common/sdp-xml.c
+++ b/common/sdp-xml.c
@@ -239,9 +239,7 @@ static void convert_raw_data_to_xml(sdp_data_t *value, int indent_level,
hex = 0;
for (i = 0; i < length; i++) {
- if (value->val.str[i] == '\0')
- break;
- if (!isprint(value->val.str[i])) {
+ if (!isprint(value->val.str[i]) && value->val.str[i] != '\0') {
hex = 1;
break;
}
@@ -250,7 +248,8 @@ static void convert_raw_data_to_xml(sdp_data_t *value, int indent_level,
if ((value->val.str[i] == '<') ||
(value->val.str[i] == '>') ||
(value->val.str[i] == '"') ||
- (value->val.str[i] == '&'))
+ (value->val.str[i] == '&') ||
+ (value->val.str[i] == '\0'))
num_chars_to_escape++;
}
@@ -304,7 +303,13 @@ static void convert_raw_data_to_xml(sdp_data_t *value, int indent_level,
strBuf[j++] = 'o';
strBuf[j++] = 't';
}
- else {
+ else if (value->val.str[i] == '\0') {
+ strBuf[j++] = '&';
+ strBuf[j++] = '#';
+ strBuf[j++] = '0';
+ strBuf[j++] = '0';
+ strBuf[j++] = ';';
+ } else {
strBuf[j++] = value->val.str[i];
}
}
next reply other threads:[~2009-03-06 1:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-06 1:00 Bastien Nocera [this message]
2009-03-08 14:46 ` Broken SDP parsing? Bastien Nocera
2009-03-09 13:08 ` Luiz Augusto von Dentz
2009-03-09 14:14 ` Bastien Nocera
2009-03-09 14:32 ` Luiz Augusto von Dentz
2009-03-09 14:53 ` Luiz Augusto von Dentz
2009-03-09 15:25 ` Bastien Nocera
2009-03-09 16:40 ` Luiz Augusto von Dentz
2009-03-09 17:09 ` Bastien Nocera
2009-03-09 18:04 ` Johan Hedberg
2009-03-09 19:29 ` Port CUPS discovery to BlueZ 4.x (Re: Broken SDP parsing?) Bastien Nocera
2009-03-13 15:37 ` Broken SDP parsing? Bastien Nocera
2009-03-13 18:15 ` Johan Hedberg
2009-03-14 0:39 ` Bastien Nocera
2009-03-14 13:29 ` Johan Hedberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1236301226.3602.2314.camel@cookie.hadess.net \
--to=hadess@hadess.net \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox