version 1.1.1.5, 2018/04/24 18:56:04
|
version 1.1.1.6, 2018/04/24 19:17:09
|
Line 62 typedef struct USBHostDevice {
|
Line 62 typedef struct USBHostDevice {
|
} USBHostDevice; |
} USBHostDevice; |
|
|
|
|
#if 0 |
|
static int ensure_ep_open(USBHostDevice *dev, int ep, int mode) |
static int ensure_ep_open(USBHostDevice *dev, int ep, int mode) |
{ |
{ |
char buf[32]; |
char buf[32]; |
Line 110 static void ensure_eps_closed(USBHostDev
|
Line 109 static void ensure_eps_closed(USBHostDev
|
epnum++; |
epnum++; |
} |
} |
} |
} |
#endif |
|
|
|
static void usb_host_handle_reset(USBDevice *dev) |
static void usb_host_handle_reset(USBDevice *dev) |
{ |
{ |
Line 119 static void usb_host_handle_reset(USBDev
|
Line 117 static void usb_host_handle_reset(USBDev
|
#endif |
#endif |
} |
} |
|
|
#if 0 |
|
/* XXX: |
/* XXX: |
* -check device states against transfer requests |
* -check device states against transfer requests |
* and return appropriate response |
* and return appropriate response |
Line 256 static int usb_host_handle_data(USBDevic
|
Line 253 static int usb_host_handle_data(USBDevic
|
} |
} |
|
|
if (p->pid == USB_TOKEN_IN) |
if (p->pid == USB_TOKEN_IN) |
ret = read(fd, p->data, p->len); |
ret = readv(fd, p->iov.iov, p->iov.niov); |
else |
else |
ret = write(fd, p->data, p->len); |
ret = writev(fd, p->iov.iov, p->iov.niov); |
|
|
sigprocmask(SIG_SETMASK, &old_mask, NULL); |
sigprocmask(SIG_SETMASK, &old_mask, NULL); |
|
|
Line 278 static int usb_host_handle_data(USBDevic
|
Line 275 static int usb_host_handle_data(USBDevic
|
return ret; |
return ret; |
} |
} |
} |
} |
#endif |
|
|
|
static void usb_host_handle_destroy(USBDevice *opaque) |
static void usb_host_handle_destroy(USBDevice *opaque) |
{ |
{ |
Line 294 static void usb_host_handle_destroy(USBD
|
Line 290 static void usb_host_handle_destroy(USBD
|
|
|
close(s->devfd); |
close(s->devfd); |
|
|
qemu_free(s); |
g_free(s); |
} |
} |
|
|
static int usb_host_initfn(USBDevice *dev) |
static int usb_host_initfn(USBDevice *dev) |
Line 305 static int usb_host_initfn(USBDevice *de
|
Line 301 static int usb_host_initfn(USBDevice *de
|
USBDevice *usb_host_device_open(const char *devname) |
USBDevice *usb_host_device_open(const char *devname) |
{ |
{ |
struct usb_device_info bus_info, dev_info; |
struct usb_device_info bus_info, dev_info; |
USBDevice *d = NULL; |
USBDevice *d = NULL, *ret = NULL; |
USBHostDevice *dev, *ret = NULL; |
USBHostDevice *dev; |
char ctlpath[PATH_MAX + 1]; |
char ctlpath[PATH_MAX + 1]; |
char buspath[PATH_MAX + 1]; |
char buspath[PATH_MAX + 1]; |
int bfd, dfd, bus, address, i; |
int bfd, dfd, bus, address, i; |
Line 408 static struct USBDeviceInfo usb_host_dev
|
Line 404 static struct USBDeviceInfo usb_host_dev
|
.init = usb_host_initfn, |
.init = usb_host_initfn, |
.handle_packet = usb_generic_handle_packet, |
.handle_packet = usb_generic_handle_packet, |
.handle_reset = usb_host_handle_reset, |
.handle_reset = usb_host_handle_reset, |
#if 0 |
|
.handle_control = usb_host_handle_control, |
.handle_control = usb_host_handle_control, |
.handle_data = usb_host_handle_data, |
.handle_data = usb_host_handle_data, |
#endif |
|
.handle_destroy = usb_host_handle_destroy, |
.handle_destroy = usb_host_handle_destroy, |
}; |
}; |
|
|