diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2006-04-24 21:10:52 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2006-04-24 21:10:52 +0000 |
commit | 56bebe70bd3659e046e6a6be08492061fedd1ad1 (patch) | |
tree | 43c605d15f434b38cba5b4c7ee91b5dd792f82f5 /hw/usb.c | |
parent | fd4a43e4e28a594a20beefe78b0fe7ecd34bd981 (diff) | |
download | qemu-56bebe70bd3659e046e6a6be08492061fedd1ad1.zip qemu-56bebe70bd3659e046e6a6be08492061fedd1ad1.tar.gz qemu-56bebe70bd3659e046e6a6be08492061fedd1ad1.tar.bz2 |
usb setup state machine fix when driver reads or writes too many bytes
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1847 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/usb.c')
-rw-r--r-- | hw/usb.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -91,8 +91,8 @@ int usb_generic_handle_packet(USBDevice *s, int pid, case 0: switch(s->setup_state) { case SETUP_STATE_ACK: - s->setup_state = SETUP_STATE_IDLE; if (!(s->setup_buf[0] & USB_DIR_IN)) { + s->setup_state = SETUP_STATE_IDLE; ret = s->handle_control(s, (s->setup_buf[0] << 8) | s->setup_buf[1], (s->setup_buf[3] << 8) | s->setup_buf[2], @@ -102,7 +102,7 @@ int usb_generic_handle_packet(USBDevice *s, int pid, if (ret > 0) ret = 0; } else { - goto fail; + /* return 0 byte */ } break; case SETUP_STATE_DATA: @@ -136,11 +136,11 @@ int usb_generic_handle_packet(USBDevice *s, int pid, case 0: switch(s->setup_state) { case SETUP_STATE_ACK: - s->setup_state = SETUP_STATE_IDLE; if (s->setup_buf[0] & USB_DIR_IN) { + s->setup_state = SETUP_STATE_IDLE; /* transfer OK */ } else { - goto fail; + /* ignore additionnal output */ } break; case SETUP_STATE_DATA: |