Esempio n. 1
0
int dibusb2_0_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
{
    int ret;
    u8 *b;

    b = kmalloc(3, GFP_KERNEL);
    if (!b)
        return -ENOMEM;

    if ((ret = dibusb_streaming_ctrl(adap,onoff)) < 0)
        goto ret;

    if (onoff) {
        b[0] = DIBUSB_REQ_SET_STREAMING_MODE;
        b[1] = 0x00;
        ret = dvb_usb_generic_write(adap->dev, b, 2);
        if (ret  < 0)
            goto ret;
    }

    b[0] = DIBUSB_REQ_SET_IOCTL;
    b[1] = onoff ? DIBUSB_IOCTL_CMD_ENABLE_STREAM : DIBUSB_IOCTL_CMD_DISABLE_STREAM;
    ret = dvb_usb_generic_write(adap->dev, b, 3);

ret:
    kfree(b);
    return ret;
}
Esempio n. 2
0
static int digitv_ctrl_msg(struct dvb_usb_device *d,
		u8 cmd, u8 vv, u8 *wbuf, int wlen, u8 *rbuf, int rlen)
{
	struct digitv_state *st = d->priv;
	int ret, wo;

	wo = (rbuf == NULL || rlen == 0); /* write-only */

	if (wlen > 4 || rlen > 4)
		return -EIO;

	memset(st->sndbuf, 0, 7);
	memset(st->rcvbuf, 0, 7);

	st->sndbuf[0] = cmd;
	st->sndbuf[1] = vv;
	st->sndbuf[2] = wo ? wlen : rlen;

	if (wo) {
		memcpy(&st->sndbuf[3], wbuf, wlen);
		ret = dvb_usb_generic_write(d, st->sndbuf, 7);
	} else {
		ret = dvb_usb_generic_rw(d, st->sndbuf, 7, st->rcvbuf, 7, 10);
		memcpy(rbuf, &st->rcvbuf[3], rlen);
	}
	return ret;
}
Esempio n. 3
0
int dibusb2_0_power_ctrl(struct dvb_usb_device *d, int onoff)
{
    if (onoff) {
        u8 b[3] = { DIBUSB_REQ_SET_IOCTL, DIBUSB_IOCTL_CMD_POWER_MODE, DIBUSB_IOCTL_POWER_WAKEUP };
        return dvb_usb_generic_write(d,b,3);
    } else
        return 0;
}
Esempio n. 4
0
int dibusb2_0_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
{
    u8 b[3] = { 0 };
    int ret;

    if ((ret = dibusb_streaming_ctrl(adap,onoff)) < 0)
        return ret;

    if (onoff) {
        b[0] = DIBUSB_REQ_SET_STREAMING_MODE;
        b[1] = 0x00;
        if ((ret = dvb_usb_generic_write(adap->dev,b,2)) < 0)
            return ret;
    }

    b[0] = DIBUSB_REQ_SET_IOCTL;
    b[1] = onoff ? DIBUSB_IOCTL_CMD_ENABLE_STREAM : DIBUSB_IOCTL_CMD_DISABLE_STREAM;
    return dvb_usb_generic_write(adap->dev,b,3);
}
Esempio n. 5
0
int dibusb_power_ctrl(struct dvb_usb_device *d, int onoff)
{
    u8 b[3];
    int ret;
    b[0] = DIBUSB_REQ_SET_IOCTL;
    b[1] = DIBUSB_IOCTL_CMD_POWER_MODE;
    b[2] = onoff ? DIBUSB_IOCTL_POWER_WAKEUP : DIBUSB_IOCTL_POWER_SLEEP;
    ret = dvb_usb_generic_write(d,b,3);
    msleep(10);
    return ret;
}
Esempio n. 6
0
static int digitv_ctrl_msg(struct dvb_usb_device *d,
		u8 cmd, u8 vv, u8 *wbuf, int wlen, u8 *rbuf, int rlen)
{
	int wo = (rbuf == NULL || rlen == 0); /* write-only */
	u8 sndbuf[7],rcvbuf[7];
	memset(sndbuf,0,7); memset(rcvbuf,0,7);

	sndbuf[0] = cmd;
	sndbuf[1] = vv;
	sndbuf[2] = wo ? wlen : rlen;

	if (!wo) {
		memcpy(&sndbuf[3],wbuf,wlen);
		dvb_usb_generic_write(d,sndbuf,7);
	} else {
		dvb_usb_generic_rw(d,sndbuf,7,rcvbuf,7,10);
		memcpy(rbuf,&rcvbuf[3],rlen);
	}
	return 0;
}
Esempio n. 7
0
int dibusb_power_ctrl(struct dvb_usb_device *d, int onoff)
{
    u8 *b;
    int ret;

    b = kmalloc(3, GFP_KERNEL);
    if (!b)
        return -ENOMEM;

    b[0] = DIBUSB_REQ_SET_IOCTL;
    b[1] = DIBUSB_IOCTL_CMD_POWER_MODE;
    b[2] = onoff ? DIBUSB_IOCTL_POWER_WAKEUP : DIBUSB_IOCTL_POWER_SLEEP;

    ret = dvb_usb_generic_write(d, b, 3);

    kfree(b);

    msleep(10);

    return ret;
}