Merge pull request #36 from fysnet/master

Fix issue #25
This commit is contained in:
Stanislav Shwartsman 2023-03-18 07:44:19 +02:00 committed by GitHub
commit 5b45a2e985
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 11 deletions

View File

@ -274,6 +274,7 @@ usb_device_c *usbdev_locator_c::create(const char *type, const char *devname)
usb_device_c::usb_device_c(void)
{
memset((void *) &d, 0, sizeof(d));
d.pcapture.pcap_image_init();
d.async_mode = 1;
d.speed = USB_SPEED_LOW;
d.first8 = 0;
@ -687,7 +688,7 @@ int usb_device_c::handle_control_common(int request, int value, int index, int l
}
break;
case InterfaceRequest | USB_REQ_GET_INTERFACE:
// Ben TODO: If the device is not in the configured state, this request should stall
// Ben: TODO: If the device is not in the configured state, this request should stall
BX_DEBUG(("USB_REQ_GET_INTERFACE:"));
// with InterfaceRequest, the wValue field must be zero and wLength field must be 1
if ((value != 0) || (length != 1)) {
@ -701,7 +702,7 @@ int usb_device_c::handle_control_common(int request, int value, int index, int l
}
break;
case InterfaceOutRequest | USB_REQ_SET_INTERFACE:
// Ben TODO: If the device is not in the configured state, this request should stall
// Ben: TODO: If the device is not in the configured state, this request should stall
BX_DEBUG(("USB_REQ_SET_INTERFACE: value=%d", value));
// with InterfaceRequest, the wIndex and wLength fields must be zero
if ((index != 0) || (length != 0)) {

View File

@ -54,13 +54,6 @@
/*** base class pcap_image_t ***/
pcap_image_t::pcap_image_t()
{
fd = -1;
last_pos = 0;
time_usecs = 0;
}
pcap_image_t::~pcap_image_t()
{
if (fd > -1)
@ -68,6 +61,13 @@ pcap_image_t::~pcap_image_t()
fd = -1;
}
void pcap_image_t::pcap_image_init()
{
fd = -1;
last_pos = 0;
time_usecs = 0;
}
int pcap_image_t::create_pcap(const char *pathname)
{
pcap_hdr_t header;

View File

@ -92,9 +92,9 @@ struct usbmon_packet {
class BOCHSAPI_MSVCONLY pcap_image_t
{
public:
// Default constructor
pcap_image_t();
// Uses a default constructor
~pcap_image_t();
void pcap_image_init();
// append a packet to the pcap file
int create_pcap(const char *filename);