Пример #1
0
static int digitv_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
{
    int i;
    u8 key[5];
    u8 b[4] = { 0 };

    *event = 0;
    *state = REMOTE_NO_KEY_PRESSED;

    digitv_ctrl_msg(d,USB_READ_REMOTE,0,NULL,0,&key[1],4);

    /* Tell the device we've read the remote. Not sure how necessary
       this is, but the Nebula SDK does it. */
    digitv_ctrl_msg(d,USB_WRITE_REMOTE,0,b,4,NULL,0);

    /* if something is inside the buffer, simulate key press */
    if (key[1] != 0)
    {
        for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) {
            if (rc5_custom(&d->props.rc.legacy.rc_map_table[i]) == key[1] &&
                    rc5_data(&d->props.rc.legacy.rc_map_table[i]) == key[2]) {
                *event = d->props.rc.legacy.rc_map_table[i].keycode;
                *state = REMOTE_KEY_PRESSED;
                return 0;
            }
        }
    }

    if (key[0] != 0)
        deb_rc("key: %x %x %x %x %x\n",key[0],key[1],key[2],key[3],key[4]);
    return 0;
}
Пример #2
0
/* I2C */
static int digitv_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num)
{
    struct dvb_usb_device *d = i2c_get_adapdata(adap);
    int i;

    if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
        return -EAGAIN;

    if (num > 2)
        warn("more than 2 i2c messages at a time is not handled yet. TODO.");

    for (i = 0; i < num; i++) {
        /* write/read request */
        if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) {
            if (digitv_ctrl_msg(d, USB_READ_COFDM, msg[i].buf[0], NULL, 0,
                                msg[i+1].buf,msg[i+1].len) < 0)
                break;
            i++;
        } else if (digitv_ctrl_msg(d,USB_WRITE_COFDM, msg[i].buf[0],
                                   &msg[i].buf[1],msg[i].len-1,NULL,0) < 0)
            break;
    }

    mutex_unlock(&d->i2c_mutex);
    return i;
}
Пример #3
0
static int digitv_probe(struct usb_interface *intf,
		const struct usb_device_id *id)
{
	struct dvb_usb_device *d;
	int ret;
	if ((ret = dvb_usb_device_init(intf,&digitv_properties,THIS_MODULE,&d)) == 0) {
		u8 b[4] = { 0 };

		b[0] = 1;
		digitv_ctrl_msg(d,USB_WRITE_REMOTE_TYPE,0,b,4,NULL,0);

		b[0] = 0;
		digitv_ctrl_msg(d,USB_WRITE_REMOTE,0,b,4,NULL,0);
	}
	return ret;
}
Пример #4
0
static int digitv_nxt6000_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
{
	struct dvb_usb_device *d = fe->dvb->priv;
	u8 b[5];
	dvb_usb_pll_set(fe,fep,b);
	return digitv_ctrl_msg(d,USB_WRITE_TUNER,0,&b[1],4,NULL,0);
}
Пример #5
0
static int digitv_probe(struct usb_interface *intf,
                        const struct usb_device_id *id)
{
    struct dvb_usb_device *d;
    int ret;
    if ((ret = dvb_usb_device_init(intf,&digitv_properties,THIS_MODULE,&d)) == 0) {
        u8 b[4] = { 0 };

        if (d != NULL) { /* do that only when the firmware is loaded */
            b[0] = 1;
            digitv_ctrl_msg(d,USB_WRITE_REMOTE_TYPE,0,b,4,NULL,0);

            b[0] = 0;
            digitv_ctrl_msg(d,USB_WRITE_REMOTE,0,b,4,NULL,0);
        }
    }
    return ret;
}
Пример #6
0
static int digitv_nxt6000_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
{
    struct dvb_usb_adapter *adap = fe->dvb->priv;
    u8 b[5];

    fe->ops.tuner_ops.calc_regs(fe, fep, b, sizeof(b));
    if (fe->ops.i2c_gate_ctrl)
        fe->ops.i2c_gate_ctrl(fe, 1);
    return digitv_ctrl_msg(adap->dev, USB_WRITE_TUNER, 0, &b[1], 4, NULL, 0);
}
Пример #7
0
/* TODO is it really the NEC protocol ? */
int digitv_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
{
	u8 key[5];

	digitv_ctrl_msg(d,USB_READ_REMOTE,0,NULL,0,&key[1],4);
	/* TODO state, maybe it is VV ? */
	if (key[1] != 0)
		key[0] = 0x01; /* if something is inside the buffer, simulate key press */

	/* call the universal NEC remote processor, to find out the key's state and event */
	dvb_usb_nec_rc_key_to_event(d,key,event,state);
	if (key[0] != 0)
		deb_rc("key: %x %x %x %x %x\n",key[0],key[1],key[2],key[3],key[4]);
	return 0;
}