Change in simtrace2[master]: contrib: more cardem dissection

laforge gerrit-no-reply at lists.osmocom.org
Mon Aug 2 09:23:20 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/simtrace2/+/25086 )

Change subject: contrib: more cardem dissection
......................................................................

contrib: more cardem dissection

Change-Id: Ia74d3674f854b390c9745a1cb8d5756bd5d39540
---
M contrib/simtrace.lua
1 file changed, 27 insertions(+), 2 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/contrib/simtrace.lua b/contrib/simtrace.lua
index 8298265..5a273d2 100644
--- a/contrib/simtrace.lua
+++ b/contrib/simtrace.lua
@@ -36,9 +36,29 @@
 local payloadlen  = ProtoField.uint16("usb_simtrace.length", "length", base.HEX_DEC)
 local payload  = ProtoField.bytes("usb_simtrace.payload", "Data")
 
+local pb_and_rx  = ProtoField.uint32("usb_simtrace.pb_and_rx", "pb_and_rx", base.HEX_DEC, NULL, 0x8)
+local pb_and_tx  = ProtoField.uint32("usb_simtrace.pb_and_tx", "pb_and_tx", base.HEX_DEC, NULL, 0x4)
+local final  = ProtoField.uint32("usb_simtrace.final", "final", base.HEX_DEC, NULL, 0x2)
+local tpdu_hdr  = ProtoField.uint32("usb_simtrace.tpdu_hdr", "tpdu_hdr", base.HEX_DEC, NULL, 0x1)
+local rxtxdatalen  = ProtoField.uint16("usb_simtrace.rxtxdatalen", "rx/tx data length", base.HEX_DEC)
+local rxtxdata  = ProtoField.bytes("usb_simtrace.rxtxdata", "rx/tx (data)")
 usb_simtrace_protocol.fields = {
-  msgtype, seqnr, slotnr, reserved, payloadlen, payload
+  msgtype, seqnr, slotnr, reserved, payloadlen, payload, pb_and_rx, pb_and_tx, final, tpdu_hdr, rxtxdatalen, rxtxdata
 }
+function dissect_rxtx(payload_data,pinfo,tree)
+
+  local headerSubtree = tree:add(usb_simtrace_protocol, payload_data, "rx/tx data")
+  local len  = payload_data(8+4,2):le_uint();
+  local cmd32 =  payload_data(8+0,4):le_uint();
+
+  headerSubtree:add(pb_and_rx, cmd32)
+  headerSubtree:add(pb_and_tx, cmd32)
+  headerSubtree:add(final, cmd32)
+  headerSubtree:add(tpdu_hdr, cmd32)
+
+  headerSubtree:add(rxtxdatalen, len)
+  headerSubtree:add_le(rxtxdata, payload_data(8+6,len))
+end
 
 function usb_simtrace_protocol.dissector(buffer, pinfo, tree)
   length = buffer:len()
@@ -54,7 +74,12 @@
   subtree:add(slotnr, buffer(3,1))
   subtree:add_le(payloadlen, buffer(6,2))
   pinfo.cols.info = string.format("Cmd 0x%04X : %s", command, control_commands[command])
-  subtree:add(payload, buffer(8,length-8))
+  local payload_data = buffer(8,length-8)
+  if(command == 0x0101 or command == 0x0106) then
+    return dissect_rxtx(buffer(),pinfo,subtree)
+  else
+    subtree:add(payload, payload_data)
+  end
 
 end
 

-- 
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/25086
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: Ia74d3674f854b390c9745a1cb8d5756bd5d39540
Gerrit-Change-Number: 25086
Gerrit-PatchSet: 8
Gerrit-Owner: Hoernchen <ewild at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210802/3ac0b82d/attachment.htm>


More information about the gerrit-log mailing list