aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-usb-ccid.c
diff options
context:
space:
mode:
authorEric Wild <ewild@sysmocom.de>2020-07-09 15:10:39 +0200
committerAnders Broman <a.broman58@gmail.com>2020-07-14 04:01:42 +0000
commit73f24f5ad8dcd207c3ebcbd848ba2303d1a6f977 (patch)
treecd9ee1104ac71f511e69e720811cfb6cc07aecd6 /epan/dissectors/packet-usb-ccid.c
parent4fc9098830e034188d027c9bd32c28ef1acf30da (diff)
ccid: dissect interrupt notifications for 8 slots
This was previously limited to one byte (=4 slots), and afaik no readers existed that supported more slots until now - now there is the sysmocom octsim that as the name implies offers 8 slots. Change-Id: I5eccc7b6fb0d3c12ef7d7379d3ee88b5e7c45b71 Reviewed-on: https://code.wireshark.org/review/37816 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-usb-ccid.c')
-rw-r--r--epan/dissectors/packet-usb-ccid.c55
1 files changed, 53 insertions, 2 deletions
diff --git a/epan/dissectors/packet-usb-ccid.c b/epan/dissectors/packet-usb-ccid.c
index b977f49ffc..9c62e44b42 100644
--- a/epan/dissectors/packet-usb-ccid.c
+++ b/epan/dissectors/packet-usb-ccid.c
@@ -93,6 +93,14 @@ static int hf_ccid_bmSlotICCState_slot2Current = -1;
static int hf_ccid_bmSlotICCState_slot2Changed = -1;
static int hf_ccid_bmSlotICCState_slot3Current = -1;
static int hf_ccid_bmSlotICCState_slot3Changed = -1;
+static int hf_ccid_bmSlotICCState_slot4Current = -1;
+static int hf_ccid_bmSlotICCState_slot4Changed = -1;
+static int hf_ccid_bmSlotICCState_slot5Current = -1;
+static int hf_ccid_bmSlotICCState_slot5Changed = -1;
+static int hf_ccid_bmSlotICCState_slot6Current = -1;
+static int hf_ccid_bmSlotICCState_slot6Changed = -1;
+static int hf_ccid_bmSlotICCState_slot7Current = -1;
+static int hf_ccid_bmSlotICCState_slot7Changed = -1;
static int hf_ccid_bHardwareErrorCode = -1;
static dissector_handle_t usb_ccid_handle;
@@ -135,7 +143,7 @@ static int * const bPINSupport_fields[] = {
NULL
};
-static int * const bmSlotICCState_fields[] = {
+static int * const bmSlotICCStateb0_fields[] = {
&hf_ccid_bmSlotICCState_slot0Current,
&hf_ccid_bmSlotICCState_slot0Changed,
&hf_ccid_bmSlotICCState_slot1Current,
@@ -147,6 +155,18 @@ static int * const bmSlotICCState_fields[] = {
NULL
};
+static int * const bmSlotICCStateb1_fields[] = {
+ &hf_ccid_bmSlotICCState_slot4Current,
+ &hf_ccid_bmSlotICCState_slot4Changed,
+ &hf_ccid_bmSlotICCState_slot5Current,
+ &hf_ccid_bmSlotICCState_slot5Changed,
+ &hf_ccid_bmSlotICCState_slot6Current,
+ &hf_ccid_bmSlotICCState_slot6Changed,
+ &hf_ccid_bmSlotICCState_slot7Current,
+ &hf_ccid_bmSlotICCState_slot7Changed,
+ NULL
+};
+
static int * const bStatus_fields[] = {
&hf_ccid_bStatus_bmIccStatus,
&hf_ccid_bStatus_bmCommandStatus,
@@ -452,6 +472,7 @@ dissect_ccid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
guint32 payload_len;
tvbuff_t *next_tvb;
usb_conv_info_t *usb_conv_info;
+ int len_remaining;
/* Reject the packet if data is NULL */
if (data == NULL)
@@ -595,7 +616,13 @@ dissect_ccid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
/*Interupt IN*/
case RDR_PC_NOTIF_SLOT_CHNG:
proto_tree_add_bitmask(ccid_tree, tvb, 1,
- hf_ccid_bmSlotICCState, ett_ccid_slot_change, bmSlotICCState_fields,
+ hf_ccid_bmSlotICCState, ett_ccid_slot_change, bmSlotICCStateb0_fields,
+ ENC_LITTLE_ENDIAN);
+ len_remaining = tvb_reported_length_remaining (tvb, 2);
+ if (len_remaining <= 0)
+ break;
+ proto_tree_add_bitmask(ccid_tree, tvb, 2,
+ hf_ccid_bmSlotICCState, ett_ccid_slot_change, bmSlotICCStateb1_fields,
ENC_LITTLE_ENDIAN);
break;
@@ -839,6 +866,30 @@ proto_register_ccid(void)
{ &hf_ccid_bmSlotICCState_slot3Changed,
{ "Slot 3 Status changed", "usbccid.hf_ccid_bmSlotICCState.slot3Changed",
FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80, NULL, HFILL } },
+ { &hf_ccid_bmSlotICCState_slot4Current,
+ { "Slot 4 Current Status", "usbccid.hf_ccid_bmSlotICCState.slot4Current",
+ FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x01, NULL, HFILL } },
+ { &hf_ccid_bmSlotICCState_slot4Changed,
+ { "Slot 4 Status changed", "usbccid.hf_ccid_bmSlotICCState.slot4Changed",
+ FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x02, NULL, HFILL } },
+ { &hf_ccid_bmSlotICCState_slot5Current,
+ { "Slot 5 Current Status", "usbccid.hf_ccid_bmSlotICCState.slot5Current",
+ FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x04, NULL, HFILL } },
+ { &hf_ccid_bmSlotICCState_slot5Changed,
+ { "Slot 5 Status changed", "usbccid.hf_ccid_bmSlotICCState.slot5Changed",
+ FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x08, NULL, HFILL } },
+ { &hf_ccid_bmSlotICCState_slot6Current,
+ { "Slot 6 Current Status", "usbccid.hf_ccid_bmSlotICCState.slot6Current",
+ FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x10, NULL, HFILL } },
+ { &hf_ccid_bmSlotICCState_slot6Changed,
+ { "Slot 6 Status changed", "usbccid.hf_ccid_bmSlotICCState.slot6Changed",
+ FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20, NULL, HFILL } },
+ { &hf_ccid_bmSlotICCState_slot7Current,
+ { "Slot 7 Current Status", "usbccid.hf_ccid_bmSlotICCState.slot7Current",
+ FT_BOOLEAN, 8, TFS(&tfs_present_not_present), 0x40, NULL, HFILL } },
+ { &hf_ccid_bmSlotICCState_slot7Changed,
+ { "Slot 7 Status changed", "usbccid.hf_ccid_bmSlotICCState.slot7Changed",
+ FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80, NULL, HFILL } },
{ &hf_ccid_bHardwareErrorCode,
{ "Hardware Error Code", "usbccid.hf_ccid_bHardwareErrorCode",
FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },