qemu/hw/usb
Benjamin David Lunt 8dd9165e7c hw/usb/bus.c: PCAP adding 0xA in Windows version
Since Windows text files use CRLFs for all \n, the Windows version of QEMU
inserts a CR in the PCAP stream when a LF is encountered when using USB PCAP
files. This is due to the fact that the PCAP file is opened as TEXT instead
of BINARY.

To show an example, when using a very common protocol to USB disks, the BBB
protocol uses a 10-byte command packet. For example, the READ_CAPACITY(10)
command will have a command block length of 10 (0xA). When this 10-byte
command (part of the 31-byte CBW) is placed into the PCAP file, the Windows
file manager inserts a 0xD before the 0xA, turning the 31-byte CBW into a
32-byte CBW.

Actual CBW:
  0040 55 53 42 43 01 00 00 00 08 00 00 00 80 00 0a 25 USBC...........%
  0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00       ...............

PCAP CBW
  0040 55 53 42 43 01 00 00 00 08 00 00 00 80 00 0d 0a USBC............
  0050 25 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 %..............

I believe simply opening the PCAP file as BINARY instead of TEXT will fix
this issue.

Resolves: https://bugs.launchpad.net/qemu/+bug/2054889
Signed-off-by: Benjamin David Lunt <benlunt@fysnet.net>
Message-ID: <000101da6823$ce1bbf80$6a533e80$@fysnet.net>
[thuth: Break long line to avoid checkpatch.pl error]
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 5e02a4fdeb)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2024-03-01 18:59:25 +03:00
..
bus.c hw/usb/bus.c: PCAP adding 0xA in Windows version 2024-03-01 18:59:25 +03:00
canokey.c hw: canokey: Remove HS support as not compliant to the spec 2022-07-01 12:39:51 +02:00
canokey.h hw/usb: Add CanoKey Implementation 2022-06-14 10:34:36 +02:00
ccid-card-emulated.c Drop useless casts from g_malloc() & friends to pointer 2022-10-22 23:15:40 +02:00
ccid-card-passthru.c modules: introduces module_kconfig directive 2022-06-06 09:26:53 +02:00
ccid.h
chipidea.c
combined-packet.c
core.c
desc-msos.c
desc.c
desc.h
dev-audio.c
dev-hid.c
dev-hub.c hw/usb: fix tab indentation 2022-11-08 11:13:48 +01:00
dev-mtp.c hw/usb: dev-mtp: Use g_mkdir() 2022-10-31 20:37:58 +00:00
dev-network.c net: Provide MemReentrancyGuard * to qemu_new_nic() 2023-11-29 16:19:39 +03:00
dev-serial.c
dev-smartcard-reader.c
dev-storage-bot.c
dev-storage-classic.c
dev-storage.c usb/msd: add usb_msd_fatal_error() and fix guest-triggerable assert 2022-09-27 07:32:30 +02:00
dev-uas.c hw: replace most qemu_bh_new calls with qemu_bh_new_guarded 2023-09-11 10:53:50 +03:00
dev-wacom.c hw/usb: fix tab indentation 2022-11-08 11:13:48 +01:00
hcd-dwc2.c hw: replace most qemu_bh_new calls with qemu_bh_new_guarded 2023-09-11 10:53:50 +03:00
hcd-dwc2.h
hcd-dwc3.c
hcd-ehci-pci.c
hcd-ehci-sysbus.c
hcd-ehci.c hw: replace most qemu_bh_new calls with qemu_bh_new_guarded 2023-09-11 10:53:50 +03:00
hcd-ehci.h
hcd-musb.c hw/usb: fix tab indentation 2022-11-08 11:13:48 +01:00
hcd-ohci-pci.c
hcd-ohci.c usb/ohci: Set pad to 0 after frame update 2023-05-28 12:02:26 +03:00
hcd-ohci.h
hcd-uhci.c hw: replace most qemu_bh_new calls with qemu_bh_new_guarded 2023-09-11 10:53:50 +03:00
hcd-uhci.h
hcd-xhci-nec.c
hcd-xhci-pci.c hw/usb/hcd-xhci: Reset the XHCIState with device_cold_reset() 2022-11-23 12:28:51 +01:00
hcd-xhci-pci.h
hcd-xhci-sysbus.c hw/usb/hcd-xhci: Reset the XHCIState with device_cold_reset() 2022-11-23 12:28:51 +01:00
hcd-xhci-sysbus.h
hcd-xhci.c hw/usb/hcd-xhci.c: spelling: tranfer 2022-11-23 12:26:25 +01:00
hcd-xhci.h
host-libusb.c hw: replace most qemu_bh_new calls with qemu_bh_new_guarded 2023-09-11 10:53:50 +03:00
host.h
imx-usb-phy.c
Kconfig meson: Add CanoKey 2022-06-14 10:34:36 +02:00
libhw.c
meson.build meson: Add CanoKey 2022-06-14 10:34:36 +02:00
pcap.c
quirks-ftdi-ids.h
quirks-pl2303-ids.h hw/usb: fix tab indentation 2022-11-08 11:13:48 +01:00
quirks.c
quirks.h
redirect.c hw: replace most qemu_bh_new calls with qemu_bh_new_guarded 2023-09-11 10:53:50 +03:00
trace-events usb/msd: add usb_msd_fatal_error() and fix guest-triggerable assert 2022-09-27 07:32:30 +02:00
trace.h
tusb6010.c
u2f-emulated.c
u2f-passthru.c
u2f.c
u2f.h misc: fix commonly doubled up words 2022-08-01 11:58:02 +02:00
vt82c686-uhci-pci.c hw/isa/vt82c686: Introduce TYPE_VT82C686B_USB_UHCI define 2022-10-31 11:32:07 +01:00
xen-usb.c hw: replace most qemu_bh_new calls with qemu_bh_new_guarded 2023-09-11 10:53:50 +03:00
xlnx-usb-subsystem.c
xlnx-versal-usb2-ctrl-regs.c