From 51da06793c33ff30b45154ccfc6e28d6d0d35db6 Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Wed, 9 Feb 2011 12:09:43 +0200 Subject: [PATCH] server/smartcard: don't push our own error on reader add The device already sends one. There are actually two connections going on: server to client - this is the smartcard channel, it reuses the VSC protocol. server to device - this is an internal connection using VSC too. We generally just passthrough all messages from the client to the device, and from the device to the client. We only rewrite the reader_id because the device knows about a single id (it is actually a card id), and we may manage more then one in the future. Bottom line is that there was an extra VSC_Error message reaching the client. --- server/smartcard.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/smartcard.c b/server/smartcard.c index 9fbeead9..a93e59d7 100644 --- a/server/smartcard.c +++ b/server/smartcard.c @@ -393,12 +393,12 @@ static void smartcard_add_reader(SmartCardChannel *smartcard_channel, uint8_t *n // TODO - save name somewhere SpiceCharDeviceInstance *char_device = smartcard_readers_get_unattached(); - SmartCardDeviceState *state; if (char_device != NULL) { - state = SPICE_CONTAINEROF(char_device->st, SmartCardDeviceState, base); smartcard_char_device_attach(char_device, smartcard_channel); - smartcard_push_error(smartcard_channel, state->reader_id, VSC_SUCCESS); + // The device sends a VSC_Error message, we will let it through, no + // need to send our own. We already set the correct reader_id, from + // our SmartCardDeviceState. } else { smartcard_push_error(smartcard_channel, VSCARD_UNDEFINED_READER_ID, VSC_CANNOT_ADD_MORE_READERS);