summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2010-10-27 14:44:04 +0200
committerAlon Levy <alevy@redhat.com>2010-10-27 14:44:04 +0200
commit8c2f7ae5e0c361dda509370b48e942e5991c813f (patch)
tree0fc32f91196a732dbce17984b8a68ae9addd9a8a
parent5807a369b29de012fd5b674fe022a263b7c1642b (diff)
usb-ccid: add ccid_header_message_type_string for debug
-rw-r--r--hw/usb-ccid.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/hw/usb-ccid.c b/hw/usb-ccid.c
index 0a055e7f1..333417301 100644
--- a/hw/usb-ccid.c
+++ b/hw/usb-ccid.c
@@ -953,6 +953,41 @@ static void ccid_on_apdu_from_guest(USBCCIDState *s, CCID_XferBlock *recv)
}
}
+static const char* ccid_header_message_type_string(uint8_t mtype)
+{
+ switch (mtype) {
+ case CCID_MESSAGE_TYPE_PC_to_RDR_IccPowerOn:
+ return "PC_to_RDR_IccPowerOn";
+ case CCID_MESSAGE_TYPE_PC_to_RDR_IccPowerOff:
+ return "PC_to_RDR_IccPowerOff";
+ case CCID_MESSAGE_TYPE_PC_to_RDR_GetSlotStatus:
+ return "PC_to_RDR_GetSlotStatus";
+ case CCID_MESSAGE_TYPE_PC_to_RDR_XfrBlock:
+ return "PC_to_RDR_XfrBlock";
+ case CCID_MESSAGE_TYPE_PC_to_RDR_GetParameters:
+ return "PC_to_RDR_GetParameters";
+ case CCID_MESSAGE_TYPE_PC_to_RDR_ResetParameters:
+ return "PC_to_RDR_ResetParameters";
+ case CCID_MESSAGE_TYPE_PC_to_RDR_SetParameters:
+ return "PC_to_RDR_SetParameters";
+ case CCID_MESSAGE_TYPE_PC_to_RDR_Escape:
+ return "PC_to_RDR_Escape";
+ case CCID_MESSAGE_TYPE_PC_to_RDR_IccClock:
+ return "PC_to_RDR_IccClock";
+ case CCID_MESSAGE_TYPE_PC_to_RDR_T0APDU:
+ return "PC_to_RDR_T0APDU";
+ case CCID_MESSAGE_TYPE_PC_to_RDR_Secure:
+ return "PC_to_RDR_Secure";
+ case CCID_MESSAGE_TYPE_PC_to_RDR_Mechanical:
+ return "PC_to_RDR_Mechanical";
+ case CCID_MESSAGE_TYPE_PC_to_RDR_Abort:
+ return "PC_to_RDR_Abort";
+ case CCID_MESSAGE_TYPE_PC_to_RDR_SetDataRateAndClockFrequency:
+ return "PC_to_RDR_SetDataRateAndClockFrequency";
+ };
+ return "";
+}
+
static void ccid_handle_bulk_out(USBCCIDState *s, USBPacket *p)
{
CCID_Header* ccid_header;
@@ -969,7 +1004,8 @@ static void ccid_handle_bulk_out(USBCCIDState *s, USBPacket *p)
if (s->bulk_out_pos < 10) {
DPRINTF(s, 1, "%s: bad USB_TOKEN_OUT length, should be at least 10 bytes\n", __func__);
} else {
- DPRINTF(s, 3, "%s %x\n", __func__, ccid_header->bMessageType);
+ DPRINTF(s, 3, "%s %x - %s\n", __func__, ccid_header->bMessageType,
+ ccid_header_message_type_string(ccid_header->bMessageType));
switch (ccid_header->bMessageType) {
case CCID_MESSAGE_TYPE_PC_to_RDR_GetSlotStatus:
ccid_write_slot_status(s, ccid_header);
@@ -985,7 +1021,6 @@ static void ccid_handle_bulk_out(USBCCIDState *s, USBPacket *p)
ccid_write_data_block_atr(s, ccid_header);
break;
case CCID_MESSAGE_TYPE_PC_to_RDR_IccPowerOff:
- DPRINTF(s, 1, "PowerOff\n");
ccid_reset_error_status(s);
s->powered = false;
ccid_write_slot_status(s, ccid_header);