PERFORCE change 169952 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Fri Oct 30 11:56:56 UTC 2009
http://p4web.freebsd.org/chv.cgi?CH=169952
Change 169952 by hselasky at hselasky_laptop001 on 2009/10/30 11:56:44
USB CORE:
- add more functions to Linux compat layer.
- patch from: Leunam Elebek
Affected files ...
.. //depot/projects/usb/src/sys/dev/usb/usb_compat_linux.c#49 edit
.. //depot/projects/usb/src/sys/dev/usb/usb_compat_linux.h#23 edit
Differences ...
==== //depot/projects/usb/src/sys/dev/usb/usb_compat_linux.c#49 (text+ko) ====
@@ -1663,3 +1663,58 @@
goto tr_setup;
}
}
+
+/*------------------------------------------------------------------------*
+ * usb_fill_bulk_urb
+ *------------------------------------------------------------------------*/
+void
+usb_fill_bulk_urb(struct urb *urb, struct usb_device *udev,
+ struct usb_host_endpoint *uhe, void *buf,
+ int length, usb_complete_t callback, void *arg)
+{
+ urb->dev = udev;
+ urb->endpoint = uhe;
+ urb->transfer_buffer = buf;
+ urb->transfer_buffer_length = length;
+ urb->complete = callback;
+ urb->context = arg;
+}
+
+/*------------------------------------------------------------------------*
+ * usb_bulk_msg
+ *
+ * NOTE: This function can also be used for interrupt endpoints!
+ *
+ * Return values:
+ * 0: Success
+ * Else: Failure
+ *------------------------------------------------------------------------*/
+int
+usb_bulk_msg(struct usb_device *udev, struct usb_host_endpoint *uhe,
+ void *data, int len, uint16_t *pactlen, usb_timeout_t timeout)
+{
+ struct urb *urb;
+ int err;
+
+ if (uhe == NULL)
+ return (-EINVAL);
+ if (len < 0)
+ return (-EINVAL);
+
+ err = usb_setup_endpoint(udev, uhe, 4096 /* bytes */);
+ if (err)
+ return (err);
+
+ urb = usb_alloc_urb(0, 0);
+ if (urb == NULL)
+ return (-ENOMEM);
+
+ usb_fill_bulk_urb(urb, udev, uhe, data, len,
+ usb_linux_wait_complete, NULL);
+
+ err = usb_start_wait_urb(urb, timeout, pactlen);
+
+ usb_free_urb(urb);
+
+ return (err);
+}
==== //depot/projects/usb/src/sys/dev/usb/usb_compat_linux.h#23 (text+ko) ====
@@ -299,6 +299,11 @@
void usb_linux_register(void *arg);
void usb_linux_deregister(void *arg);
+void usb_fill_bulk_urb(struct urb *, struct usb_device *,
+ struct usb_host_endpoint *, void *, int, usb_complete_t, void *);
+int usb_bulk_msg(struct usb_device *, struct usb_host_endpoint *,
+ void *, int, uint16_t *, usb_timeout_t);
+
#define interface_to_usbdev(intf) (intf)->linux_udev
#define interface_to_bsddev(intf) (intf)->linux_udev
More information about the p4-projects
mailing list