From Steve Magnani:
[obnox/wireshark/wip.git] / epan / dissectors / packet-usb.c
index f45ef54d75fddd11fa9e3384d1b0d451ab37c916..696ec682a1a20a0bf28c2250d8a1e68589deee0b 100644 (file)
@@ -5,7 +5,6 @@
  * USB basic dissector
  * By Paolo Abeni <paolo.abeni@email.it>
  * Ronnie Sahlberg 2006
- * Chris Maynard 2010 <chris[dot]maynard[at]gtech[dot]com>
  *
  * http://www.usb.org/developers/docs/usb_20_122909-2.zip
  *
@@ -29,7 +28,9 @@
 # include "config.h"
 #endif
 
-#include <isprint.h>
+#include <ctype.h>
+#include "isprint.h"
+
 #include <glib.h>
 #include <epan/packet.h>
 #include <epan/etypes.h>
@@ -38,6 +39,7 @@
 #include <epan/tap.h>
 #include <epan/conversation.h>
 #include <epan/expert.h>
+#include <epan/prefs.h>
 #include "packet-usb.h"
 #include "packet-usb-hid.h"
 
@@ -49,6 +51,8 @@ static int hf_usb_urb_id = -1;
 static int hf_usb_urb_type = -1;
 static int hf_usb_transfer_type = -1;
 static int hf_usb_endpoint_number = -1;
+static int hf_usb_endpoint_direction = -1;
+static int hf_usb_endpoint_number_value = -1;
 static int hf_usb_device_address = -1;
 static int hf_usb_bus_id = -1;
 static int hf_usb_setup_flag = -1;
@@ -59,8 +63,6 @@ static int hf_usb_urb_status = -1;
 static int hf_usb_urb_len = -1;
 static int hf_usb_data_len = -1;
 
-static int hf_usb_src_endpoint_number = -1;
-static int hf_usb_dst_endpoint_number = -1;
 static int hf_usb_request = -1;
 static int hf_usb_request_unknown_class = -1;
 static int hf_usb_value = -1;
@@ -72,6 +74,15 @@ static int hf_usb_wFeatureSelector = -1;
 static int hf_usb_wInterface = -1;
 static int hf_usb_wStatus = -1;
 static int hf_usb_wFrameNumber = -1;
+
+static int hf_usb_iso_error_count = -1;
+static int hf_usb_iso_numdesc = -1;
+static int hf_usb_iso_status = -1;
+static int hf_usb_iso_off = -1;
+static int hf_usb_iso_len = -1;
+static int hf_usb_iso_pad = -1;
+static int hf_usb_iso_data = -1;
+
 static int hf_usb_bmRequestType = -1;
 static int hf_usb_bmRequestType_direction = -1;
 static int hf_usb_bmRequestType_type = -1;
@@ -125,165 +136,175 @@ static int hf_usb_request_in = -1;
 
 static gint usb_hdr = -1;
 static gint usb_setup_hdr = -1;
+static gint usb_isodesc = -1;
+static gint ett_usb_endpoint = -1;
 static gint ett_usb_setup_bmrequesttype = -1;
 static gint ett_descriptor_device = -1;
 static gint ett_configuration_bmAttributes = -1;
 static gint ett_configuration_bEndpointAddress = -1;
 static gint ett_endpoint_bmAttributes = -1;
 
+static const int *usb_endpoint_fields[] = {
+    &hf_usb_endpoint_direction,
+    &hf_usb_endpoint_number_value,
+    NULL
+};
 
 static int usb_tap = -1;
+static gboolean try_heuristics = TRUE;
 
 static dissector_table_t usb_bulk_dissector_table;
 static dissector_table_t usb_control_dissector_table;
+static heur_dissector_list_t heur_bulk_subdissector_list;
+static heur_dissector_list_t heur_control_subdissector_list;
 
 /* http://www.usb.org/developers/docs/USB_LANGIDs.pdf */
 static const value_string usb_langid_vals[] = {
     {0x0000, "no language specified"},
-    {0x0436, "Afrikaans"},
-    {0x041c, "Albanian"},
     {0x0401, "Arabic (Saudi Arabia)"},
-    {0x0801, "Arabic (Iraq)"},
-    {0x0c01, "Arabic (Egypt)"},
-    {0x1001, "Arabic (Libya)"},
-    {0x1401, "Arabic (Algeria)"},
-    {0x1801, "Arabic (Morocco)"},
-    {0x1c01, "Arabic (Tunisia)"},
-    {0x2001, "Arabic (Oman)"},
-    {0x2401, "Arabic (Yemen)"},
-    {0x2801, "Arabic (Syria)"},
-    {0x2c01, "Arabic (Jordan)"},
-    {0x3001, "Arabic (Lebanon)"},
-    {0x3401, "Arabic (Kuwait)"},
-    {0x3801, "Arabic (U.A.E.)"},
-    {0x3c01, "Arabic (Bahrain)"},
-    {0x4001, "Arabic (Qatar)"},
-    {0x042b, "Armenian"},
-    {0x044d, "Assamese"},
-    {0x042c, "Azeri (Latin)"},
-    {0x082c, "Azeri (Cyrillic)"},
-    {0x042d, "Basque"},
-    {0x0423, "Belarussian"},
-    {0x0445, "Bengali"},
     {0x0402, "Bulgarian"},
-    {0x0455, "Burmese"},
     {0x0403, "Catalan"},
     {0x0404, "Chinese (Taiwan)"},
-    {0x0804, "Chinese (PRC)"},
-    {0x0c04, "Chinese (Hong Kong SAR, PRC)"},
-    {0x1004, "Chinese (Singapore)"},
-    {0x1404, "Chinese (Macau SAR)"},
-    {0x041a, "Croatian"},
     {0x0405, "Czech"},
     {0x0406, "Danish"},
-    {0x0413, "Dutch (Netherlands)"},
-    {0x0813, "Dutch (Belgium)"},
+    {0x0407, "German (Standard)"},
+    {0x0408, "Greek"},
     {0x0409, "English (United States)"},
-    {0x0809, "English (United Kingdom)"},
-    {0x0c09, "English (Australian)"},
-    {0x1009, "English (Canadian)"},
-    {0x1409, "English (New Zealand)"},
-    {0x1809, "English (Ireland)"},
-    {0x1c09, "English (South Africa)"},
-    {0x2009, "English (Jamaica)"},
-    {0x2409, "English (Caribbean)"},
-    {0x2809, "English (Belize)"},
-    {0x2c09, "English (Trinidad)"},
-    {0x3009, "English (Zimbabwe)"},
-    {0x3409, "English (Philippines)"},
-    {0x0425, "Estonian"},
-    {0x0438, "Faeroese"},
-    {0x0429, "Farsi"},
+    {0x040a, "Spanish (Traditional Sort)"},
     {0x040b, "Finnish"},
     {0x040c, "French (Standard)"},
-    {0x080c, "French (Belgian)"},
-    {0x0c0c, "French (Canadian)"},
-    {0x100c, "French (Switzerland)"},
-    {0x140c, "French (Luxembourg)"},
-    {0x180c, "French (Monaco)"},
-    {0x0437, "Georgian"},
-    {0x0407, "German (Standard)"},
-    {0x0807, "German (Switzerland)"},
-    {0x0c07, "German (Austria)"},
-    {0x1007, "German (Luxembourg)"},
-    {0x1407, "German (Liechtenstein)"},
-    {0x0408, "Greek"},
-    {0x0447, "Gujarati"},
     {0x040d, "Hebrew"},
-    {0x0439, "Hindi"},
     {0x040e, "Hungarian"},
     {0x040f, "Icelandic"},
-    {0x0421, "Indonesian"},
     {0x0410, "Italian (Standard)"},
-    {0x0810, "Italian (Switzerland)"},
     {0x0411, "Japanese"},
-    {0x044b, "Kannada"},
-    {0x0860, "Kashmiri (India)"},
-    {0x043f, "Kazakh"},
-    {0x0457, "Konkani"},
     {0x0412, "Korean"},
-    {0x0812, "Korean (Johab)"},
+    {0x0413, "Dutch (Netherlands)"},
+    {0x0414, "Norwegian (Bokmal)"},
+    {0x0415, "Polish"},
+    {0x0416, "Portuguese (Brazil)"},
+    {0x0418, "Romanian"},
+    {0x0419, "Russian"},
+    {0x041a, "Croatian"},
+    {0x041b, "Slovak"},
+    {0x041c, "Albanian"},
+    {0x041d, "Swedish"},
+    {0x041e, "Thai"},
+    {0x041f, "Turkish"},
+    {0x0420, "Urdu (Pakistan)"},
+    {0x0421, "Indonesian"},
+    {0x0422, "Ukrainian"},
+    {0x0423, "Belarussian"},
+    {0x0424, "Slovenian"},
+    {0x0425, "Estonian"},
     {0x0426, "Latvian"},
     {0x0427, "Lithuanian"},
-    {0x0827, "Lithuanian (Classic)"},
+    {0x0429, "Farsi"},
+    {0x042a, "Vietnamese"},
+    {0x042b, "Armenian"},
+    {0x042c, "Azeri (Latin)"},
+    {0x042d, "Basque"},
     {0x042f, "Macedonian"},
+    {0x0430, "Sutu"},
+    {0x0436, "Afrikaans"},
+    {0x0437, "Georgian"},
+    {0x0438, "Faeroese"},
+    {0x0439, "Hindi"},
     {0x043e, "Malay (Malaysian)"},
-    {0x083e, "Malay (Brunei Darussalam)"},
+    {0x043f, "Kazakh"},
+    {0x0441, "Swahili (Kenya)"},
+    {0x0443, "Uzbek (Latin)"},
+    {0x0444, "Tatar (Tatarstan)"},
+    {0x0445, "Bengali"},
+    {0x0446, "Punjabi"},
+    {0x0447, "Gujarati"},
+    {0x0448, "Oriya"},
+    {0x0449, "Tamil"},
+    {0x044a, "Telugu"},
+    {0x044b, "Kannada"},
     {0x044c, "Malayalam"},
-    {0x0458, "Manipuri"},
+    {0x044d, "Assamese"},
     {0x044e, "Marathi"},
-    {0x0861, "Nepali (India)"},
-    {0x0414, "Norwegian (Bokmal)"},
-    {0x0814, "Norwegian (Nynorsk)"},
-    {0x0448, "Oriya"},
-    {0x0415, "Polish"},
-    {0x0416, "Portuguese (Brazil)"},
-    {0x0816, "Portuguese (Standard)"},
-    {0x0446, "Punjabi"},
-    {0x0418, "Romanian"},
-    {0x0419, "Russian"},
     {0x044f, "Sanskrit"},
-    {0x0c1a, "Serbian (Cyrillic)"},
-    {0x081a, "Serbian (Latin)"},
+    {0x0455, "Burmese"},
+    {0x0457, "Konkani"},
+    {0x0458, "Manipuri"},
     {0x0459, "Sindhi"},
-    {0x041b, "Slovak"},
-    {0x0424, "Slovenian"},
-    {0x040a, "Spanish (Traditional Sort)"},
+    {0x04ff, "HID (Usage Data Descriptor)"},
+    {0x0801, "Arabic (Iraq)"},
+    {0x0804, "Chinese (PRC)"},
+    {0x0807, "German (Switzerland)"},
+    {0x0809, "English (United Kingdom)"},
     {0x080a, "Spanish (Mexican)"},
+    {0x080c, "French (Belgian)"},
+    {0x0810, "Italian (Switzerland)"},
+    {0x0812, "Korean (Johab)"},
+    {0x0813, "Dutch (Belgium)"},
+    {0x0814, "Norwegian (Nynorsk)"},
+    {0x0816, "Portuguese (Standard)"},
+    {0x081a, "Serbian (Latin)"},
+    {0x081d, "Swedish (Finland)"},
+    {0x0820, "Urdu (India)"},
+    {0x0827, "Lithuanian (Classic)"},
+    {0x082c, "Azeri (Cyrillic)"},
+    {0x083e, "Malay (Brunei Darussalam)"},
+    {0x0843, "Uzbek (Cyrillic)"},
+    {0x0860, "Kashmiri (India)"},
+    {0x0861, "Nepali (India)"},
+    {0x0c01, "Arabic (Egypt)"},
+    {0x0c04, "Chinese (Hong Kong SAR, PRC)"},
+    {0x0c07, "German (Austria)"},
+    {0x0c09, "English (Australian)"},
     {0x0c0a, "Spanish (Modern Sort)"},
+    {0x0c0c, "French (Canadian)"},
+    {0x0c1a, "Serbian (Cyrillic)"},
+    {0x1001, "Arabic (Libya)"},
+    {0x1004, "Chinese (Singapore)"},
+    {0x1007, "German (Luxembourg)"},
+    {0x1009, "English (Canadian)"},
     {0x100a, "Spanish (Guatemala)"},
+    {0x100c, "French (Switzerland)"},
+    {0x1401, "Arabic (Algeria)"},
+    {0x1404, "Chinese (Macau SAR)"},
+    {0x1407, "German (Liechtenstein)"},
+    {0x1409, "English (New Zealand)"},
     {0x140a, "Spanish (Costa Rica)"},
+    {0x140c, "French (Luxembourg)"},
+    {0x1801, "Arabic (Morocco)"},
+    {0x1809, "English (Ireland)"},
     {0x180a, "Spanish (Panama)"},
+    {0x180c, "French (Monaco)"},
+    {0x1c01, "Arabic (Tunisia)"},
+    {0x1c09, "English (South Africa)"},
     {0x1c0a, "Spanish (Dominican Republic)"},
+    {0x2001, "Arabic (Oman)"},
+    {0x2009, "English (Jamaica)"},
     {0x200a, "Spanish (Venezuela)"},
+    {0x2401, "Arabic (Yemen)"},
+    {0x2409, "English (Caribbean)"},
     {0x240a, "Spanish (Colombia)"},
+    {0x2801, "Arabic (Syria)"},
+    {0x2809, "English (Belize)"},
     {0x280a, "Spanish (Peru)"},
+    {0x2c01, "Arabic (Jordan)"},
+    {0x2c09, "English (Trinidad)"},
     {0x2c0a, "Spanish (Argentina)"},
+    {0x3001, "Arabic (Lebanon)"},
+    {0x3009, "English (Zimbabwe)"},
     {0x300a, "Spanish (Ecuador)"},
+    {0x3401, "Arabic (Kuwait)"},
+    {0x3409, "English (Philippines)"},
     {0x340a, "Spanish (Chile)"},
+    {0x3801, "Arabic (U.A.E.)"},
     {0x380a, "Spanish (Uruguay)"},
+    {0x3c01, "Arabic (Bahrain)"},
     {0x3c0a, "Spanish (Paraguay)"},
+    {0x4001, "Arabic (Qatar)"},
     {0x400a, "Spanish (Bolivia)"},
     {0x440a, "Spanish (El Salvador)"},
     {0x480a, "Spanish (Honduras)"},
     {0x4c0a, "Spanish (Nicaragua)"},
     {0x500a, "Spanish (Puerto Rico)"},
-    {0x0430, "Sutu"},
-    {0x0441, "Swahili (Kenya)"},
-    {0x041d, "Swedish"},
-    {0x081d, "Swedish (Finland)"},
-    {0x0449, "Tamil"},
-    {0x0444, "Tatar (Tatarstan)"},
-    {0x044a, "Telugu"},
-    {0x041e, "Thai"},
-    {0x041f, "Turkish"},
-    {0x0422, "Ukrainian"},
-    {0x0420, "Urdu (Pakistan)"},
-    {0x0820, "Urdu (India)"},
-    {0x0443, "Uzbek (Latin)"},
-    {0x0843, "Uzbek (Cyrillic)"},
-    {0x042a, "Vietnamese"},
-    {0x04ff, "HID (Usage Data Descriptor)"},
     {0xf0ff, "HID (Vendor Defined 1)"},
     {0xf4ff, "HID (Vendor Defined 2)"},
     {0xf8ff, "HID (Vendor Defined 3)"},
@@ -291,6 +312,8 @@ static const value_string usb_langid_vals[] = {
     {0, NULL}
 };
 
+static value_string_ext usb_langid_vals_ext = VALUE_STRING_EXT_INIT(usb_langid_vals);
+
 static const value_string usb_interfaceclass_vals[] = {
     {IF_CLASS_FROM_INTERFACE_DESC,      "Use class info in Interface Descriptor"},
     {IF_CLASS_AUDIO,                    "AUDIO"},
@@ -315,6 +338,14 @@ static const value_string usb_interfaceclass_vals[] = {
 
 
 static const value_string usb_transfer_type_vals[] = {
+    {URB_CONTROL, "URB_CONTROL"},
+    {URB_ISOCHRONOUS,"URB_ISOCHRONOUS"},
+    {URB_INTERRUPT,"URB_INTERRUPT"},
+    {URB_BULK,"URB_BULK"},
+    {0, NULL}
+};
+
+static const value_string usb_transfer_type_and_direction_vals[] = {
     {URB_CONTROL, "URB_CONTROL out"},
     {URB_ISOCHRONOUS,"URB_ISOCHRONOUS out"},
     {URB_INTERRUPT,"URB_INTERRUPT out"},
@@ -326,8 +357,14 @@ static const value_string usb_transfer_type_vals[] = {
     {0, NULL}
 };
 
+static const value_string usb_endpoint_direction_vals[] = {
+    {0, "OUT"},
+    {1, "IN"},
+    {0, NULL}
+};
+
 static const value_string usb_urb_type_vals[] = {
-    {URB_SUBMIT, "URB_SUBMIT"},
+    {URB_SUBMIT,  "URB_SUBMIT"},
     {URB_COMPLETE,"URB_COMPLETE"},
     {URB_ERROR,"URB_ERROR"},
     {0, NULL}
@@ -405,17 +442,17 @@ static const value_string usb_bmAttributes_transfer_vals[] = {
 
 static const value_string usb_bmAttributes_sync_vals[] = {
     {0x00,      "No Sync"},
-    {0x04,      "Asynchronous"},
-    {0x08,      "Adaptive"},
-    {0x0c,      "Synchronous"},
+    {0x01,      "Asynchronous"},
+    {0x02,      "Adaptive"},
+    {0x03,      "Synchronous"},
     {0,NULL}
 };
 
 static const value_string usb_bmAttributes_behaviour_vals[] = {
     {0x00,      "Data-Endpoint"},
-    {0x10,      "Explicit Feedback-Endpoint"},
-    {0x20,      "Implicit Feedback-Data-Endpoint"},
-    {0x30,      "Reserved"},
+    {0x01,      "Explicit Feedback-Endpoint"},
+    {0x02,      "Implicit Feedback-Data-Endpoint"},
+    {0x03,      "Reserved"},
     {0,NULL}
 };
 
@@ -755,16 +792,16 @@ static int
 dissect_usb_setup_clear_feature_request(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int offset, usb_trans_info_t *usb_trans_info _U_, usb_conv_info_t *usb_conv_info _U_)
 {
     /* feature selector */
-    proto_tree_add_item(tree, hf_usb_wFeatureSelector, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_wFeatureSelector, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset += 2;
 
     /* zero/interface/endpoint */
     /* XXX - check based on request type */
-    proto_tree_add_item(tree, hf_usb_wInterface, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_wInterface, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset += 2;
 
     /* length */
-    proto_tree_add_item(tree, hf_usb_length, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset += 2;
 
     return offset;
@@ -787,7 +824,7 @@ dissect_usb_setup_clear_feature_response(packet_info *pinfo _U_, proto_tree *tre
 static int
 dissect_usb_setup_get_configuration_response(packet_info *pinfo _U_, proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset, usb_trans_info_t *usb_trans_info _U_, usb_conv_info_t *usb_conv_info _U_)
 {
-    proto_tree_add_item(tree, hf_usb_bConfigurationValue, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bConfigurationValue, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     return offset;
@@ -814,35 +851,35 @@ dissect_usb_device_qualifier_descriptor(packet_info *pinfo _U_, proto_tree *pare
     }
 
     /* bLength */
-    proto_tree_add_item(tree, hf_usb_bLength, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bLength, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* bDescriptorType */
-    proto_tree_add_item(tree, hf_usb_bDescriptorType, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bDescriptorType, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* bcdUSB */
-    proto_tree_add_item(tree, hf_usb_bcdUSB, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_bcdUSB, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset+=2;
 
     /* bDeviceClass */
-    proto_tree_add_item(tree, hf_usb_bDeviceClass, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bDeviceClass, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* bDeviceSubClass */
-    proto_tree_add_item(tree, hf_usb_bDeviceSubClass, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bDeviceSubClass, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* bDeviceProtocol */
-    proto_tree_add_item(tree, hf_usb_bDeviceProtocol, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bDeviceProtocol, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* bMaxPacketSize0 */
-    proto_tree_add_item(tree, hf_usb_bMaxPacketSize0, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bMaxPacketSize0, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* bNumConfigurations */
-    proto_tree_add_item(tree, hf_usb_bNumConfigurations, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bNumConfigurations, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* one reserved byte */
@@ -869,59 +906,59 @@ dissect_usb_device_descriptor(packet_info *pinfo _U_, proto_tree *parent_tree, t
     }
 
     /* bLength */
-    proto_tree_add_item(tree, hf_usb_bLength, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bLength, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* bDescriptorType */
-    proto_tree_add_item(tree, hf_usb_bDescriptorType, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bDescriptorType, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* bcdUSB */
-    proto_tree_add_item(tree, hf_usb_bcdUSB, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_bcdUSB, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset+=2;
 
     /* bDeviceClass */
-    proto_tree_add_item(tree, hf_usb_bDeviceClass, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bDeviceClass, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* bDeviceSubClass */
-    proto_tree_add_item(tree, hf_usb_bDeviceSubClass, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bDeviceSubClass, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* bDeviceProtocol */
-    proto_tree_add_item(tree, hf_usb_bDeviceProtocol, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bDeviceProtocol, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* bMaxPacketSize0 */
-    proto_tree_add_item(tree, hf_usb_bMaxPacketSize0, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bMaxPacketSize0, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* idVendor */
-    proto_tree_add_item(tree, hf_usb_idVendor, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_idVendor, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset+=2;
 
     /* idProduct */
-    proto_tree_add_item(tree, hf_usb_idProduct, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_idProduct, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset+=2;
 
     /* bcdDevice */
-    proto_tree_add_item(tree, hf_usb_bcdDevice, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_bcdDevice, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset+=2;
 
     /* iManufacturer */
-    proto_tree_add_item(tree, hf_usb_iManufacturer, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_iManufacturer, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* iProduct */
-    proto_tree_add_item(tree, hf_usb_iProduct, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_iProduct, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* iSerialNumber */
-    proto_tree_add_item(tree, hf_usb_iSerialNumber, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_iSerialNumber, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* bNumConfigurations */
-    proto_tree_add_item(tree, hf_usb_bNumConfigurations, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bNumConfigurations, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     if(item){
@@ -946,26 +983,26 @@ dissect_usb_string_descriptor(packet_info *pinfo _U_, proto_tree *parent_tree, t
     }
 
     /* bLength */
-    proto_tree_add_item(tree, hf_usb_bLength, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bLength, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     len=tvb_get_guint8(tvb, offset);
     offset++;
 
     /* bDescriptorType */
-    proto_tree_add_item(tree, hf_usb_bDescriptorType, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bDescriptorType, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     if(!usb_trans_info->u.get_descriptor.index){
         /* list of languanges */
         while(len>(offset-old_offset)){
             /* wLANGID */
-            proto_tree_add_item(tree, hf_usb_wLANGID, tvb, offset, 2, TRUE);
+            proto_tree_add_item(tree, hf_usb_wLANGID, tvb, offset, 2, ENC_LITTLE_ENDIAN);
             offset+=2;
         }
     } else {
         char *str;
 
         /* unicode string */
-        str=tvb_get_ephemeral_faked_unicode(tvb, offset, (len-2)/2, TRUE);
+        str=tvb_get_ephemeral_unicode_string(tvb, offset, (len-2)/2, ENC_LITTLE_ENDIAN);
         proto_tree_add_string(tree, hf_usb_bString, tvb, offset, len-2, str);
         offset += len-2;
     }
@@ -994,28 +1031,28 @@ dissect_usb_interface_descriptor(packet_info *pinfo, proto_tree *parent_tree, tv
     }
 
     /* bLength */
-    proto_tree_add_item(tree, hf_usb_bLength, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bLength, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     len = tvb_get_guint8(tvb, offset);
     offset++;
 
     /* bDescriptorType */
-    proto_tree_add_item(tree, hf_usb_bDescriptorType, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bDescriptorType, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* bInterfaceNumber */
-    proto_tree_add_item(tree, hf_usb_bInterfaceNumber, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bInterfaceNumber, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* bAlternateSetting */
-    proto_tree_add_item(tree, hf_usb_bAlternateSetting, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bAlternateSetting, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* bNumEndpoints */
-    proto_tree_add_item(tree, hf_usb_bNumEndpoints, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bNumEndpoints, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* bInterfaceClass */
-    proto_tree_add_item(tree, hf_usb_bInterfaceClass, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bInterfaceClass, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     /* save the class so we can access it later in the endpoint descriptor */
     usb_conv_info->interfaceClass=tvb_get_guint8(tvb, offset);
     if(!pinfo->fd->flags.visited){
@@ -1026,15 +1063,15 @@ dissect_usb_interface_descriptor(packet_info *pinfo, proto_tree *parent_tree, tv
     offset++;
 
     /* bInterfaceSubClass */
-    proto_tree_add_item(tree, hf_usb_bInterfaceSubClass, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bInterfaceSubClass, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* bInterfaceProtocol */
-    proto_tree_add_item(tree, hf_usb_bInterfaceProtocol, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bInterfaceProtocol, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* iInterface */
-    proto_tree_add_item(tree, hf_usb_iInterface, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_iInterface, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     if(item){
@@ -1072,23 +1109,23 @@ dissect_usb_endpoint_descriptor(packet_info *pinfo, proto_tree *parent_tree, tvb
     }
 
     /* bLength */
-    proto_tree_add_item(tree, hf_usb_bLength, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bLength, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     len = tvb_get_guint8(tvb, offset);
     offset++;
 
     /* bDescriptorType */
-    proto_tree_add_item(tree, hf_usb_bDescriptorType, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bDescriptorType, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* bEndpointAddress */
     if(tree){
-        endpoint_item=proto_tree_add_item(tree, hf_usb_bEndpointAddress, tvb, offset, 1, TRUE);
+        endpoint_item=proto_tree_add_item(tree, hf_usb_bEndpointAddress, tvb, offset, 1, ENC_LITTLE_ENDIAN);
         endpoint_tree=proto_item_add_subtree(endpoint_item, ett_configuration_bEndpointAddress);
     }
     endpoint=tvb_get_guint8(tvb, offset)&0x0f;
-    proto_tree_add_item(endpoint_tree, hf_usb_bEndpointAddress_direction, tvb, offset, 1, TRUE);
+    proto_tree_add_item(endpoint_tree, hf_usb_bEndpointAddress_direction, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     proto_item_append_text(endpoint_item, "  %s", (tvb_get_guint8(tvb, offset)&0x80)?"IN":"OUT");
-    proto_tree_add_item(endpoint_tree, hf_usb_bEndpointAddress_number, tvb, offset, 1, TRUE);
+    proto_tree_add_item(endpoint_tree, hf_usb_bEndpointAddress_number, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     proto_item_append_text(endpoint_item, "  Endpoint:%d", endpoint);
     offset++;
 
@@ -1132,22 +1169,22 @@ dissect_usb_endpoint_descriptor(packet_info *pinfo, proto_tree *parent_tree, tvb
 
     /* bmAttributes */
     if (tree) {
-        ep_attrib_item=proto_tree_add_item(tree, hf_usb_bmAttributes, tvb, offset, 1, TRUE);
+        ep_attrib_item=proto_tree_add_item(tree, hf_usb_bmAttributes, tvb, offset, 1, ENC_LITTLE_ENDIAN);
         ep_attrib_tree=proto_item_add_subtree(ep_attrib_item, ett_endpoint_bmAttributes);
     }
-    proto_tree_add_item(ep_attrib_tree, hf_usb_bEndpointAttributeTransfer, tvb, offset, 1, TRUE);
+    proto_tree_add_item(ep_attrib_tree, hf_usb_bEndpointAttributeTransfer, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     /* isochronous only */
-    proto_tree_add_item(ep_attrib_tree, hf_usb_bEndpointAttributeSynchonisation, tvb, offset, 1, TRUE);
+    proto_tree_add_item(ep_attrib_tree, hf_usb_bEndpointAttributeSynchonisation, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     /* isochronous only */
-    proto_tree_add_item(ep_attrib_tree, hf_usb_bEndpointAttributeBehaviour, tvb, offset, 1, TRUE);
+    proto_tree_add_item(ep_attrib_tree, hf_usb_bEndpointAttributeBehaviour, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* wMaxPacketSize */
-    proto_tree_add_item(tree, hf_usb_wMaxPacketSize, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_wMaxPacketSize, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset+=2;
 
     /* bInterval */
-    proto_tree_add_item(tree, hf_usb_bInterval, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bInterval, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     if(item){
@@ -1175,7 +1212,7 @@ dissect_usb_unknown_descriptor(packet_info *pinfo _U_, proto_tree *parent_tree,
     }
 
     /* bLength */
-    proto_tree_add_item(tree, hf_usb_bLength, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bLength, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     bLength = tvb_get_guint8(tvb, offset);
     offset++;
     if (bLength < 3) {
@@ -1192,7 +1229,7 @@ dissect_usb_unknown_descriptor(packet_info *pinfo _U_, proto_tree *parent_tree,
     }
 
     /* bDescriptorType */
-    proto_tree_add_item(tree, hf_usb_bDescriptorType, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bDescriptorType, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     offset += bLength - 2;
@@ -1236,47 +1273,45 @@ dissect_usb_configuration_descriptor(packet_info *pinfo _U_, proto_tree *parent_
     }
 
     /* bLength */
-    proto_tree_add_item(tree, hf_usb_bLength, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bLength, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* bDescriptorType */
-    proto_tree_add_item(tree, hf_usb_bDescriptorType, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bDescriptorType, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* wTotalLength */
-    proto_tree_add_item(tree, hf_usb_wTotalLength, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_wTotalLength, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     len=tvb_get_letohs(tvb, offset);
     offset+=2;
 
     /* bNumInterfaces */
-    proto_tree_add_item(tree, hf_usb_bNumInterfaces, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bNumInterfaces, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* bConfigurationValue */
-    proto_tree_add_item(tree, hf_usb_bConfigurationValue, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bConfigurationValue, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* iConfiguration */
-    proto_tree_add_item(tree, hf_usb_iConfiguration, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_iConfiguration, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     /* bmAttributes */
     if(tree){
-        flags_item=proto_tree_add_item(tree, hf_usb_configuration_bmAttributes, tvb, offset, 1, TRUE);
+        flags_item=proto_tree_add_item(tree, hf_usb_configuration_bmAttributes, tvb, offset, 1, ENC_LITTLE_ENDIAN);
         flags_tree=proto_item_add_subtree(flags_item, ett_configuration_bmAttributes);
     }
     flags=tvb_get_guint8(tvb, offset);
-    proto_tree_add_item(flags_tree, hf_usb_configuration_legacy10buspowered, tvb, offset, 1, TRUE);
-    proto_tree_add_item(flags_tree, hf_usb_configuration_selfpowered, tvb, offset, 1, TRUE);
+    proto_tree_add_item(flags_tree, hf_usb_configuration_legacy10buspowered, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+    proto_tree_add_item(flags_tree, hf_usb_configuration_selfpowered, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     proto_item_append_text(flags_item, "  %sSELF-POWERED", (flags&0x40)?"":"NOT ");
-    flags&=~0x40;
-    proto_tree_add_item(flags_tree, hf_usb_configuration_remotewakeup, tvb, offset, 1, TRUE);
+    proto_tree_add_item(flags_tree, hf_usb_configuration_remotewakeup, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     proto_item_append_text(flags_item, "  %sREMOTE-WAKEUP", (flags&0x20)?"":"NO ");
-    flags&=~0x20;
     offset++;
 
     /* bMaxPower */
-    power_item=proto_tree_add_item(tree, hf_usb_bMaxPower, tvb, offset, 1, TRUE);
+    power_item=proto_tree_add_item(tree, hf_usb_bMaxPower, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     power=tvb_get_guint8(tvb, offset);
     proto_item_append_text(power_item, "  (%dmA)", power*2);
     offset++;
@@ -1318,12 +1353,12 @@ static int
 dissect_usb_setup_get_descriptor_request(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, usb_trans_info_t *usb_trans_info, usb_conv_info_t *usb_conv_info _U_)
 {
     /* descriptor index */
-    proto_tree_add_item(tree, hf_usb_descriptor_index, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_descriptor_index, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     usb_trans_info->u.get_descriptor.index=tvb_get_guint8(tvb, offset);
     offset++;
 
     /* descriptor type */
-    proto_tree_add_item(tree, hf_usb_bDescriptorType, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bDescriptorType, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     usb_trans_info->u.get_descriptor.type=tvb_get_guint8(tvb, offset);
     offset++;
     if (check_col(pinfo->cinfo, COL_INFO)) {
@@ -1332,11 +1367,11 @@ dissect_usb_setup_get_descriptor_request(packet_info *pinfo, proto_tree *tree, t
     }
 
     /* language id */
-    proto_tree_add_item(tree, hf_usb_language_id, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_language_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset+=2;
 
     /* length */
-    proto_tree_add_item(tree, hf_usb_length, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset += 2;
 
     return offset;
@@ -1402,15 +1437,15 @@ static int
 dissect_usb_setup_get_interface_request(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int offset, usb_trans_info_t *usb_trans_info _U_, usb_conv_info_t *usb_conv_info _U_)
 {
     /* zero */
-    proto_tree_add_item(tree, hf_usb_value, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_value, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset += 2;
 
     /* interface */
-    proto_tree_add_item(tree, hf_usb_wInterface, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_wInterface, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset += 2;
 
     /* length */
-    proto_tree_add_item(tree, hf_usb_length, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset += 2;
 
     return offset;
@@ -1420,7 +1455,7 @@ static int
 dissect_usb_setup_get_interface_response(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int offset, usb_trans_info_t *usb_trans_info _U_, usb_conv_info_t *usb_conv_info _U_)
 {
     /* alternate setting */
-    proto_tree_add_item(tree, hf_usb_bAlternateSetting, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bAlternateSetting, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset++;
 
     return offset;
@@ -1438,16 +1473,16 @@ static int
 dissect_usb_setup_get_status_request(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int offset, usb_trans_info_t *usb_trans_info _U_, usb_conv_info_t *usb_conv_info _U_)
 {
     /* zero */
-    proto_tree_add_item(tree, hf_usb_value, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_value, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset += 2;
 
     /* zero/interface/endpoint */
     /* XXX - check based on request type */
-    proto_tree_add_item(tree, hf_usb_wInterface, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_wInterface, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset += 2;
 
     /* length */
-    proto_tree_add_item(tree, hf_usb_length, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset += 2;
 
     return offset;
@@ -1458,7 +1493,7 @@ dissect_usb_setup_get_status_response(packet_info *pinfo _U_, proto_tree *tree,
 {
     /* status */
     /* XXX - show bits */
-    proto_tree_add_item(tree, hf_usb_wStatus, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_wStatus, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset += 2;
 
     return offset;
@@ -1476,15 +1511,15 @@ static int
 dissect_usb_setup_set_address_request(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int offset, usb_trans_info_t *usb_trans_info _U_, usb_conv_info_t *usb_conv_info _U_)
 {
     /* device address */
-    proto_tree_add_item(tree, hf_usb_device_address, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_device_address, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset += 2;
 
     /* zero */
-    proto_tree_add_item(tree, hf_usb_index, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_index, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset += 2;
 
     /* zero */
-    proto_tree_add_item(tree, hf_usb_length, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset += 2;
 
     return offset;
@@ -1508,15 +1543,15 @@ static int
 dissect_usb_setup_set_configuration_request(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int offset, usb_trans_info_t *usb_trans_info _U_, usb_conv_info_t *usb_conv_info _U_)
 {
     /* configuration value */
-    proto_tree_add_item(tree, hf_usb_bConfigurationValue, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bConfigurationValue, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset += 2;
 
     /* zero */
-    proto_tree_add_item(tree, hf_usb_index, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_index, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset += 2;
 
     /* zero */
-    proto_tree_add_item(tree, hf_usb_length, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset += 2;
 
     return offset;
@@ -1540,16 +1575,16 @@ static int
 dissect_usb_setup_set_feature_request(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int offset, usb_trans_info_t *usb_trans_info _U_, usb_conv_info_t *usb_conv_info _U_)
 {
     /* feature selector */
-    proto_tree_add_item(tree, hf_usb_wFeatureSelector, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_wFeatureSelector, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset += 2;
 
     /* zero/interface/endpoint or test selector */
     /* XXX - check based on request type */
-    proto_tree_add_item(tree, hf_usb_wInterface, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_wInterface, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset += 2;
 
     /* zero */
-    proto_tree_add_item(tree, hf_usb_length, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset += 2;
 
     return offset;
@@ -1573,15 +1608,15 @@ static int
 dissect_usb_setup_set_interface_request(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int offset, usb_trans_info_t *usb_trans_info _U_, usb_conv_info_t *usb_conv_info _U_)
 {
     /* alternate setting */
-    proto_tree_add_item(tree, hf_usb_bAlternateSetting, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bAlternateSetting, tvb, offset, 1, ENC_LITTLE_ENDIAN);
     offset += 2;
 
     /* interface */
-    proto_tree_add_item(tree, hf_usb_wInterface, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_wInterface, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset += 2;
 
     /* zero */
-    proto_tree_add_item(tree, hf_usb_length, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset += 2;
 
     return offset;
@@ -1605,16 +1640,16 @@ static int
 dissect_usb_setup_synch_frame_request(packet_info *pinfo _U_, proto_tree *tree, tvbuff_t *tvb, int offset, usb_trans_info_t *usb_trans_info _U_, usb_conv_info_t *usb_conv_info _U_)
 {
     /* zero */
-    proto_tree_add_item(tree, hf_usb_value, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_value, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset += 2;
 
     /* endpoint */
     /* XXX */
-    proto_tree_add_item(tree, hf_usb_wInterface, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_wInterface, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset += 2;
 
     /* two */
-    proto_tree_add_item(tree, hf_usb_length, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset += 2;
 
     return offset;
@@ -1624,7 +1659,7 @@ static int
 dissect_usb_setup_synch_frame_response(packet_info *pinfo _U_, proto_tree *tree _U_, tvbuff_t *tvb _U_, int offset, usb_trans_info_t *usb_trans_info _U_, usb_conv_info_t *usb_conv_info _U_)
 {
     /* frame number */
-    proto_tree_add_item(tree, hf_usb_wFrameNumber, tvb, offset, 2, TRUE);
+    proto_tree_add_item(tree, hf_usb_wFrameNumber, tvb, offset, 2, ENC_LITTLE_ENDIAN);
     offset += 2;
 
     return offset;
@@ -1706,11 +1741,11 @@ static const value_string bmrequesttype_type_vals[] = {
 };
 
 static const value_string bmrequesttype_recipient_vals[] = {
-    { RQT_SETUP_RECIPIENT_DEVICE, "Device" },
-    { RQT_SETUP_RECIPIENT_INTERFACE, "Interface" },
-    { RQT_SETUP_RECIPIENT_INTERFACE, "Endpoint" },
-    { RQT_SETUP_RECIPIENT_INTERFACE, "Other" },
-    { 0, NULL }
+    {RQT_SETUP_RECIPIENT_DEVICE,    "Device" },
+    {RQT_SETUP_RECIPIENT_INTERFACE, "Interface" },
+    {RQT_SETUP_RECIPIENT_INTERFACE, "Endpoint" },
+    {RQT_SETUP_RECIPIENT_INTERFACE, "Other" },
+    {0, NULL }
 };
 
 static int
@@ -1721,28 +1756,30 @@ dissect_usb_bmrequesttype(proto_tree *parent_tree, tvbuff_t *tvb, int offset,
     proto_tree *tree=NULL;
 
     if(parent_tree){
-        item=proto_tree_add_item(parent_tree, hf_usb_bmRequestType, tvb, offset, 1, TRUE);
+        item=proto_tree_add_item(parent_tree, hf_usb_bmRequestType, tvb, offset, 1, ENC_LITTLE_ENDIAN);
         tree = proto_item_add_subtree(item, ett_usb_setup_bmrequesttype);
     }
 
     *type = USB_TYPE(tvb_get_guint8(tvb, offset));
-    proto_tree_add_item(tree, hf_usb_bmRequestType_direction, tvb, offset, 1, TRUE);
-    proto_tree_add_item(tree, hf_usb_bmRequestType_type, tvb, offset, 1, TRUE);
-    proto_tree_add_item(tree, hf_usb_bmRequestType_recipient, tvb, offset, 1, TRUE);
+    proto_tree_add_item(tree, hf_usb_bmRequestType_direction, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+    proto_tree_add_item(tree, hf_usb_bmRequestType_type, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+    proto_tree_add_item(tree, hf_usb_bmRequestType_recipient, tvb, offset, 1, ENC_LITTLE_ENDIAN);
 
     return ++offset;
 }
 
 /* Adds the Linux USB pseudo header fields to the tree.
- * NOTE: The multi-byte fields in this header (and only this header) are in
- *       host-endian format so we can't use proto_tree_add_item() nor the
- *       tvb_get_xyz() routines and is the reason for the tvb_memcpy() and
- *       proto_tree_add_uint[64]() pairs below. */
+ * NOTE: The multi-byte fields in this header, and the pseudo-header
+ *       extension, are in host-endian format so we can't
+ *       use proto_tree_add_item() nor the tvb_get_xyz() routines and is
+ *       the reason for the tvb_memcpy() and proto_tree_add_uint[64]()
+ *       pairs below. */
 static void
 dissect_linux_usb_pseudo_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
     guint8 transfer_type;
-    const gchar* val_str;
+    guint8 endpoint_number;
+    guint8 transfer_type_and_direction;
     guint8 type, flag;
     guint16 val16;
     guint32 val32;
@@ -1753,20 +1790,21 @@ dissect_linux_usb_pseudo_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
 
     /* show the event type of this URB as string and as a character */
     type = tvb_get_guint8(tvb, 8);
-    val_str = val_to_str(type, usb_urb_type_vals, "Unknown %d");
-    proto_tree_add_string_format_value(tree, hf_usb_urb_type, tvb, 8, 1,
-        &type, "%s ('%c')", val_str, isprint(type) ? type : '.');
-
-    proto_tree_add_item(tree, hf_usb_transfer_type, tvb, 9, 1, FALSE);
+    proto_tree_add_uint_format_value(tree, hf_usb_urb_type, tvb, 8, 1,
+        type, "%s ('%c')", val_to_str(type, usb_urb_type_vals, "Unknown %d"),
+        isprint(type) ? type : '.');
+    proto_tree_add_item(tree, hf_usb_transfer_type, tvb, 9, 1, ENC_BIG_ENDIAN);
 
     if (check_col(pinfo->cinfo, COL_INFO)) {
         transfer_type = tvb_get_guint8(tvb, 9);
+        endpoint_number = tvb_get_guint8(tvb, 10);
+        transfer_type_and_direction = (transfer_type & 0x7F) | (endpoint_number & 0x80);
         col_append_str(pinfo->cinfo, COL_INFO,
-                       val_to_str(transfer_type, usb_transfer_type_vals, "Unknown type %x"));
+                       val_to_str(transfer_type_and_direction, usb_transfer_type_and_direction_vals, "Unknown type %x"));
     }
 
-    proto_tree_add_item(tree, hf_usb_endpoint_number, tvb, 10, 1, FALSE);
-    proto_tree_add_item(tree, hf_usb_device_address, tvb, 11, 1, FALSE);
+    proto_tree_add_bitmask(tree, tvb, 10, hf_usb_endpoint_number, ett_usb_endpoint, usb_endpoint_fields, ENC_BIG_ENDIAN);
+    proto_tree_add_item(tree, hf_usb_device_address, tvb, 11, 1, ENC_BIG_ENDIAN);
 
     tvb_memcpy(tvb, (guint8 *)&val16, 12, 2);
     proto_tree_add_uint(tree, hf_usb_bus_id, tvb, 12, 2, val16);
@@ -1807,15 +1845,40 @@ dissect_linux_usb_pseudo_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
     proto_tree_add_uint(tree, hf_usb_data_len, tvb, 36, 4, val32);
 }
 
+/*
+ * XXX - put these into the protocol tree as appropriate.
+ */
+static int
+dissect_linux_usb_pseudo_header_ext(tvbuff_t *tvb, int offset,
+                                    packet_info *pinfo _U_,
+                                    proto_tree *tree _U_)
+{
+    guint32 ndesc;
+
+    offset += 4;        /* interval */
+    offset += 4;        /* start_frame */
+    offset += 4;        /* copy of URB's transfer flags */
+
+    tvb_memcpy(tvb, (guint8 *)&ndesc, offset, 4);
+    offset += 4;
+
+    /*
+     * Isochronous descriptors.  Each one is 16 bytes long.
+     */
+    offset += ndesc*16;
+
+    return offset;
+}
+
 static void
 dissect_linux_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent,
-                         gboolean padded)
+                         gboolean header_len_64_bytes)
 {
     unsigned int offset = 0;
     int type, endpoint;
     guint8 setup_flag;
     proto_tree *tree = NULL;
-    guint32 src_device, dst_device, tmp_addr;
+    guint32 tmp_addr;
     static usb_address_t src_addr, dst_addr; /* has to be static due to SET_ADDRESS */
     guint32 src_endpoint, dst_endpoint;
     gboolean is_request=FALSE;
@@ -1830,7 +1893,7 @@ dissect_linux_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent,
     if (parent) {
       proto_item *ti = NULL;
       ti = proto_tree_add_protocol_format(parent, proto_usb, tvb, 0,
-          sizeof(struct linux_usb_phdr) + sizeof(struct usb_device_setup_hdr), "USB URB");
+          header_len_64_bytes ? 64 : 48, "USB URB");
       tree = proto_item_add_subtree(ti, usb_hdr);
     }
 
@@ -1840,18 +1903,18 @@ dissect_linux_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent,
     endpoint = tvb_get_guint8(tvb, 10) & (~URB_TRANSFER_IN);
     tmp_addr = tvb_get_guint8(tvb, 11);
     setup_flag = tvb_get_guint8(tvb, 14);
-    offset += sizeof(struct linux_usb_phdr); /* skip pseudo header */
+    offset += 40; /* skip first part of the pseudo-header */
 
     /* Set up addresses and ports. */
     if (is_request) {
-        src_addr.device = src_device = 0xffffffff;
+        src_addr.device = 0xffffffff;
         src_addr.endpoint = src_endpoint = NO_ENDPOINT;
-        dst_addr.device = dst_device = htolel(tmp_addr);
+        dst_addr.device = htolel(tmp_addr);
         dst_addr.endpoint = dst_endpoint = htolel(endpoint);
     } else {
-        src_addr.device = src_device = htolel(tmp_addr);
+        src_addr.device = htolel(tmp_addr);
         src_addr.endpoint = src_endpoint = htolel(endpoint);
-        dst_addr.device = dst_device = 0xffffffff;
+        dst_addr.device = 0xffffffff;
         dst_addr.endpoint = dst_endpoint = NO_ENDPOINT;
     }
 
@@ -1883,7 +1946,7 @@ dissect_linux_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent,
         }
         usb_conv_info->usb_trans_info=usb_trans_info;
 
-        if(usb_trans_info && usb_trans_info->response_in){
+        if(usb_trans_info->response_in){
             proto_item *ti;
 
             ti=proto_tree_add_uint(tree, hf_usb_response_in, tvb, 0, 0, usb_trans_info->response_in);
@@ -1925,37 +1988,37 @@ dissect_linux_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent,
 
     switch(type){
     case URB_BULK:
-    case URB_BULK | URB_TRANSFER_IN:
         {
         proto_item *item;
 
         item=proto_tree_add_uint(tree, hf_usb_bInterfaceClass, tvb, 0, 0, usb_conv_info->interfaceClass);
         PROTO_ITEM_SET_GENERATED(item);
 
-        /* Skip setup header - it's not applicable */
-        offset += sizeof(struct usb_device_setup_hdr);
+        /* Skip setup/isochronous header - it's not applicable */
+        offset += 8;
 
         /*
-         * If this is padded (as is the case if the capture is done in
-         * memory-mapped mode), skip the padding; it's padded to a multiple
-         * of 64 bits *after* the pseudo-header and setup header.
+         * If this has a 64-byte header, process the extra 16 bytes of
+         * pseudo-header information.
          */
-        if (padded)
-            offset += (64 - ((sizeof(struct linux_usb_phdr) + sizeof(struct usb_device_setup_hdr)) % 64)) % 64;
+        if (header_len_64_bytes)
+            offset = dissect_linux_usb_pseudo_header_ext(tvb, offset, pinfo, tree);
 
         if(tvb_reported_length_remaining(tvb, offset)){
             tvbuff_t *next_tvb;
 
             pinfo->usb_conv_info=usb_conv_info;
             next_tvb=tvb_new_subset_remaining(tvb, offset);
-            if(dissector_try_port(usb_bulk_dissector_table, usb_conv_info->interfaceClass, next_tvb, pinfo, parent)){
+            if (try_heuristics && dissector_try_heuristic(heur_bulk_subdissector_list, next_tvb, pinfo, parent)) {
+                return;
+            }
+            else if(dissector_try_uint(usb_bulk_dissector_table, usb_conv_info->interfaceClass, next_tvb, pinfo, parent)){
                 return;
             }
         }
         }
         break;
     case URB_CONTROL:
-    case URB_CONTROL | URB_TRANSFER_IN:
         {
         const usb_setup_dissector_table_t *tmp;
         usb_setup_dissector dissector;
@@ -1974,7 +2037,7 @@ dissect_linux_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent,
 
                 /* Dissect the setup header - it's applicable */
 
-                ti = proto_tree_add_protocol_format(tree, proto_usb, tvb, offset, sizeof(struct usb_device_setup_hdr), "URB setup");
+                ti = proto_tree_add_protocol_format(tree, proto_usb, tvb, offset, 8, "URB setup");
                 setup_tree = proto_item_add_subtree(ti, usb_setup_hdr);
                 usb_trans_info->requesttype=tvb_get_guint8(tvb, offset);
                 offset=dissect_usb_bmrequesttype(setup_tree, tvb, offset, &type_2);
@@ -1992,7 +2055,7 @@ dissect_linux_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent,
                      * This is a standard request which is managed by this
                      * dissector
                      */
-                    proto_tree_add_item(setup_tree, hf_usb_request, tvb, offset, 1, TRUE);
+                    proto_tree_add_item(setup_tree, hf_usb_request, tvb, offset, 1, ENC_LITTLE_ENDIAN);
                     offset++;
 
                     if (check_col(pinfo->cinfo, COL_INFO)) {
@@ -2011,63 +2074,67 @@ dissect_linux_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent,
                     if(dissector){
                         offset=dissector(pinfo, setup_tree, tvb, offset, usb_trans_info, usb_conv_info);
                     } else {
-                        proto_tree_add_item(setup_tree, hf_usb_value, tvb, offset, 2, TRUE);
+                        proto_tree_add_item(setup_tree, hf_usb_value, tvb, offset, 2, ENC_LITTLE_ENDIAN);
                         offset += 2;
-                        proto_tree_add_item(setup_tree, hf_usb_index, tvb, offset, 2, TRUE);
+                        proto_tree_add_item(setup_tree, hf_usb_index, tvb, offset, 2, ENC_LITTLE_ENDIAN);
                         offset += 2;
-                        proto_tree_add_item(setup_tree, hf_usb_length, tvb, offset, 2, TRUE);
+                        proto_tree_add_item(setup_tree, hf_usb_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
                         offset += 2;
                     }
-
-                    /*
-                     * If this is padded (as is the case if the capture
-                     * is done in memory-mapped mode), skip the padding;
-                     * it's padded to a multiple of 64 bits *after* the
-                     * pseudo-header and setup header.
-                     */
-                    if (padded)
-                        offset += (64 - ((sizeof(struct linux_usb_phdr) + sizeof(struct usb_device_setup_hdr)) % 64)) % 64;
                     break;
 
                 case RQT_SETUP_TYPE_CLASS:
                     /* Try to find a class specific dissector */
                     next_tvb=tvb_new_subset_remaining(tvb, offset);
-                    if(dissector_try_port(usb_control_dissector_table, usb_conv_info->interfaceClass, next_tvb, pinfo, tree)){
+                    if (try_heuristics && dissector_try_heuristic(heur_control_subdissector_list, next_tvb, pinfo, tree)) {
+                        return;
+                    }
+                    if(dissector_try_uint(usb_control_dissector_table, usb_conv_info->interfaceClass, next_tvb, pinfo, tree)){
                         return;
                     }
                     /* Else no class dissector, just display generic fields */
-                    proto_tree_add_item(setup_tree, hf_usb_request_unknown_class, tvb, offset, 1, TRUE);
+                    proto_tree_add_item(setup_tree, hf_usb_request_unknown_class, tvb, offset, 1, ENC_LITTLE_ENDIAN);
                     offset++;
-                    proto_tree_add_item(setup_tree, hf_usb_value, tvb, offset, 2, TRUE);
+                    proto_tree_add_item(setup_tree, hf_usb_value, tvb, offset, 2, ENC_LITTLE_ENDIAN);
                     offset += 2;
-                    proto_tree_add_item(setup_tree, hf_usb_index, tvb, offset, 2, TRUE);
+                    proto_tree_add_item(setup_tree, hf_usb_index, tvb, offset, 2, ENC_LITTLE_ENDIAN);
                     offset += 2;
-                    proto_tree_add_item(setup_tree, hf_usb_length, tvb, offset, 2, TRUE);
+                    proto_tree_add_item(setup_tree, hf_usb_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
                     offset += 2;
                     break;
 
                 default:
-                    proto_tree_add_item(setup_tree, hf_usb_request_unknown_class, tvb, offset, 1, TRUE);
+                    proto_tree_add_item(setup_tree, hf_usb_request_unknown_class, tvb, offset, 1, ENC_LITTLE_ENDIAN);
                     offset++;
-                    proto_tree_add_item(setup_tree, hf_usb_value, tvb, offset, 2, TRUE);
+                    proto_tree_add_item(setup_tree, hf_usb_value, tvb, offset, 2, ENC_LITTLE_ENDIAN);
                     offset += 2;
-                    proto_tree_add_item(setup_tree, hf_usb_index, tvb, offset, 2, TRUE);
+                    proto_tree_add_item(setup_tree, hf_usb_index, tvb, offset, 2, ENC_LITTLE_ENDIAN);
                     offset += 2;
-                    proto_tree_add_item(setup_tree, hf_usb_length, tvb, offset, 2, TRUE);
+                    proto_tree_add_item(setup_tree, hf_usb_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
                     offset += 2;
                 }
             } else {
-                /* Skip setup header - it's not applicable */
-                offset += sizeof(struct usb_device_setup_hdr);
-
-                /*
-                 * If this is padded (as is the case if the capture is done
-                 * in memory-mapped mode), skip the padding; it's padded to
-                 * a multiple of 64 bits *after* the pseudo-header and setup
-                 * header.
-                 */
-                if (padded)
-                    offset += (64 - ((sizeof(struct linux_usb_phdr) + sizeof(struct usb_device_setup_hdr)) % 64)) % 64;
+                /* Skip setup/isochronous header - it's not applicable */
+                offset += 8;
+            }
+
+            /*
+             * If this has a 64-byte header, process the extra 16 bytes of
+             * pseudo-header information.
+             */
+            if (header_len_64_bytes)
+                offset = dissect_linux_usb_pseudo_header_ext(tvb, offset, pinfo, tree);
+
+            if (tvb_reported_length_remaining(tvb, offset) != 0) {
+                tvbuff_t *next_tvb;
+
+                next_tvb = tvb_new_subset_remaining(tvb, offset);
+                if (try_heuristics && dissector_try_heuristic(heur_control_subdissector_list, next_tvb, pinfo, tree)) {
+                    return;
+                }
+                if(dissector_try_uint(usb_control_dissector_table, usb_conv_info->interfaceClass, next_tvb, pinfo, tree)){
+                    return;
+                }
             }
         } else {
             tvbuff_t *next_tvb;
@@ -2075,20 +2142,22 @@ dissect_linux_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent,
             /* this is a response */
 
             /* Skip setup header - it's never applicable for responses */
-            offset += sizeof(struct usb_device_setup_hdr);
+            offset += 8;
 
             /*
-             * If this is padded (as is the case if the capture is done in
-             * memory-mapped mode), skip the padding; it's padded to a multiple
-             * of 64 bits *after* the pseudo-header and setup header.
+             * If this has a 64-byte header, process the extra 16 bytes of
+             * pseudo-header information.
              */
-            if (padded)
-                offset += (64 - ((sizeof(struct linux_usb_phdr) + sizeof(struct usb_device_setup_hdr)) % 64)) % 64;
+            if (header_len_64_bytes)
+                offset = dissect_linux_usb_pseudo_header_ext(tvb, offset, pinfo, tree);
 
             if(usb_trans_info){
                 /* Try to find a class specific dissector */
                 next_tvb=tvb_new_subset_remaining(tvb, offset);
-                if(dissector_try_port(usb_control_dissector_table, usb_conv_info->interfaceClass, next_tvb, pinfo, tree)){
+                if (try_heuristics && dissector_try_heuristic(heur_control_subdissector_list, next_tvb, pinfo, tree)) {
+                    return;
+                }
+                if(dissector_try_uint(usb_control_dissector_table, usb_conv_info->interfaceClass, next_tvb, pinfo, tree)){
                     return;
                 }
 
@@ -2139,6 +2208,124 @@ dissect_linux_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent,
         }
         }
         break;
+    case URB_ISOCHRONOUS:
+        {
+        guint32 iso_numdesc = 0;
+        proto_item *ti = NULL;
+        ti=proto_tree_add_uint(tree, hf_usb_bInterfaceClass, tvb, offset, 0, usb_conv_info->interfaceClass);
+        PROTO_ITEM_SET_GENERATED(ti);
+
+        /* All fields which belong to Linux usbmon headers are in host-endian
+         * byte order. The fields coming from the USB communication are in little
+         * endian format (see usb_20.pdf, chapter 8.1 Byte/Bit ordering).
+         *
+         * When a capture file is transfered to a host with different endianness
+         * than packet was captured then the necessary swapping happens in
+         * wiretap/pcap-common.c, pcap_process_linux_usb_pseudoheader().
+         */
+
+        if (setup_flag == 0) {
+            proto_tree *setup_tree = NULL;
+            int type_2;
+
+            /* Dissect the setup header - it's applicable */
+
+            ti = proto_tree_add_protocol_format(tree, proto_usb, tvb, offset, 8, "URB setup");
+            setup_tree = proto_item_add_subtree(ti, usb_setup_hdr);
+
+            offset = dissect_usb_bmrequesttype(setup_tree, tvb, offset, &type_2);
+            proto_tree_add_item(setup_tree, hf_usb_request, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+            offset++;
+            proto_tree_add_item(tree, hf_usb_value, tvb, offset, 2, ENC_LITTLE_ENDIAN);
+            offset += 2;
+            proto_tree_add_item(tree, hf_usb_index, tvb, offset, 2, ENC_LITTLE_ENDIAN);
+            offset += 2;
+            proto_tree_add_item(tree, hf_usb_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
+            offset += 2;
+        } else {
+
+            /* Process ISO related fields (usbmon_packet.iso). The fields are
+             * in host endian byte order so use tvb_memcopy() and
+             * proto_tree_add_uint() pair.
+             */
+            guint32 val32;
+
+            tvb_memcpy(tvb, (guint8 *)&val32, offset, 4);
+            proto_tree_add_uint(tree, hf_usb_iso_error_count, tvb, offset, 4, val32);
+            offset += 4;
+
+            tvb_memcpy(tvb, (guint8 *)&iso_numdesc, offset, 4);
+            proto_tree_add_uint(tree, hf_usb_iso_numdesc, tvb, offset, 4, iso_numdesc);
+            offset += 4;
+        }
+
+        /*
+         * If this has a 64-byte header, process the extra 16 bytes of
+         * pseudo-header information.
+         */
+        if (header_len_64_bytes) {
+            guint32 ndesc;
+
+            offset += 4;        /* interval */
+            offset += 4;        /* start_frame */
+            offset += 4;        /* copy of URB's transfer flags */
+
+            tvb_memcpy(tvb, (guint8 *)&ndesc, offset, 4);
+            offset += 4;
+
+        }
+
+        if (setup_flag != 0) {
+            proto_tree *urb_tree = NULL;
+            guint32 i;
+            unsigned int data_base;
+            guint32 iso_status;
+            guint32 iso_off;
+            guint32 iso_len;
+            guint32 iso_pad;
+
+            data_base = offset + iso_numdesc * 16;
+            urb_tree = tree;
+            for (i = 0; i != iso_numdesc; i++) {
+                if (parent) {
+                    proto_item *ti = NULL;
+                    ti = proto_tree_add_protocol_format(urb_tree, proto_usb, tvb, offset,
+                         16, "USB isodesc %u", i);
+                    tree = proto_item_add_subtree(ti, usb_isodesc);
+                }
+
+                /* Add ISO descriptor fields which are stored in host
+                 * endian byte order so use tvb_memcopy() and
+                 * proto_tree_add_uint()/proto_tree_add_int() pair.
+                 */
+                tvb_memcpy(tvb, (guint8 *)&iso_status, offset, 4);
+                proto_tree_add_int(tree, hf_usb_iso_status, tvb, offset, 4, iso_status);
+                offset += 4;
+
+                tvb_memcpy(tvb, (guint8 *)&iso_off, offset, 4);
+                proto_tree_add_uint(tree, hf_usb_iso_off, tvb, offset, 4, iso_off);
+                offset += 4;
+
+                tvb_memcpy(tvb, (guint8 *)&iso_len, offset, 4);
+                proto_tree_add_uint(tree, hf_usb_iso_len, tvb, offset, 4, iso_len);
+                offset += 4;
+
+                /* When the ISO status is OK and there is ISO data and this ISO data is
+                 * fully captured then show this data.
+                 */
+                if (!iso_status && iso_len && data_base + iso_off + iso_len <= tvb_length(tvb))
+                    proto_tree_add_item(tree, hf_usb_iso_data, tvb, data_base + iso_off, iso_len, ENC_NA);
+
+                tvb_memcpy(tvb, (guint8 *)&iso_pad, offset, 4);
+                proto_tree_add_uint(tree, hf_usb_iso_pad, tvb, offset, 4, iso_pad);
+                offset += 4;
+            }
+            tree = urb_tree;
+        }
+
+        }
+        break;
+
     default:
         /* dont know */
         if (setup_flag == 0) {
@@ -2148,36 +2335,36 @@ dissect_linux_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent,
 
             /* Dissect the setup header - it's applicable */
 
-            ti = proto_tree_add_protocol_format(tree, proto_usb, tvb, offset, sizeof(struct usb_device_setup_hdr), "URB setup");
+            ti = proto_tree_add_protocol_format(tree, proto_usb, tvb, offset, 8, "URB setup");
             setup_tree = proto_item_add_subtree(ti, usb_setup_hdr);
 
             offset=dissect_usb_bmrequesttype(setup_tree, tvb, offset, &type_2);
-            proto_tree_add_item(setup_tree, hf_usb_request, tvb, offset, 1, TRUE);
+            proto_tree_add_item(setup_tree, hf_usb_request, tvb, offset, 1, ENC_LITTLE_ENDIAN);
             offset++;
-            proto_tree_add_item(tree, hf_usb_value, tvb, offset, 2, TRUE);
+            proto_tree_add_item(tree, hf_usb_value, tvb, offset, 2, ENC_LITTLE_ENDIAN);
             offset += 2;
-            proto_tree_add_item(tree, hf_usb_index, tvb, offset, 2, TRUE);
+            proto_tree_add_item(tree, hf_usb_index, tvb, offset, 2, ENC_LITTLE_ENDIAN);
             offset += 2;
-            proto_tree_add_item(tree, hf_usb_length, tvb, offset, 2, TRUE);
+            proto_tree_add_item(tree, hf_usb_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
             offset += 2;
         } else {
-            /* Skip setup header - it's not applicable */
-            offset += sizeof(struct usb_device_setup_hdr);
+            /* Skip setup/isochronous header - it's not applicable */
+            offset += 8;
         }
 
         /*
-         * If this is padded (as is the case if the capture is done in
-         * memory-mapped mode), skip the padding; it's padded to a multiple
-         * of 64 bits *after* the pseudo-header and setup header.
+         * If this has a 64-byte header, process the extra 16 bytes of
+         * pseudo-header information.
          */
-        if (padded)
-            offset += (64 - ((sizeof(struct linux_usb_phdr) + sizeof(struct usb_device_setup_hdr)) % 64)) % 64;
+        if (header_len_64_bytes)
+            offset = dissect_linux_usb_pseudo_header_ext(tvb, offset, pinfo, tree);
+
         break;
     }
 
     if (tvb_reported_length_remaining(tvb, offset) != 0) {
         /* There is leftover capture data to add (padding?) */
-        proto_tree_add_item(tree, hf_usb_capdata, tvb, offset, -1, FALSE);
+        proto_tree_add_item(tree, hf_usb_capdata, tvb, offset, -1, ENC_NA);
     }
 }
 
@@ -2196,332 +2383,367 @@ dissect_linux_usb_mmapped(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent)
 void
 proto_register_usb(void)
 {
+    module_t *usb_module;
     static hf_register_info hf[] = {
 
     /* USB packet pseudoheader members */
         { &hf_usb_urb_id,
-        { "URB id", "usb.urb_id", FT_UINT64, BASE_HEX,
-                NULL, 0x0,
-                NULL, HFILL }},
+          { "URB id", "usb.urb_id", FT_UINT64, BASE_HEX,
+            NULL, 0x0,
+            NULL, HFILL }},
 
         { &hf_usb_urb_type,
-        { "URB type", "usb.urb_type", FT_STRING, BASE_NONE,
-                NULL, 0x0,
-                NULL, HFILL }},
+          { "URB type", "usb.urb_type", FT_UINT8, BASE_DEC,
+            VALS(usb_urb_type_vals), 0x0,
+            NULL, HFILL }},
 
         { &hf_usb_transfer_type,
-        { "URB transfer type", "usb.transfer_type", FT_UINT8, BASE_HEX,
-                VALS(usb_transfer_type_vals), 0x0,
-                NULL, HFILL }},
+          { "URB transfer type", "usb.transfer_type", FT_UINT8, BASE_HEX,
+            VALS(usb_transfer_type_vals), 0x0,
+            NULL, HFILL }},
 
         { &hf_usb_endpoint_number,
-        { "Endpoint", "usb.endpoint_number", FT_UINT8, BASE_HEX, NULL, 0x0,
-                "USB endpoint number", HFILL }},
+          { "Endpoint", "usb.endpoint_number", FT_UINT8, BASE_HEX, NULL, 0x0,
+            "USB endpoint number", HFILL }},
+
+        { &hf_usb_endpoint_direction,
+          { "Direction", "usb.endpoint_number.direction", FT_UINT8, BASE_DEC,
+            VALS(usb_endpoint_direction_vals), 0x80,
+            "USB endpoint direction", HFILL }},
+
+        { &hf_usb_endpoint_number_value,
+          { "Endpoint value", "usb.endpoint_number.endpoint", FT_UINT8, BASE_DEC,
+            NULL, 0x7F,
+            "USB endpoint value", HFILL }},
 
         { &hf_usb_device_address,
-        { "Device", "usb.device_address", FT_UINT8, BASE_DEC, NULL, 0x0,
-                "USB device address", HFILL }},
+          { "Device", "usb.device_address", FT_UINT8, BASE_DEC, NULL, 0x0,
+            "USB device address", HFILL }},
 
         { &hf_usb_bus_id,
-        { "URB bus id", "usb.bus_id", FT_UINT16, BASE_DEC,
-                NULL, 0x0,
-                NULL, HFILL }},
+          { "URB bus id", "usb.bus_id", FT_UINT16, BASE_DEC,
+            NULL, 0x0,
+            NULL, HFILL }},
 
         { &hf_usb_setup_flag,
-        { "Device setup request", "usb.setup_flag", FT_STRING, BASE_NONE,
-                 NULL, 0x0,
-                 "USB device setup request is relevant (0) or not", HFILL }},
+          { "Device setup request", "usb.setup_flag", FT_STRING, BASE_NONE,
+            NULL, 0x0,
+            "USB device setup request is relevant (0) or not", HFILL }},
 
         { &hf_usb_data_flag,
-        { "Data", "usb.data_flag", FT_STRING, BASE_NONE,
-                 NULL, 0x0,
-                 "USB data is present (0) or not", HFILL }},
+          { "Data", "usb.data_flag", FT_STRING, BASE_NONE,
+            NULL, 0x0,
+            "USB data is present (0) or not", HFILL }},
 
         { &hf_usb_urb_ts_sec,
-        { "URB sec", "usb.urb_ts_sec", FT_UINT64, BASE_DEC,
-                NULL, 0x0,
-                NULL, HFILL }},
+          { "URB sec", "usb.urb_ts_sec", FT_UINT64, BASE_DEC,
+            NULL, 0x0,
+            NULL, HFILL }},
 
         { &hf_usb_urb_ts_usec,
-        { "URB usec", "usb.urb_ts_usec", FT_UINT32, BASE_DEC,
-                NULL, 0x0,
-                NULL, HFILL }},
+          { "URB usec", "usb.urb_ts_usec", FT_UINT32, BASE_DEC,
+            NULL, 0x0,
+            NULL, HFILL }},
 
         { &hf_usb_urb_status,
-        { "URB status", "usb.urb_status", FT_INT32, BASE_DEC,
-                VALS(usb_urb_status_vals), 0x0,
-                NULL, HFILL }},
+          { "URB status", "usb.urb_status", FT_INT32, BASE_DEC,
+            VALS(usb_urb_status_vals), 0x0,
+            NULL, HFILL }},
 
         { &hf_usb_urb_len,
-        { "URB length [bytes]", "usb.urb_len", FT_UINT32, BASE_DEC, NULL, 0x0,
-                "URB length in bytes", HFILL }},
+          { "URB length [bytes]", "usb.urb_len", FT_UINT32, BASE_DEC, NULL, 0x0,
+            "URB length in bytes", HFILL }},
 
         { &hf_usb_data_len,
-        { "Data length [bytes]", "usb.data_len", FT_UINT32, BASE_DEC, NULL, 0x0,
-                "URB data length in bytes", HFILL }},
-
-    /* Generated values */
-        { &hf_usb_src_endpoint_number,
-        { "Src Endpoint", "usb.src.endpoint", FT_UINT8, BASE_HEX, NULL, 0x0,
-                "Source USB endpoint number", HFILL }},
-
-        { &hf_usb_dst_endpoint_number,
-        { "Dst Endpoint", "usb.dst.endpoint", FT_UINT8, BASE_HEX, NULL, 0x0,
-                "Destination USB endpoint number", HFILL }},
+          { "Data length [bytes]", "usb.data_len", FT_UINT32, BASE_DEC, NULL, 0x0,
+            "URB data length in bytes", HFILL }},
 
     /* Fields from usb20.pdf, Table 9-2 'Format of Setup Data' */
         { &hf_usb_bmRequestType,
-        { "bmRequestType", "usb.bmRequestType", FT_UINT8, BASE_HEX, NULL, 0x0,
-                NULL, HFILL }},
+          { "bmRequestType", "usb.bmRequestType", FT_UINT8, BASE_HEX, NULL, 0x0,
+            NULL, HFILL }},
 
         { &hf_usb_request,
-        { "bRequest", "usb.setup.bRequest", FT_UINT8, BASE_DEC, VALS(setup_request_names_vals), 0x0,
-                NULL, HFILL }},
+          { "bRequest", "usb.setup.bRequest", FT_UINT8, BASE_DEC, VALS(setup_request_names_vals), 0x0,
+            NULL, HFILL }},
 
         /* Same as hf_usb_request but no descriptive text */
         { &hf_usb_request_unknown_class,
-        { "bRequest", "usb.setup.bRequest", FT_UINT8, BASE_DEC, NULL, 0x0,
-                NULL, HFILL }},
+          { "bRequest", "usb.setup.bRequest", FT_UINT8, BASE_DEC, NULL, 0x0,
+            NULL, HFILL }},
 
         { &hf_usb_value,
-        { "wValue", "usb.setup.wValue", FT_UINT16, BASE_HEX, NULL, 0x0,
-                NULL, HFILL }},
+          { "wValue", "usb.setup.wValue", FT_UINT16, BASE_HEX, NULL, 0x0,
+            NULL, HFILL }},
 
         { &hf_usb_index,
-        { "wIndex", "usb.setup.wIndex", FT_UINT16, BASE_DEC, NULL, 0x0,
-                NULL, HFILL }},
+          { "wIndex", "usb.setup.wIndex", FT_UINT16, BASE_DEC, NULL, 0x0,
+            NULL, HFILL }},
 
         { &hf_usb_length,
-        { "wLength", "usb.setup.wLength", FT_UINT16, BASE_DEC, NULL, 0x0,
-                NULL, HFILL }},
+          { "wLength", "usb.setup.wLength", FT_UINT16, BASE_DEC, NULL, 0x0,
+            NULL, HFILL }},
 
         { &hf_usb_wFeatureSelector,
-        { "wFeatureSelector", "usb.setup.wFeatureSelector", FT_UINT16, BASE_DEC,
-                VALS(usb_feature_selector_vals), 0x0, NULL, HFILL }},
+          { "wFeatureSelector", "usb.setup.wFeatureSelector", FT_UINT16, BASE_DEC,
+            VALS(usb_feature_selector_vals), 0x0, NULL, HFILL }},
 
         { &hf_usb_wInterface,
-        { "wInterface", "usb.setup.wInterface", FT_UINT16, BASE_DEC,
-                NULL, 0x0, NULL, HFILL }},
+          { "wInterface", "usb.setup.wInterface", FT_UINT16, BASE_DEC,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_wStatus,
-        { "wStatus", "usb.setup.wStatus", FT_UINT16, BASE_HEX,
-                NULL, 0x0, NULL, HFILL }},
+          { "wStatus", "usb.setup.wStatus", FT_UINT16, BASE_HEX,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_wFrameNumber,
-        { "wFrameNumber", "usb.setup.wFrameNumber", FT_UINT16, BASE_DEC,
-                NULL, 0x0, NULL, HFILL }},
+          { "wFrameNumber", "usb.setup.wFrameNumber", FT_UINT16, BASE_DEC,
+            NULL, 0x0, NULL, HFILL }},
 
+    /* --------------------------------- */
+        { &hf_usb_iso_error_count,                /* host endian byte order */
+          { "ISO error count", "usb.iso.error_count", FT_UINT16, BASE_DEC, NULL, 0x0,
+            NULL, HFILL }},
+
+        { &hf_usb_iso_numdesc,                    /* host endian byte order */
+          { "Number of ISO descriptors", "usb.iso.numdesc", FT_UINT16, BASE_DEC, NULL, 0x0,
+            NULL, HFILL }},
+
+        /* fields of struct mon_bin_isodesc from linux/drivers/usb/mon/mon_bin.c */
+        { &hf_usb_iso_status,                     /* host endian byte order */
+          { "Status", "usb.iso.iso_status", FT_INT32, BASE_DEC,
+            VALS(usb_urb_status_vals), 0x0,
+            "ISO descriptor status", HFILL }},
+
+        { &hf_usb_iso_off,                        /* host endian byte order */
+          { "Offset [bytes]", "usb.iso.iso_off", FT_UINT32, BASE_DEC, NULL, 0x0,
+            "ISO data offset in bytes starting from the end of the last ISO descriptor", HFILL }},
+
+        { &hf_usb_iso_len,                        /* host endian byte order */
+          { "Length [bytes]", "usb.iso.iso_len", FT_UINT32, BASE_DEC, NULL, 0x0,
+            "ISO data length in bytes", HFILL }},
+
+        { &hf_usb_iso_pad,                        /* host endian byte order */
+          { "Padding", "usb.iso._pad", FT_UINT32, BASE_HEX, NULL, 0x0,
+            "Padding field of ISO descriptor structure", HFILL }},
+
+        { &hf_usb_iso_data,
+          {"ISO Data", "usb.iso.data",
+           FT_BYTES, BASE_NONE, NULL, 0x0,
+           NULL, HFILL }},
     /* --------------------------------- */
         { &hf_usb_data,
-        {"Application Data", "usb.data",
-            FT_BYTES, BASE_NONE, NULL, 0x0,
-            "Payload is application data", HFILL }},
+          {"Application Data", "usb.data",
+           FT_BYTES, BASE_NONE, NULL, 0x0,
+           "Payload is application data", HFILL }},
 
         { &hf_usb_capdata,
-        {"Leftover Capture Data", "usb.capdata",
-            FT_BYTES, BASE_NONE, NULL, 0x0,
-            "Padding added by the USB capture system", HFILL }},
+          {"Leftover Capture Data", "usb.capdata",
+           FT_BYTES, BASE_NONE, NULL, 0x0,
+           "Padding added by the USB capture system", HFILL }},
 
         { &hf_usb_bmRequestType_direction,
-        { "Direction", "usb.bmRequestType.direction", FT_BOOLEAN, 8,
-          TFS(&tfs_bmrequesttype_direction), USB_DIR_IN, NULL, HFILL }},
+          { "Direction", "usb.bmRequestType.direction", FT_BOOLEAN, 8,
+            TFS(&tfs_bmrequesttype_direction), USB_DIR_IN, NULL, HFILL }},
 
         { &hf_usb_bmRequestType_type,
-        { "Type", "usb.bmRequestType.type", FT_UINT8, BASE_HEX,
-          VALS(bmrequesttype_type_vals), USB_TYPE_MASK, NULL, HFILL }},
+          { "Type", "usb.bmRequestType.type", FT_UINT8, BASE_HEX,
+            VALS(bmrequesttype_type_vals), USB_TYPE_MASK, NULL, HFILL }},
 
         { &hf_usb_bmRequestType_recipient,
-        { "Recipient", "usb.bmRequestType.recipient", FT_UINT8, BASE_HEX,
-          VALS(bmrequesttype_recipient_vals), 0x1f, NULL, HFILL }},
+          { "Recipient", "usb.bmRequestType.recipient", FT_UINT8, BASE_HEX,
+            VALS(bmrequesttype_recipient_vals), 0x1f, NULL, HFILL }},
 
         { &hf_usb_bDescriptorType,
-        { "bDescriptorType", "usb.bDescriptorType", FT_UINT8, BASE_DEC,
-          VALS(descriptor_type_vals), 0x0, NULL, HFILL }},
+          { "bDescriptorType", "usb.bDescriptorType", FT_UINT8, BASE_DEC,
+            VALS(descriptor_type_vals), 0x0, NULL, HFILL }},
 
         { &hf_usb_descriptor_index,
-        { "Descriptor Index", "usb.DescriptorIndex", FT_UINT8, BASE_HEX,
-          NULL, 0x0, NULL, HFILL }},
+          { "Descriptor Index", "usb.DescriptorIndex", FT_UINT8, BASE_HEX,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_language_id,
-        { "Language Id", "usb.LanguageId", FT_UINT16, BASE_HEX,
-          VALS(usb_langid_vals), 0x0, NULL, HFILL }},
+          { "Language Id", "usb.LanguageId", FT_UINT16, BASE_HEX|BASE_EXT_STRING,
+            &usb_langid_vals_ext, 0x0, NULL, HFILL }},
 
         { &hf_usb_bLength,
-        { "bLength", "usb.bLength", FT_UINT8, BASE_DEC,
-          NULL, 0x0, NULL, HFILL }},
+          { "bLength", "usb.bLength", FT_UINT8, BASE_DEC,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_bcdUSB,
-        { "bcdUSB", "usb.bcdUSB", FT_UINT16, BASE_HEX,
-          NULL, 0x0, NULL, HFILL }},
+          { "bcdUSB", "usb.bcdUSB", FT_UINT16, BASE_HEX,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_bDeviceClass,
-        { "bDeviceClass", "usb.bDeviceClass", FT_UINT8, BASE_DEC,
-          NULL, 0x0, NULL, HFILL }},
+          { "bDeviceClass", "usb.bDeviceClass", FT_UINT8, BASE_DEC,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_bDeviceSubClass,
-        { "bDeviceSubClass", "usb.bDeviceSubClass", FT_UINT8, BASE_DEC,
-          NULL, 0x0, NULL, HFILL }},
+          { "bDeviceSubClass", "usb.bDeviceSubClass", FT_UINT8, BASE_DEC,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_bDeviceProtocol,
-        { "bDeviceProtocol", "usb.bDeviceProtocol", FT_UINT8, BASE_DEC,
-          NULL, 0x0, NULL, HFILL }},
+          { "bDeviceProtocol", "usb.bDeviceProtocol", FT_UINT8, BASE_DEC,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_bMaxPacketSize0,
-        { "bMaxPacketSize0", "usb.bMaxPacketSize0", FT_UINT8, BASE_DEC,
-          NULL, 0x0, NULL, HFILL }},
+          { "bMaxPacketSize0", "usb.bMaxPacketSize0", FT_UINT8, BASE_DEC,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_idVendor,
-        { "idVendor", "usb.idVendor", FT_UINT16, BASE_HEX,
-          NULL, 0x0, NULL, HFILL }},
+          { "idVendor", "usb.idVendor", FT_UINT16, BASE_HEX,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_idProduct,
-        { "idProduct", "usb.idProduct", FT_UINT16, BASE_HEX,
-          NULL, 0x0, NULL, HFILL }},
+          { "idProduct", "usb.idProduct", FT_UINT16, BASE_HEX,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_bcdDevice,
-        { "bcdDevice", "usb.bcdDevice", FT_UINT16, BASE_HEX,
-          NULL, 0x0, NULL, HFILL }},
+          { "bcdDevice", "usb.bcdDevice", FT_UINT16, BASE_HEX,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_iManufacturer,
-        { "iManufacturer", "usb.iManufacturer", FT_UINT8, BASE_DEC,
-          NULL, 0x0, NULL, HFILL }},
+          { "iManufacturer", "usb.iManufacturer", FT_UINT8, BASE_DEC,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_iProduct,
-        { "iProduct", "usb.iProduct", FT_UINT8, BASE_DEC,
-          NULL, 0x0, NULL, HFILL }},
+          { "iProduct", "usb.iProduct", FT_UINT8, BASE_DEC,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_iSerialNumber,
-        { "iSerialNumber", "usb.iSerialNumber", FT_UINT8, BASE_DEC,
-          NULL, 0x0, NULL, HFILL }},
+          { "iSerialNumber", "usb.iSerialNumber", FT_UINT8, BASE_DEC,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_bNumConfigurations,
-        { "bNumConfigurations", "usb.bNumConfigurations", FT_UINT8, BASE_DEC,
-          NULL, 0x0, NULL, HFILL }},
+          { "bNumConfigurations", "usb.bNumConfigurations", FT_UINT8, BASE_DEC,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_wLANGID,
-        { "wLANGID", "usb.wLANGID", FT_UINT16, BASE_HEX,
-          VALS(usb_langid_vals), 0x0, NULL, HFILL }},
+          { "wLANGID", "usb.wLANGID", FT_UINT16, BASE_HEX|BASE_EXT_STRING,
+            &usb_langid_vals_ext, 0x0, NULL, HFILL }},
 
         { &hf_usb_bString,
-        { "bString", "usb.bString", FT_STRING, BASE_NONE,
-          NULL, 0x0, NULL, HFILL }},
+          { "bString", "usb.bString", FT_STRING, BASE_NONE,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_bInterfaceNumber,
-        { "bInterfaceNumber", "usb.bInterfaceNumber", FT_UINT8, BASE_DEC,
-          NULL, 0x0, NULL, HFILL }},
+          { "bInterfaceNumber", "usb.bInterfaceNumber", FT_UINT8, BASE_DEC,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_bAlternateSetting,
-        { "bAlternateSetting","usb.bAlternateSetting", FT_UINT8, BASE_DEC,
-          NULL, 0x0, NULL, HFILL }},
+          { "bAlternateSetting","usb.bAlternateSetting", FT_UINT8, BASE_DEC,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_bNumEndpoints,
-        { "bNumEndpoints","usb.bNumEndpoints", FT_UINT8, BASE_DEC,
-          NULL, 0x0, NULL, HFILL }},
+          { "bNumEndpoints","usb.bNumEndpoints", FT_UINT8, BASE_DEC,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_bInterfaceClass,
-        { "bInterfaceClass", "usb.bInterfaceClass", FT_UINT8, BASE_HEX,
-          VALS(usb_interfaceclass_vals), 0x0, NULL, HFILL }},
+          { "bInterfaceClass", "usb.bInterfaceClass", FT_UINT8, BASE_HEX,
+            VALS(usb_interfaceclass_vals), 0x0, NULL, HFILL }},
 
         { &hf_usb_bInterfaceSubClass,
-        { "bInterfaceSubClass", "usb.bInterfaceSubClass", FT_UINT8, BASE_HEX,
-          NULL, 0x0, NULL, HFILL }},
+          { "bInterfaceSubClass", "usb.bInterfaceSubClass", FT_UINT8, BASE_HEX,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_bInterfaceProtocol,
-        { "bInterfaceProtocol", "usb.bInterfaceProtocol", FT_UINT8, BASE_HEX,
-          NULL, 0x0, NULL, HFILL }},
+          { "bInterfaceProtocol", "usb.bInterfaceProtocol", FT_UINT8, BASE_HEX,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_iInterface,
-        { "iInterface", "usb.iInterface", FT_UINT8, BASE_DEC,
-          NULL, 0x0, NULL, HFILL }},
+          { "iInterface", "usb.iInterface", FT_UINT8, BASE_DEC,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_bEndpointAddress,
-        { "bEndpointAddress", "usb.bEndpointAddress", FT_UINT8, BASE_HEX,
-          NULL, 0x0, NULL, HFILL }},
+          { "bEndpointAddress", "usb.bEndpointAddress", FT_UINT8, BASE_HEX,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_configuration_bmAttributes,
-        { "Configuration bmAttributes", "usb.configuration.bmAttributes", FT_UINT8, BASE_HEX,
-          NULL, 0x0, NULL, HFILL }},
+          { "Configuration bmAttributes", "usb.configuration.bmAttributes", FT_UINT8, BASE_HEX,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_bmAttributes,
-        { "bmAttributes", "usb.bmAttributes", FT_UINT8, BASE_HEX,
-          NULL, 0x0, NULL, HFILL }},
+          { "bmAttributes", "usb.bmAttributes", FT_UINT8, BASE_HEX,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_bEndpointAttributeTransfer,
-        { "Transfertype", "usb.bmAttributes.transfer", FT_UINT8, BASE_HEX,
-          VALS(usb_bmAttributes_transfer_vals), 0x03, NULL, HFILL }},
+          { "Transfertype", "usb.bmAttributes.transfer", FT_UINT8, BASE_HEX,
+            VALS(usb_bmAttributes_transfer_vals), 0x03, NULL, HFILL }},
 
         { &hf_usb_bEndpointAttributeSynchonisation,
-        { "Synchronisationtype", "usb.bmAttributes.sync", FT_UINT8, BASE_HEX,
-          VALS(usb_bmAttributes_sync_vals), 0x0c, NULL, HFILL }},
+          { "Synchronisationtype", "usb.bmAttributes.sync", FT_UINT8, BASE_HEX,
+            VALS(usb_bmAttributes_sync_vals), 0x0c, NULL, HFILL }},
 
         { &hf_usb_bEndpointAttributeBehaviour,
-        { "Behaviourtype", "usb.bmAttributes.behaviour", FT_UINT8, BASE_HEX,
-          VALS(usb_bmAttributes_behaviour_vals), 0x30, NULL, HFILL }},
+          { "Behaviourtype", "usb.bmAttributes.behaviour", FT_UINT8, BASE_HEX,
+            VALS(usb_bmAttributes_behaviour_vals), 0x30, NULL, HFILL }},
 
         { &hf_usb_wMaxPacketSize,
-        { "wMaxPacketSize", "usb.wMaxPacketSize", FT_UINT16, BASE_DEC,
-          NULL, 0x0, NULL, HFILL }},
+          { "wMaxPacketSize", "usb.wMaxPacketSize", FT_UINT16, BASE_DEC,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_bInterval,
-        { "bInterval", "usb.bInterval", FT_UINT8, BASE_DEC,
-          NULL, 0x0, NULL, HFILL }},
+          { "bInterval", "usb.bInterval", FT_UINT8, BASE_DEC,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_wTotalLength,
-        { "wTotalLength", "usb.wTotalLength", FT_UINT16, BASE_DEC,
-          NULL, 0x0, NULL, HFILL }},
+          { "wTotalLength", "usb.wTotalLength", FT_UINT16, BASE_DEC,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_bNumInterfaces,
-        { "bNumInterfaces", "usb.bNumInterfaces", FT_UINT8, BASE_DEC,
-          NULL, 0x0, NULL, HFILL }},
+          { "bNumInterfaces", "usb.bNumInterfaces", FT_UINT8, BASE_DEC,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_bConfigurationValue,
-        { "bConfigurationValue", "usb.bConfigurationValue", FT_UINT8, BASE_DEC,
-          NULL, 0x0, NULL, HFILL }},
+          { "bConfigurationValue", "usb.bConfigurationValue", FT_UINT8, BASE_DEC,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_iConfiguration,
-        { "iConfiguration", "usb.iConfiguration", FT_UINT8, BASE_DEC,
-          NULL, 0x0, NULL, HFILL }},
+          { "iConfiguration", "usb.iConfiguration", FT_UINT8, BASE_DEC,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_bMaxPower,
-        { "bMaxPower", "usb.bMaxPower", FT_UINT8, BASE_DEC,
-          NULL, 0x0, NULL, HFILL }},
+          { "bMaxPower", "usb.bMaxPower", FT_UINT8, BASE_DEC,
+            NULL, 0x0, NULL, HFILL }},
 
         { &hf_usb_configuration_legacy10buspowered,
-        { "Must be 1", "usb.configuration.legacy10buspowered", FT_BOOLEAN, 8,
-          TFS(&tfs_mustbeone), 0x80, "Legacy USB 1.0 bus powered", HFILL }},
+          { "Must be 1", "usb.configuration.legacy10buspowered", FT_BOOLEAN, 8,
+            TFS(&tfs_mustbeone), 0x80, "Legacy USB 1.0 bus powered", HFILL }},
 
         { &hf_usb_configuration_selfpowered,
-        { "Self-Powered", "usb.configuration.selfpowered", FT_BOOLEAN, 8,
-          TFS(&tfs_selfpowered), 0x40, NULL, HFILL }},
+          { "Self-Powered", "usb.configuration.selfpowered", FT_BOOLEAN, 8,
+            TFS(&tfs_selfpowered), 0x40, NULL, HFILL }},
 
         { &hf_usb_configuration_remotewakeup,
-        { "Remote Wakeup", "usb.configuration.remotewakeup", FT_BOOLEAN, 8,
-          TFS(&tfs_remotewakeup), 0x20, NULL, HFILL }},
+          { "Remote Wakeup", "usb.configuration.remotewakeup", FT_BOOLEAN, 8,
+            TFS(&tfs_remotewakeup), 0x20, NULL, HFILL }},
 
         { &hf_usb_bEndpointAddress_number,
-        { "Endpoint Number", "usb.bEndpointAddress.number", FT_UINT8, BASE_HEX,
-          NULL, 0x0f, NULL, HFILL }},
+          { "Endpoint Number", "usb.bEndpointAddress.number", FT_UINT8, BASE_HEX,
+            NULL, 0x0f, NULL, HFILL }},
 
         { &hf_usb_bEndpointAddress_direction,
-        { "Direction", "usb.bEndpointAddress.direction", FT_BOOLEAN, 8,
-          TFS(&tfs_endpoint_direction), 0x80, NULL, HFILL }},
+          { "Direction", "usb.bEndpointAddress.direction", FT_BOOLEAN, 8,
+            TFS(&tfs_endpoint_direction), 0x80, NULL, HFILL }},
 
         { &hf_usb_request_in,
-        { "Request in", "usb.request_in", FT_FRAMENUM, BASE_NONE,
-          NULL, 0, "The request to this packet is in this packet", HFILL }},
+          { "Request in", "usb.request_in", FT_FRAMENUM, BASE_NONE,
+            NULL, 0, "The request to this packet is in this packet", HFILL }},
 
         { &hf_usb_time,
-        { "Time from request", "usb.time", FT_RELATIVE_TIME, BASE_NONE,
-          NULL, 0, "Time between Request and Response for USB cmds", HFILL }},
+          { "Time from request", "usb.time", FT_RELATIVE_TIME, BASE_NONE,
+            NULL, 0, "Time between Request and Response for USB cmds", HFILL }},
 
         { &hf_usb_response_in,
-        { "Response in", "usb.response_in", FT_FRAMENUM, BASE_NONE,
-          NULL, 0, "The response to this packet is in this packet", HFILL }},
+          { "Response in", "usb.response_in", FT_FRAMENUM, BASE_NONE,
+            NULL, 0, "The response to this packet is in this packet", HFILL }},
     };
 
     static gint *usb_subtrees[] = {
         &usb_hdr,
         &usb_setup_hdr,
+        &usb_isodesc,
+        &ett_usb_endpoint,
         &ett_usb_setup_bmrequesttype,
         &ett_descriptor_device,
         &ett_configuration_bmAttributes,
@@ -2533,12 +2755,21 @@ proto_register_usb(void)
     proto_usb = proto_register_protocol("USB", "USB", "usb");
     proto_register_field_array(proto_usb, hf, array_length(hf));
     proto_register_subtree_array(usb_subtrees, array_length(usb_subtrees));
+    register_dissector("usb", dissect_linux_usb, proto_usb);
 
     usb_bulk_dissector_table = register_dissector_table("usb.bulk",
         "USB bulk endpoint", FT_UINT8, BASE_DEC);
-
+    register_heur_dissector_list("usb.bulk", &heur_bulk_subdissector_list);
     usb_control_dissector_table = register_dissector_table("usb.control",
         "USB control endpoint", FT_UINT8, BASE_DEC);
+    register_heur_dissector_list("usb.control", &heur_control_subdissector_list);
+
+    usb_module = prefs_register_protocol(proto_usb, NULL);
+    prefs_register_bool_preference(usb_module, "try_heuristics",
+        "Try heuristic sub-dissectors",
+        "Try to decode a packet using a heuristic sub-dissector before "
+        "attempting to dissect the packet using the \"usb.bulk\" or "
+        "\"usb.control\" dissector tables.", &try_heuristics);
 
     usb_tap=register_tap("usb");
 }
@@ -2552,6 +2783,6 @@ proto_reg_handoff_usb(void)
     linux_usb_mmapped_handle = create_dissector_handle(dissect_linux_usb_mmapped,
                                                        proto_usb);
 
-    dissector_add("wtap_encap", WTAP_ENCAP_USB_LINUX, linux_usb_handle);
-    dissector_add("wtap_encap", WTAP_ENCAP_USB_LINUX_MMAPPED, linux_usb_mmapped_handle);
+    dissector_add_uint("wtap_encap", WTAP_ENCAP_USB_LINUX, linux_usb_handle);
+    dissector_add_uint("wtap_encap", WTAP_ENCAP_USB_LINUX_MMAPPED, linux_usb_mmapped_handle);
 }