diff options
author | Victor Dodon <dodonvictor@gmail.com> | 2016-03-02 00:46:21 -0800 |
---|---|---|
committer | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2016-03-05 18:50:31 +0000 |
commit | e86dd03d3a91b72b7cc0a9eb4a8657839a9505af (patch) | |
tree | ab5014eddaa4fb94ce1ff29a79c894616d9582a9 /epan | |
parent | be25474c941661079a0ed795426b21716d3a7d43 (diff) |
usb: display correctly index/interface/endpoint in urb setup
In URB setup, wInterface is always displayed disregarding the actual
bmRequestType. Show instead: wInterface if recipient is an interface,
WEndpoint if recipient is an endpoint and wIndex when recipient is device
or other.
Change-Id: I6883dc22d80267276f9d171f39695e86e93aae83
Reviewed-on: https://code.wireshark.org/review/14283
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-usb.c | 68 |
1 files changed, 52 insertions, 16 deletions
diff --git a/epan/dissectors/packet-usb.c b/epan/dissectors/packet-usb.c index 1e092a9b13..46353802c2 100644 --- a/epan/dissectors/packet-usb.c +++ b/epan/dissectors/packet-usb.c @@ -145,6 +145,7 @@ static int hf_usb_device_wFeatureSelector = -1; static int hf_usb_interface_wFeatureSelector = -1; static int hf_usb_endpoint_wFeatureSelector = -1; static int hf_usb_wInterface = -1; +static int hf_usb_wEndpoint = -1; static int hf_usb_wStatus = -1; static int hf_usb_wFrameNumber = -1; @@ -1509,36 +1510,41 @@ dissect_usb_setup_clear_feature_request(packet_info *pinfo _U_, proto_tree *tree if (usb_conv_info) { recip = USB_RECIPIENT(usb_conv_info->usb_trans_info->setup.requesttype); - /* feature selector */ + /* feature selector, zero/interface/endpoint */ switch (recip) { case RQT_SETUP_RECIPIENT_DEVICE: proto_tree_add_item(tree, hf_usb_device_wFeatureSelector, tvb, offset, 2, ENC_LITTLE_ENDIAN); + offset += 2; + proto_tree_add_item(tree, hf_usb_index, tvb, offset, 2, ENC_LITTLE_ENDIAN); break; case RQT_SETUP_RECIPIENT_INTERFACE: proto_tree_add_item(tree, hf_usb_interface_wFeatureSelector, tvb, offset, 2, ENC_LITTLE_ENDIAN); + offset += 2; + proto_tree_add_item(tree, hf_usb_wInterface, tvb, offset, 2, ENC_LITTLE_ENDIAN); break; case RQT_SETUP_RECIPIENT_ENDPOINT: proto_tree_add_item(tree, hf_usb_endpoint_wFeatureSelector, tvb, offset, 2, ENC_LITTLE_ENDIAN); + offset += 2; + proto_tree_add_item(tree, hf_usb_wEndpoint, tvb, offset, 2, ENC_LITTLE_ENDIAN); break; case RQT_SETUP_RECIPIENT_OTHER: default: 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); break; } } else { /* No conversation information, so recipient type is unknown */ 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; - /* zero/interface/endpoint */ - /* XXX - check based on request type */ - 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, ENC_LITTLE_ENDIAN); offset += 2; @@ -2482,8 +2488,29 @@ dissect_usb_setup_get_status_request(packet_info *pinfo _U_, proto_tree *tree, offset += 2; /* zero/interface/endpoint */ - /* XXX - check based on request type */ - proto_tree_add_item(tree, hf_usb_wInterface, tvb, offset, 2, ENC_LITTLE_ENDIAN); + if (usb_conv_info) { + guint8 recip; + + recip = USB_RECIPIENT(usb_conv_info->usb_trans_info->setup.requesttype); + + switch (recip) { + case RQT_SETUP_RECIPIENT_INTERFACE: + proto_tree_add_item(tree, hf_usb_wInterface, tvb, offset, 2, ENC_LITTLE_ENDIAN); + break; + + case RQT_SETUP_RECIPIENT_ENDPOINT: + proto_tree_add_item(tree, hf_usb_wEndpoint, tvb, offset, 2, ENC_LITTLE_ENDIAN); + break; + + case RQT_SETUP_RECIPIENT_DEVICE: + case RQT_SETUP_RECIPIENT_OTHER: + default: + proto_tree_add_item(tree, hf_usb_index, tvb, offset, 2, ENC_LITTLE_ENDIAN); + break; + } + } else { + proto_tree_add_item(tree, hf_usb_index, tvb, offset, 2, ENC_LITTLE_ENDIAN); + } offset += 2; /* length */ @@ -2596,36 +2623,41 @@ dissect_usb_setup_set_feature_request(packet_info *pinfo _U_, proto_tree *tree, if (usb_conv_info) { recip = USB_RECIPIENT(usb_conv_info->usb_trans_info->setup.requesttype); - /* feature selector */ + /* feature selector, zero/interface/endpoint */ switch (recip) { case RQT_SETUP_RECIPIENT_DEVICE: proto_tree_add_item(tree, hf_usb_device_wFeatureSelector, tvb, offset, 2, ENC_LITTLE_ENDIAN); + offset += 2; + proto_tree_add_item(tree, hf_usb_index, tvb, offset, 2, ENC_LITTLE_ENDIAN); break; case RQT_SETUP_RECIPIENT_INTERFACE: proto_tree_add_item(tree, hf_usb_interface_wFeatureSelector, tvb, offset, 2, ENC_LITTLE_ENDIAN); + offset += 2; + proto_tree_add_item(tree, hf_usb_wInterface, tvb, offset, 2, ENC_LITTLE_ENDIAN); break; case RQT_SETUP_RECIPIENT_ENDPOINT: proto_tree_add_item(tree, hf_usb_endpoint_wFeatureSelector, tvb, offset, 2, ENC_LITTLE_ENDIAN); + offset += 2; + proto_tree_add_item(tree, hf_usb_wEndpoint, tvb, offset, 2, ENC_LITTLE_ENDIAN); break; case RQT_SETUP_RECIPIENT_OTHER: default: 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); break; } } else { /* No conversation information, so recipient type is unknown */ 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; - /* zero/interface/endpoint or test selector */ - /* XXX - check based on request type */ - 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, ENC_LITTLE_ENDIAN); offset += 2; @@ -2717,8 +2749,7 @@ dissect_usb_setup_synch_frame_request(packet_info *pinfo _U_, proto_tree *tree, offset += 2; /* endpoint */ - /* XXX */ - proto_tree_add_item(tree, hf_usb_wInterface, tvb, offset, 2, ENC_LITTLE_ENDIAN); + proto_tree_add_item(tree, hf_usb_wEndpoint, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; /* two */ @@ -4763,6 +4794,11 @@ proto_register_usb(void) FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_usb_wEndpoint, + { "wEndpoint", "usb.setup.wEndpoint", + FT_UINT16, BASE_DEC, NULL, 0x0, + NULL, HFILL }}, + { &hf_usb_wStatus, { "wStatus", "usb.setup.wStatus", FT_UINT16, BASE_HEX, NULL, 0x0, |