aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-usb-dfu.c
diff options
context:
space:
mode:
authorTomasz Moń <desowin@gmail.com>2022-12-06 10:35:09 +0100
committerTomasz Moń <desowin@gmail.com>2022-12-06 16:36:18 +0100
commitbad5ae8c427652b9497b233c012ef219a6ab2c6d (patch)
treedc9729cb445197154f28070479c21d474f366208 /epan/dissectors/packet-usb-dfu.c
parent74b1c07f913fcedcf9c28795b93ac53ee654fb29 (diff)
USB: Allow registering protocol specific dissectors
Formerly only the class specific dissectors could be registered for bulk, control and interrupt endpoints. While this is sufficient for major classes, there are some classes that only use one or two of possible class/subclass/protocol triple values. Allow registering specific triples so appropriate dissector can be automatically selected based on CONFIGURATION DESCRIPTOR data. Register DFU Run-Time and DFU Mode triples so user no longer needs to manually set Decode As for USB DFU.
Diffstat (limited to 'epan/dissectors/packet-usb-dfu.c')
-rw-r--r--epan/dissectors/packet-usb-dfu.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/epan/dissectors/packet-usb-dfu.c b/epan/dissectors/packet-usb-dfu.c
index 9497ae3900..f437c7dd8c 100644
--- a/epan/dissectors/packet-usb-dfu.c
+++ b/epan/dissectors/packet-usb-dfu.c
@@ -551,6 +551,9 @@ proto_register_usb_dfu(void)
"Version of protocol supported by this dissector.");
}
+#define RUNTIME_KEY USB_PROTOCOL_KEY(IF_CLASS_APPLICATION_SPECIFIC, IF_SUBCLASS_APP_DFU, IF_PROTOCOL_DFU_RUNTIME)
+#define DFU_MODE_KEY USB_PROTOCOL_KEY(IF_CLASS_APPLICATION_SPECIFIC, IF_SUBCLASS_APP_DFU, IF_PROTOCOL_DFU_MODE)
+
void
proto_reg_handoff_usb_dfu(void)
{
@@ -559,6 +562,9 @@ proto_reg_handoff_usb_dfu(void)
usf_dfu_descriptor_handle = create_dissector_handle(dissect_usb_dfu_descriptor, proto_usb_dfu);
dissector_add_uint("usb.descriptor", IF_CLASS_APPLICATION_SPECIFIC, usf_dfu_descriptor_handle);
+ dissector_add_uint("usb.control", RUNTIME_KEY, usb_dfu_handle);
+ dissector_add_uint("usb.control", DFU_MODE_KEY, usb_dfu_handle);
+
dissector_add_uint("usb.product", (0x1d50 << 16) | 0x1db5, usb_dfu_handle); /* IDBG in DFU mode */
dissector_add_uint("usb.product", (0x1d50 << 16) | 0x6001, usb_dfu_handle); /* Ubertooth Zero DFU */
dissector_add_uint("usb.product", (0x1d50 << 16) | 0x6003, usb_dfu_handle); /* Ubertooth One DFU */