#include "stub.h"
#include <linux/usb/hcd.h>
-
static int is_clear_halt_cmd(struct urb *urb)
{
struct usb_ctrlrequest *req;
req = (struct usb_ctrlrequest *) urb->setup_packet;
return (req->bRequest == USB_REQ_SET_INTERFACE) &&
- (req->bRequestType == USB_RECIP_INTERFACE);
+ (req->bRequestType == USB_RECIP_INTERFACE);
}
static int is_set_configuration_cmd(struct urb *urb)
req = (struct usb_ctrlrequest *) urb->setup_packet;
return (req->bRequest == USB_REQ_SET_CONFIGURATION) &&
- (req->bRequestType == USB_RECIP_DEVICE);
+ (req->bRequestType == USB_RECIP_DEVICE);
}
static int is_reset_device_cmd(struct urb *urb)
index = le16_to_cpu(req->wIndex);
if ((req->bRequest == USB_REQ_SET_FEATURE) &&
- (req->bRequestType == USB_RT_PORT) &&
- (value == USB_PORT_FEAT_RESET)) {
+ (req->bRequestType == USB_RT_PORT) &&
+ (value == USB_PORT_FEAT_RESET)) {
usbip_dbg_stub_rx("reset_device_cmd, port %u\n", index);
return 1;
} else
ret = usb_clear_halt(urb->dev, target_pipe);
if (ret < 0)
usbip_uinfo("clear_halt error: devnum %d endp %d, %d\n",
- urb->dev->devnum, target_endp, ret);
+ urb->dev->devnum, target_endp, ret);
else
usbip_uinfo("clear_halt done: devnum %d endp %d\n",
- urb->dev->devnum, target_endp);
+ urb->dev->devnum, target_endp);
return ret;
}
alternate = le16_to_cpu(req->wValue);
interface = le16_to_cpu(req->wIndex);
- usbip_dbg_stub_rx("set_interface: inf %u alt %u\n", interface,
- alternate);
+ usbip_dbg_stub_rx("set_interface: inf %u alt %u\n",
+ interface, alternate);
ret = usb_set_interface(urb->dev, interface, alternate);
if (ret < 0)
usbip_uinfo("set_interface error: inf %u alt %u, %d\n",
- interface, alternate, ret);
+ interface, alternate, ret);
else
usbip_uinfo("set_interface done: inf %u alt %u\n",
- interface,
- alternate);
+ interface, alternate);
return ret;
}
* A user may need to set a special configuration value before
* exporting the device.
*/
- usbip_uinfo("set_configuration (%d) to %s\n", config,
- dev_name(&urb->dev->dev));
+ usbip_uinfo("set_configuration %d to %s\n",
+ config, dev_name(&urb->dev->dev));
usbip_uinfo("but, skip!\n");
return 0;
* See also comments about unlinking strategy in vhci_hcd.c.
*/
static int stub_recv_cmd_unlink(struct stub_device *sdev,
- struct usbip_header *pdu)
+ struct usbip_header *pdu)
{
unsigned long flags;
struct stub_priv *priv;
-
spin_lock_irqsave(&sdev->priv_lock, flags);
list_for_each_entry(priv, &sdev->priv_init, list) {
}
usbip_dbg_stub_rx("seqnum %d is not pending\n",
- pdu->u.cmd_unlink.seqnum);
+ pdu->u.cmd_unlink.seqnum);
/*
* The urb of the unlink target is not found in priv_init queue. It was
spin_unlock_irqrestore(&sdev->priv_lock, flags);
-
return 0;
}
}
epd = &ep->desc;
-
-
#if 0
/* epnum 0 is always control */
if (epnum == 0) {
return usb_rcvctrlpipe(udev, 0);
}
#endif
-
if (usb_endpoint_xfer_control(epd)) {
if (dir == USBIP_DIR_OUT)
return usb_sndctrlpipe(udev, epnum);
return;
ep = (usb_pipein(urb->pipe) ? dev->ep_in : dev->ep_out)
- [usb_pipeendpoint(urb->pipe)];
+ [usb_pipeendpoint(urb->pipe)];
if (!ep)
return;
xfertype = usb_endpoint_type(&ep->desc);
if (xfertype == USB_ENDPOINT_XFER_CONTROL) {
struct usb_ctrlrequest *setup =
- (struct usb_ctrlrequest *) urb->setup_packet;
+ (struct usb_ctrlrequest *) urb->setup_packet;
if (!setup)
return;
is_out = !(setup->bRequestType & USB_DIR_IN) ||
- !setup->wLength;
+ !setup->wLength;
} else {
is_out = usb_endpoint_dir_out(&ep->desc);
}
struct usb_device *udev = sdev->udev;
int pipe = get_pipe(sdev, pdu->base.ep, pdu->base.direction);
-
priv = stub_priv_alloc(sdev, pdu);
if (!priv)
return;
/* setup a urb */
if (usb_pipeisoc(pipe))
priv->urb = usb_alloc_urb(pdu->u.cmd_submit.number_of_packets,
- GFP_KERNEL);
+ GFP_KERNEL);
else
priv->urb = usb_alloc_urb(0, GFP_KERNEL);
if (pdu->u.cmd_submit.transfer_buffer_length > 0) {
priv->urb->transfer_buffer =
kzalloc(pdu->u.cmd_submit.transfer_buffer_length,
- GFP_KERNEL);
+ GFP_KERNEL);
if (!priv->urb->transfer_buffer) {
dev_err(&sdev->interface->dev, "malloc x_buff\n");
usbip_event_add(ud, SDEV_EVENT_ERROR_MALLOC);
if (ret == 0)
usbip_dbg_stub_rx("submit urb ok, seqnum %u\n",
- pdu->base.seqnum);
+ pdu->base.seqnum);
else {
dev_err(&sdev->interface->dev, "submit_urb error, %d\n", ret);
usbip_dump_header(pdu);
usbip_event_add(ud, SDEV_EVENT_ERROR_TCP);
return;
}
-
}
int stub_rx_loop(void *data)
stub_rx_pdu(ud);
}
+
return 0;
}