usb: add ifnum to USBEndpoint
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
d8e17efdec
commit
82f02fe965
14
hw/usb.c
14
hw/usb.c
@ -422,6 +422,8 @@ void usb_ep_init(USBDevice *dev)
|
|||||||
for (ep = 0; ep < USB_MAX_ENDPOINTS; ep++) {
|
for (ep = 0; ep < USB_MAX_ENDPOINTS; ep++) {
|
||||||
dev->ep_in[ep].type = USB_ENDPOINT_XFER_INVALID;
|
dev->ep_in[ep].type = USB_ENDPOINT_XFER_INVALID;
|
||||||
dev->ep_out[ep].type = USB_ENDPOINT_XFER_INVALID;
|
dev->ep_out[ep].type = USB_ENDPOINT_XFER_INVALID;
|
||||||
|
dev->ep_in[ep].ifnum = 0;
|
||||||
|
dev->ep_out[ep].ifnum = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -444,3 +446,15 @@ void usb_ep_set_type(USBDevice *dev, int pid, int ep, uint8_t type)
|
|||||||
struct USBEndpoint *uep = usb_ep_get(dev, pid, ep);
|
struct USBEndpoint *uep = usb_ep_get(dev, pid, ep);
|
||||||
uep->type = type;
|
uep->type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t usb_ep_get_ifnum(USBDevice *dev, int pid, int ep)
|
||||||
|
{
|
||||||
|
struct USBEndpoint *uep = usb_ep_get(dev, pid, ep);
|
||||||
|
return uep->ifnum;
|
||||||
|
}
|
||||||
|
|
||||||
|
void usb_ep_set_ifnum(USBDevice *dev, int pid, int ep, uint8_t ifnum)
|
||||||
|
{
|
||||||
|
struct USBEndpoint *uep = usb_ep_get(dev, pid, ep);
|
||||||
|
uep->ifnum = ifnum;
|
||||||
|
}
|
||||||
|
3
hw/usb.h
3
hw/usb.h
@ -175,6 +175,7 @@ struct USBDescString {
|
|||||||
|
|
||||||
struct USBEndpoint {
|
struct USBEndpoint {
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
|
uint8_t ifnum;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* definition of a USB device */
|
/* definition of a USB device */
|
||||||
@ -334,7 +335,9 @@ void usb_cancel_packet(USBPacket * p);
|
|||||||
void usb_ep_init(USBDevice *dev);
|
void usb_ep_init(USBDevice *dev);
|
||||||
struct USBEndpoint *usb_ep_get(USBDevice *dev, int pid, int ep);
|
struct USBEndpoint *usb_ep_get(USBDevice *dev, int pid, int ep);
|
||||||
uint8_t usb_ep_get_type(USBDevice *dev, int pid, int ep);
|
uint8_t usb_ep_get_type(USBDevice *dev, int pid, int ep);
|
||||||
|
uint8_t usb_ep_get_ifnum(USBDevice *dev, int pid, int ep);
|
||||||
void usb_ep_set_type(USBDevice *dev, int pid, int ep, uint8_t type);
|
void usb_ep_set_type(USBDevice *dev, int pid, int ep, uint8_t type);
|
||||||
|
void usb_ep_set_ifnum(USBDevice *dev, int pid, int ep, uint8_t ifnum);
|
||||||
|
|
||||||
void usb_attach(USBPort *port);
|
void usb_attach(USBPort *port);
|
||||||
void usb_detach(USBPort *port);
|
void usb_detach(USBPort *port);
|
||||||
|
@ -1206,6 +1206,7 @@ static int usb_linux_update_endp_table(USBHostDevice *s)
|
|||||||
assert(usb_ep_get_type(&s->dev, pid, ep) ==
|
assert(usb_ep_get_type(&s->dev, pid, ep) ==
|
||||||
USB_ENDPOINT_XFER_INVALID);
|
USB_ENDPOINT_XFER_INVALID);
|
||||||
usb_ep_set_type(&s->dev, pid, ep, type);
|
usb_ep_set_type(&s->dev, pid, ep, type);
|
||||||
|
usb_ep_set_ifnum(&s->dev, pid, ep, interface);
|
||||||
|
|
||||||
epd = get_endp(s, pid, ep);
|
epd = get_endp(s, pid, ep);
|
||||||
epd->halted = 0;
|
epd->halted = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user