ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] Wireshark-dev Digest, Vol 79, Issue 6

From: "cheer_zeng"<cheer_zeng@xxxxxxx>
Date: Wed, 5 Dec 2012 00:52:59 +0800
Thanks ,Pascal and Ander
But as it is my first time to compile this,i can't understand well about what Anders said,and how to use the patch.
 
So,would you just tell me the command that i can follow step by step ,i even don't know what does "rebuild " mean.
and just follow the develop guid step by step to do these things.
 
Sorry to trouble you so much.
2012-12-05

cheer_zeng

发件人:Pascal Quantin
发送时间:2012-12-05 00:41
主题:Re: [Wireshark-dev] Wireshark-dev Digest, Vol 79, Issue 6
收件人:"Developer support list for Wireshark"<wireshark-dev@xxxxxxxxxxxxx>
抄送:"cheer_zeng"<cheer_zeng@xxxxxxx>
 

2012/12/4 Anders Broman <anders.broman@xxxxxxxxxxxx>
Hi,
The correct fix is to change the script make-usb.py in the tools dir to escape non ASCII chars
similarly to make-sminmpec.pl
sub escape_non_ascii {
    my $val = unpack 'C', $_[0];
    return sprintf '\0%.3o',$val;
}
and rebuild the file, then submitt a patch with the changes.

Hi,

with the following patch:
Index: tools/make-usb.py
===================================================================
--- tools/make-usb.py    (revision 46346)
+++ tools/make-usb.py    (working copy)
@@ -36,11 +36,11 @@
 
     if mode == MODE_VENDOR_PRODUCT:
         if re.match("^[0-9a-f]{4}", line):
-            vendors += "    { 0x%s, \"%s\" },\n"%(line[:4], re.sub("\"", "\\\"", re.sub("\?+", "?", line[4:].strip().replace("\\", "\\\\"))))
+            vendors += "    { 0x%s, \"%s\" },\n"%(line[:4], re.sub("\"", "\\\"", re.sub("\?+", "?", repr(line[4:].strip()).strip("'").replace("\\", "\\\\"))))
             last_vendor = line[:4]
         elif re.match("^\t[0-9a-f]{4}", line):
             line = line.strip()
-            products += "    { 0x%s%s, \"%s\" },\n"%(last_vendor, line[:4], re.sub("\"", "\\\"", re.sub("\?+", "?", line[4:].strip().replace("\\", "\\\\"))))
+            products += "    { 0x%s%s, \"%s\" },\n"%(last_vendor, line[:4], re.sub("\"", "\\\"", re.sub("\?+", "?", repr(line[4:].strip()).strip("'").replace("\\", "\\\\"))))
 
 
 vendors += """    { 0, NULL }\n};

"SideWinder® Freestyle Pro" is now displayed as "SideWinder\\xc2\\xae Freestyle Pro". I guess this is the kind of escaping you were thinking to Anders, right?

Note that I'm a newbie in Python so there might be a smarter way to do it. If nobody propose something else, I will push it as is and let the Python experts do a follow up if needed.

Pascal.