From e718dc79ea8b7a6e619f53031dc0191f7549cdf9 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Tue, 26 May 2009 00:32:16 +0000 Subject: From Roberto Mariani via bug 3324: - Removed heuristic for find if is_request and used event_type - URB_INTERRUPT don't goes in reverse direction... fixed svn path=/trunk/; revision=28477 --- AUTHORS | 1 + epan/dissectors/packet-usb.c | 58 ++++++-------------------------------------- 2 files changed, 8 insertions(+), 51 deletions(-) diff --git a/AUTHORS b/AUTHORS index d72703948f..bb0e6e493b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -3023,6 +3023,7 @@ Jakub Zawadzki Andreas Heise Alex Lindberg Rama Chitta +Roberto Mariani Alain Magloire was kind enough to give his permission to use his version of snprintf.c. diff --git a/epan/dissectors/packet-usb.c b/epan/dissectors/packet-usb.c index d6e94210ec..c44bc3c101 100644 --- a/epan/dissectors/packet-usb.c +++ b/epan/dissectors/packet-usb.c @@ -1672,60 +1672,16 @@ dissect_linux_usb_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent, dissect_linux_usb_pseudo_header(tvb, pinfo, tree); type = pinfo->pseudo_header->linux_usb.transfer_type; -#if 0 - /* The direction flag is broken so we must strip it off */ - endpoint=pinfo->pseudo_header->linux_usb.endpoint_number; -#else - endpoint=pinfo->pseudo_header->linux_usb.endpoint_number&(~URB_TRANSFER_IN); -#endif - tmp_addr=pinfo->pseudo_header->linux_usb.device_address; + + endpoint = pinfo->pseudo_header->linux_usb.endpoint_number & (~URB_TRANSFER_IN); + + tmp_addr = pinfo->pseudo_header->linux_usb.device_address; setup_flag = pinfo->pseudo_header->linux_usb.setup_flag; -#if 0 - /* this is how it is supposed to work but this flag seems to be broken -- ronnie */ - is_request = endpoint & URB_TRANSFER_IN; -#else - /* Determine whether this is a request or a response */ - switch(type){ - case URB_BULK: - case URB_CONTROL: - case URB_ISOCHRONOUS: - switch(pinfo->pseudo_header->linux_usb.event_type){ - case URB_SUBMIT: - is_request=TRUE; - break; - case URB_COMPLETE: - case URB_ERROR: - is_request=FALSE; - break; - default: - DISSECTOR_ASSERT_NOT_REACHED(); - } - break; - case URB_INTERRUPT: - switch(pinfo->pseudo_header->linux_usb.event_type){ - case URB_SUBMIT: - is_request=FALSE; - break; - case URB_COMPLETE: - case URB_ERROR: - is_request=TRUE; - break; - default: - DISSECTOR_ASSERT_NOT_REACHED(); - } - break; - default: - DISSECTOR_ASSERT_NOT_REACHED(); - } -#endif + is_request = (pinfo->pseudo_header->linux_usb.event_type == URB_SUBMIT) ? TRUE : FALSE; - /* Set up addresses and ports. - * Note that URB_INTERRUPT goes in the reverse direction and thus - * the request comes from the device and not the host. - */ - if ( (is_request&&(type!=URB_INTERRUPT)) - || (!is_request&&(type==URB_INTERRUPT)) ){ + /* Set up addresses and ports. */ + if (is_request) { src_addr.device = src_device = 0xffffffff; src_addr.endpoint = src_endpoint = NO_ENDPOINT; dst_addr.device = dst_device = htolel(tmp_addr); -- cgit v1.2.3