summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/dvb-usb/dvb-usb-urb.c
diff options
context:
space:
mode:
authorPatrick Boettcher <devnull@localhost>2005-03-31 09:03:13 +0000
committerPatrick Boettcher <devnull@localhost>2005-03-31 09:03:13 +0000
commit44ac7e9829b60e9ef7d71fb8f12a2fbfebdee3ef (patch)
tree24e45f92028d77c2d47fe00ed04e29df5aab5a6f /linux/drivers/media/dvb/dvb-usb/dvb-usb-urb.c
parent0ad06ad87d1c2367111bf139516f955da43315af (diff)
downloadmediapointer-dvb-s2-44ac7e9829b60e9ef7d71fb8f12a2fbfebdee3ef.tar.gz
mediapointer-dvb-s2-44ac7e9829b60e9ef7d71fb8f12a2fbfebdee3ef.tar.bz2
- modifications/preparations for port of a driver (dtt200u)
Diffstat (limited to 'linux/drivers/media/dvb/dvb-usb/dvb-usb-urb.c')
-rw-r--r--linux/drivers/media/dvb/dvb-usb/dvb-usb-urb.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/linux/drivers/media/dvb/dvb-usb/dvb-usb-urb.c b/linux/drivers/media/dvb/dvb-usb/dvb-usb-urb.c
index a833c0ed6..80b3ff91f 100644
--- a/linux/drivers/media/dvb/dvb-usb/dvb-usb-urb.c
+++ b/linux/drivers/media/dvb/dvb-usb/dvb-usb-urb.c
@@ -10,6 +10,58 @@
#include <linux/pci.h>
+int dvb_usb_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen, u8 *rbuf,
+ u16 rlen)
+{
+ int actlen,ret = -ENOMEM;
+
+ if (d->props.generic_bulk_ctrl_endpoint == 0) {
+ err("endpoint for generic control not specified.");
+ return -EINVAL;
+ }
+
+ if (wbuf == NULL || wlen == 0)
+ return -EINVAL;
+
+ if ((ret = down_interruptible(&d->usb_sem)))
+ return ret;
+
+ debug_dump(wbuf,wlen,deb_xfer);
+
+ ret = usb_bulk_msg(d->udev,usb_sndbulkpipe(d->udev,
+ d->props.generic_bulk_ctrl_endpoint), wbuf,wlen,&actlen,
+ 2*HZ);
+
+ if (ret)
+ err("bulk message failed: %d (%d/%d)",ret,wlen,actlen);
+ else
+ ret = actlen != wlen ? -1 : 0;
+
+ /* an answer is expected, and no error before */
+ if (!ret && rbuf && rlen) {
+ ret = usb_bulk_msg(d->udev,usb_rcvbulkpipe(d->udev,
+ d->props.generic_bulk_ctrl_endpoint),rbuf,rlen,&actlen,
+ 2*HZ);
+
+ if (ret)
+ err("recv bulk message failed: %d",ret);
+ else {
+ deb_alot("rlen: %d\n",rlen);
+ debug_dump(rbuf,actlen,deb_xfer);
+ }
+ }
+
+ up(&d->usb_sem);
+ return ret;
+}
+EXPORT_SYMBOL(dvb_usb_generic_rw);
+
+int dvb_usb_generic_write(struct dvb_usb_device *d, u8 *buf, u16 len)
+{
+ return dvb_usb_generic_rw(d,buf,len,NULL,0);
+}
+EXPORT_SYMBOL(dvb_usb_generic_write);
+
static void dvb_usb_bulk_urb_complete(struct urb *urb, struct pt_regs *ptregs)
{
struct dvb_usb_device *d = urb->context;