int vp702x_power_ctrl(struct dvb_usb_device *d, int onoff) { struct vp702x_device_state *st = d->priv; if (st->power_state == 0 && onoff) vp702x_usb_out_op(d, SET_TUNER_POWER_REQ, 1, 7, NULL, 0); else if (st->power_state == 1 && onoff == 0) vp702x_usb_out_op(d, SET_TUNER_POWER_REQ, 0, 7, NULL, 0); st->power_state = onoff; return 0; }
static int vp702x_frontend_attach(struct dvb_usb_adapter *adap) { u8 buf[10] = { 0 }; vp702x_usb_out_op(adap->dev, SET_TUNER_POWER_REQ, 0, 7, NULL, 0); if (vp702x_usb_inout_cmd(adap->dev, GET_SYSTEM_STRING, NULL, 0, buf, 10, 10)) return -EIO; buf[9] = '\0'; info("system string: %s",&buf[1]); vp702x_init_pid_filter(adap); adap->fe = vp702x_fe_attach(adap->dev); vp702x_usb_out_op(adap->dev, SET_TUNER_POWER_REQ, 1, 7, NULL, 0); return 0; }
int vp702x_usb_inout_op(struct dvb_usb_device *d, u8 *o, int olen, u8 *i, int ilen, int msec) { int ret; if ((ret = mutex_lock_interruptible(&d->usb_mutex))) return ret; ret = vp702x_usb_out_op(d,REQUEST_OUT,0,0,o,olen); msleep(msec); ret = vp702x_usb_in_op(d,REQUEST_IN,0,0,i,ilen); mutex_unlock(&d->usb_mutex); return ret; }