From eadeb98559ee1f4b896e016c598478fb0aebebcd Mon Sep 17 00:00:00 2001 From: s-ol Date: Sun, 18 Feb 2024 20:17:25 +0100 Subject: clean up and add README --- pl2303.lua | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100755 pl2303.lua (limited to 'pl2303.lua') diff --git a/pl2303.lua b/pl2303.lua deleted file mode 100755 index 6615166..0000000 --- a/pl2303.lua +++ /dev/null @@ -1,41 +0,0 @@ -local proto = Proto("pl2303.bulk", "PL2303 Serial Data") - -local ep_dir_f = Field.new("usb.endpoint_address.direction") - -proto.fields.data_in_F = ProtoField.bytes("pl2303.bulk.data_in", "Data In") -proto.fields.data_out_F = ProtoField.bytes("pl2303.bulk.data_out", "Data Out") - -local serial_tbl = DissectorTable.heuristic_new("pl2303.serial_data", proto) - -function proto.dissector(buffer, pinfo, tree) - if buffer:captured_len() < 1 then return end - - local sub = tree:add(proto, buffer()) - pinfo.cols.info:set("PL2303 Serial") - - local ep_dir = ep_dir_f()() -- 0: h2d, 1: d2h - if ep_dir == 0 then - pinfo.cols.info:append(" out") - pinfo.p2p_dir = P2P_DIR_SENT - sub:add(proto.fields.data_out, buffer()) - else - pinfo.cols.info:append(" in") - pinfo.p2p_dir = P2P_DIR_RECV - sub:add(proto.fields.data_in, buffer()) - end - - DissectorTable.try_heuristics("pl2303.serial_data", buffer, pinfo, tree) -end - -function usb_protocol_key(class, subclass, protocol) - return bit.bor( - bit.lshift(1, 31), - bit.lshift(bit.band(class, 0xff), 16), - bit.lshift(bit.band(subclass, 0xff), 8), - bit.band(protocol, 0xff) - ) -end - -local bulk_table = DissectorTable.get("usb.bulk") -bulk_table:add(usb_protocol_key(0xff, 0x00, 0x00), proto) -bulk_table:add(0xffff, proto) -- cgit v1.2.3