#else
#include <bus/usb/usb.h>
#endif
-#include <signal.h>
/* This value has maximum potential at 16.
* You should also set hw.usb.debug to gain
} USBHostDevice;
-#if 0
static int ensure_ep_open(USBHostDevice *dev, int ep, int mode)
{
char buf[32];
epnum++;
}
}
-#endif
static void usb_host_handle_reset(USBDevice *dev)
{
#endif
}
-#if 0
/* XXX:
* -check device states against transfer requests
* and return appropriate response
*/
static int usb_host_handle_control(USBDevice *dev,
+ USBPacket *p,
int request,
int value,
int index,
}
if (p->pid == USB_TOKEN_IN)
- ret = read(fd, p->data, p->len);
+ ret = readv(fd, p->iov.iov, p->iov.niov);
else
- ret = write(fd, p->data, p->len);
+ ret = writev(fd, p->iov.iov, p->iov.niov);
sigprocmask(SIG_SETMASK, &old_mask, NULL);
return ret;
}
}
-#endif
static void usb_host_handle_destroy(USBDevice *opaque)
{
close(s->devfd);
- qemu_free(s);
+ g_free(s);
}
static int usb_host_initfn(USBDevice *dev)
USBDevice *usb_host_device_open(const char *devname)
{
struct usb_device_info bus_info, dev_info;
- USBDevice *d = NULL;
- USBHostDevice *dev, *ret = NULL;
+ USBDevice *d = NULL, *ret = NULL;
+ USBHostDevice *dev;
char ctlpath[PATH_MAX + 1];
char buspath[PATH_MAX + 1];
int bfd, dfd, bus, address, i;
if (dev_info.udi_speed == 1) {
dev->dev.speed = USB_SPEED_LOW - 1;
+ dev->dev.speedmask = USB_SPEED_MASK_LOW;
} else {
dev->dev.speed = USB_SPEED_FULL - 1;
+ dev->dev.speedmask = USB_SPEED_MASK_FULL;
}
if (strncmp(dev_info.udi_product, "product", 7) != 0) {
.init = usb_host_initfn,
.handle_packet = usb_generic_handle_packet,
.handle_reset = usb_host_handle_reset,
-#if 0
.handle_control = usb_host_handle_control,
.handle_data = usb_host_handle_data,
-#endif
.handle_destroy = usb_host_handle_destroy,
};
printf("usb_host_scan: couldn't get device information for %s - %s\n",
devbuf, strerror(errno));
- // XXX: might need to fixup endianess of word values before copying over
+ /* XXX: might need to fixup endianness of word values before copying over */
vendor_id = dev_info.udi_vendorNo;
product_id = dev_info.udi_productNo;