}
/* Common fields */
- dissect_usb_descriptor_header(tree, tvb, offset);
+ dissect_usb_descriptor_header(tree, tvb, offset, NULL);
subtype_item = proto_tree_add_item(tree, hf_usb_vid_control_ifdesc_subtype, tvb, offset+2, 1, ENC_NA);
offset += 3;
tree = proto_item_add_subtree(item, ett_descriptor_video_streaming);
}
- dissect_usb_descriptor_header(tree, tvb, offset);
+ dissect_usb_descriptor_header(tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_usb_vid_streaming_ifdesc_subtype, tvb, offset+2, 1, ENC_NA);
offset += 3;
tree = proto_item_add_subtree(item, ett_descriptor_video_endpoint);
}
- dissect_usb_descriptor_header(tree, tvb, offset);
+ dissect_usb_descriptor_header(tree, tvb, offset, NULL);
proto_tree_add_item(tree, hf_usb_vid_epdesc_subtype, tvb, offset+2, 1, ENC_NA);
offset += 3;
*/
void dissect_usb_descriptor_header(proto_tree *tree,
- tvbuff_t *tvb, int offset)
+ tvbuff_t *tvb, int offset,
+ value_string_ext *type_val_str)
{
- /* bLength */
- proto_tree_add_item(tree,
- hf_usb_bLength,
- tvb, offset, 1, ENC_LITTLE_ENDIAN);
-
- /* bDescriptorType */
- proto_tree_add_item(tree, hf_usb_bDescriptorType, tvb, offset+1, 1, ENC_LITTLE_ENDIAN);
+ guint8 desc_type;
+ proto_item *type_item = NULL;
+
+
+ proto_tree_add_item(tree, hf_usb_bLength,
+ tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset++;
+
+ desc_type = tvb_get_guint8(tvb, offset);
+ type_item = proto_tree_add_item(tree, hf_usb_bDescriptorType,
+ tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ /* if the caller provided no class specific value string, we're
+ * using the standard descriptor types */
+ if (!type_val_str)
+ type_val_str = &std_descriptor_type_vals_ext;
+ proto_item_append_text(type_item, " (%s)",
+ val_to_str_ext(desc_type, type_val_str, "unknown"));
}
/* 9.6.2 */
tree = proto_item_add_subtree(item, ett_descriptor_device);
}
- dissect_usb_descriptor_header(tree, tvb, offset);
+ dissect_usb_descriptor_header(tree, tvb, offset, NULL);
offset += 2;
/* bcdUSB */
usb_conv_info=(usb_conv_info_t *)pinfo->usb_conv_info;
- dissect_usb_descriptor_header(tree, tvb, offset);
+ dissect_usb_descriptor_header(tree, tvb, offset, NULL);
offset += 2;
/* bcdUSB */
proto_tree_add_item(tree, hf_usb_bDescriptorType, tvb, offset+1, 1, ENC_LITTLE_ENDIAN);
}
else
- dissect_usb_descriptor_header(tree, tvb, offset);
+ dissect_usb_descriptor_header(tree, tvb, offset, NULL);
offset += 2;
}
len = tvb_get_guint8(tvb, offset);
- dissect_usb_descriptor_header(tree, tvb, offset);
+ dissect_usb_descriptor_header(tree, tvb, offset, NULL);
offset += 2;
/* bInterfaceNumber */
}
len = tvb_get_guint8(tvb, offset);
- dissect_usb_descriptor_header(tree, tvb, offset);
+ dissect_usb_descriptor_header(tree, tvb, offset, NULL);
offset += 2;
endpoint = tvb_get_guint8(tvb, offset)&0x0f;
tree = proto_item_add_subtree(item, ett_descriptor_device);
}
- dissect_usb_descriptor_header(tree, tvb, offset);
+ dissect_usb_descriptor_header(tree, tvb, offset, NULL);
offset += 2;
/* bFirstInterface */
}
bLength = tvb_get_guint8(tvb, offset);
- dissect_usb_descriptor_header(tree, tvb, offset);
+ dissect_usb_descriptor_header(tree, tvb, offset, NULL);
offset += bLength;
if (item) {
tree = proto_item_add_subtree(item, ett_descriptor_device);
}
- dissect_usb_descriptor_header(tree, tvb, offset);
+ dissect_usb_descriptor_header(tree, tvb, offset, NULL);
offset += 2;
/* wTotalLength */