mirror of
https://github.com/qemu/qemu.git
synced 2024-11-28 22:33:36 +08:00
usb: two smartcard reader fixes.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJa/oWpAAoJEEy22O7T6HE43HYP/0nepcj2Y9Y63siwSYzWZdl3 mKXanJ151rkpFCjiO/zMinC10U771EotDYm5lrDL8g6ON5d7ZoynG5A5R+H+aNXz huT2wsVi6kLzT++7AhrUj/dYtUiXhpX+N9zWJ6kmw1VnnWK7zuPuPndf0AZ0jUpr g1zWGdC+YSLhqtFkjUmz7Z497aq+ir+gR7HnJvP0lgLnRcfivgyEgufB9J/pcj3d emLc0nA59N046rU0HnY6AskVnAh1mm8Ot9+HWGeeAYTOqHNRB91bnTfBBIwRbJiP aFT2TjDL7QFWkjeYW6J8QNwcp0VVqlqxnuACY5zlpjV4adzKQfcAB3U9H5H4yYmq AyH1yGjYK8HqN7plpSsZLJVaSKmtHSUqomSLWFdClejqFAIek4yXuSai1vONQl89 Ln60FH7uC7JA8AHWspxJhwiDLnnxfhFK4ONm0P7+7aV1QJl3OR0TkIr6mV3g44AO 0TYwVN2EXhAboDpqwoxrtrdSGosuLQlwWwAAzQGmO70qbQftauiPN4u/u6aNef90 XER+CZNe7tvWAgnrpHNBkfbW5IxcrPWHrEnVWw1aSKWZUfTYiNoUK+C5bRj7hzhu RLjbkHUTYjfyC9YvQjYuRmSYC8DtUxrXqXMEZYomCMKkGWLawvX09VvEGtgw2PcI 7WpINM7PfDazGR8RnmOH =gzls -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kraxel/tags/usb-20180518-pull-request' into staging usb: two smartcard reader fixes. # gpg: Signature made Fri 18 May 2018 08:50:01 BST # gpg: using RSA key 4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/usb-20180518-pull-request: hw/usb/dev-smartcard-reader: Handle 64 B USB packets ccid-card-passthru: fix regression in realize() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
dba0f15a3b
@ -345,7 +345,7 @@ static void passthru_realize(CCIDCardState *base, Error **errp)
|
||||
card->vscard_in_pos = 0;
|
||||
card->vscard_in_hdr = 0;
|
||||
if (qemu_chr_fe_backend_connected(&card->cs)) {
|
||||
error_setg(errp, "ccid-card-passthru: initing chardev");
|
||||
DPRINTF(card, D_INFO, "ccid-card-passthru: initing chardev");
|
||||
qemu_chr_fe_set_handlers(&card->cs,
|
||||
ccid_card_vscard_can_read,
|
||||
ccid_card_vscard_read,
|
||||
|
@ -1064,7 +1064,8 @@ err:
|
||||
return;
|
||||
}
|
||||
|
||||
static void ccid_bulk_in_copy_to_guest(USBCCIDState *s, USBPacket *p)
|
||||
static void ccid_bulk_in_copy_to_guest(USBCCIDState *s, USBPacket *p,
|
||||
unsigned int max_packet_size)
|
||||
{
|
||||
int len = 0;
|
||||
|
||||
@ -1072,10 +1073,13 @@ static void ccid_bulk_in_copy_to_guest(USBCCIDState *s, USBPacket *p)
|
||||
if (s->current_bulk_in != NULL) {
|
||||
len = MIN(s->current_bulk_in->len - s->current_bulk_in->pos,
|
||||
p->iov.size);
|
||||
usb_packet_copy(p, s->current_bulk_in->data +
|
||||
s->current_bulk_in->pos, len);
|
||||
if (len) {
|
||||
usb_packet_copy(p, s->current_bulk_in->data +
|
||||
s->current_bulk_in->pos, len);
|
||||
}
|
||||
s->current_bulk_in->pos += len;
|
||||
if (s->current_bulk_in->pos == s->current_bulk_in->len) {
|
||||
if (s->current_bulk_in->pos == s->current_bulk_in->len
|
||||
&& len != max_packet_size) {
|
||||
ccid_bulk_in_release(s);
|
||||
}
|
||||
} else {
|
||||
@ -1107,7 +1111,7 @@ static void ccid_handle_data(USBDevice *dev, USBPacket *p)
|
||||
case USB_TOKEN_IN:
|
||||
switch (p->ep->nr) {
|
||||
case CCID_BULK_IN_EP:
|
||||
ccid_bulk_in_copy_to_guest(s, p);
|
||||
ccid_bulk_in_copy_to_guest(s, p, dev->ep_ctl.max_packet_size);
|
||||
break;
|
||||
case CCID_INT_IN_EP:
|
||||
if (s->notify_slot_change) {
|
||||
|
Loading…
Reference in New Issue
Block a user