2005-09-09 20:02:41 +00:00
|
|
|
/* DVB USB compliant Linux driver for the TwinhanDTV StarBox USB2.0 DVB-S
|
|
|
|
* receiver.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005 Ralph Metzler <rjkm@metzlerbros.de>
|
|
|
|
* Metzler Brothers Systementwicklung GbR
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005 Patrick Boettcher <patrick.boettcher@desy.de>
|
|
|
|
*
|
|
|
|
* Thanks to Twinhan who kindly provided hardware and information.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the Free
|
|
|
|
* Software Foundation, version 2.
|
|
|
|
*
|
|
|
|
* see Documentation/dvb/README.dvb-usb for more information
|
|
|
|
*/
|
|
|
|
#include "vp702x.h"
|
2011-03-21 10:19:08 +00:00
|
|
|
#include <linux/mutex.h>
|
2005-09-09 20:02:41 +00:00
|
|
|
|
|
|
|
/* debug */
|
|
|
|
int dvb_usb_vp702x_debug;
|
|
|
|
module_param_named(debug,dvb_usb_vp702x_debug, int, 0644);
|
|
|
|
MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS);
|
|
|
|
|
2008-04-09 22:13:13 +00:00
|
|
|
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
|
|
|
|
|
2011-03-21 10:19:07 +00:00
|
|
|
struct vp702x_adapter_state {
|
2006-09-19 15:51:43 +00:00
|
|
|
int pid_filter_count;
|
|
|
|
int pid_filter_can_bypass;
|
|
|
|
u8 pid_filter_state;
|
|
|
|
};
|
|
|
|
|
2011-03-21 10:19:11 +00:00
|
|
|
static int vp702x_usb_in_op_unlocked(struct dvb_usb_device *d, u8 req,
|
|
|
|
u16 value, u16 index, u8 *b, int blen)
|
2005-09-09 20:02:41 +00:00
|
|
|
{
|
2011-03-21 10:19:06 +00:00
|
|
|
int ret;
|
2005-09-09 20:02:41 +00:00
|
|
|
|
2011-03-21 10:19:06 +00:00
|
|
|
ret = usb_control_msg(d->udev,
|
|
|
|
usb_rcvctrlpipe(d->udev, 0),
|
|
|
|
req,
|
|
|
|
USB_TYPE_VENDOR | USB_DIR_IN,
|
|
|
|
value, index, b, blen,
|
|
|
|
2000);
|
2005-09-09 20:02:41 +00:00
|
|
|
|
2006-09-19 15:51:43 +00:00
|
|
|
if (ret < 0) {
|
|
|
|
warn("usb in operation failed. (%d)", ret);
|
2005-09-09 20:02:41 +00:00
|
|
|
ret = -EIO;
|
|
|
|
} else
|
|
|
|
ret = 0;
|
|
|
|
|
2006-09-19 15:51:43 +00:00
|
|
|
|
|
|
|
deb_xfer("in: req. %02x, val: %04x, ind: %04x, buffer: ",req,value,index);
|
2005-09-09 20:02:41 +00:00
|
|
|
debug_dump(b,blen,deb_xfer);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-03-21 10:19:11 +00:00
|
|
|
int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value,
|
|
|
|
u16 index, u8 *b, int blen)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
mutex_lock(&d->usb_mutex);
|
|
|
|
ret = vp702x_usb_in_op_unlocked(d, req, value, index, b, blen);
|
|
|
|
mutex_unlock(&d->usb_mutex);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
int vp702x_usb_out_op_unlocked(struct dvb_usb_device *d, u8 req, u16 value,
|
|
|
|
u16 index, u8 *b, int blen)
|
2005-09-09 20:02:41 +00:00
|
|
|
{
|
2006-09-19 15:51:43 +00:00
|
|
|
int ret;
|
|
|
|
deb_xfer("out: req. %02x, val: %04x, ind: %04x, buffer: ",req,value,index);
|
2005-09-09 20:02:41 +00:00
|
|
|
debug_dump(b,blen,deb_xfer);
|
|
|
|
|
2006-09-19 15:51:43 +00:00
|
|
|
if ((ret = usb_control_msg(d->udev,
|
2005-09-09 20:02:41 +00:00
|
|
|
usb_sndctrlpipe(d->udev,0),
|
|
|
|
req,
|
|
|
|
USB_TYPE_VENDOR | USB_DIR_OUT,
|
|
|
|
value,index,b,blen,
|
2006-09-19 15:51:43 +00:00
|
|
|
2000)) != blen) {
|
|
|
|
warn("usb out operation failed. (%d)",ret);
|
2005-09-09 20:02:41 +00:00
|
|
|
return -EIO;
|
|
|
|
} else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-03-21 10:19:11 +00:00
|
|
|
int vp702x_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value,
|
|
|
|
u16 index, u8 *b, int blen)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
mutex_lock(&d->usb_mutex);
|
|
|
|
ret = vp702x_usb_out_op_unlocked(d, req, value, index, b, blen);
|
|
|
|
mutex_unlock(&d->usb_mutex);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-09-09 20:02:41 +00:00
|
|
|
int vp702x_usb_inout_op(struct dvb_usb_device *d, u8 *o, int olen, u8 *i, int ilen, int msec)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
2006-02-07 08:49:14 +00:00
|
|
|
if ((ret = mutex_lock_interruptible(&d->usb_mutex)))
|
2005-09-09 20:02:41 +00:00
|
|
|
return ret;
|
|
|
|
|
2011-03-21 10:19:11 +00:00
|
|
|
ret = vp702x_usb_out_op_unlocked(d, REQUEST_OUT, 0, 0, o, olen);
|
2005-09-09 20:02:41 +00:00
|
|
|
msleep(msec);
|
2011-03-21 10:19:11 +00:00
|
|
|
ret = vp702x_usb_in_op_unlocked(d, REQUEST_IN, 0, 0, i, ilen);
|
2005-09-09 20:02:41 +00:00
|
|
|
|
2006-02-07 08:49:14 +00:00
|
|
|
mutex_unlock(&d->usb_mutex);
|
2005-09-09 20:02:41 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2006-01-23 19:11:09 +00:00
|
|
|
static int vp702x_usb_inout_cmd(struct dvb_usb_device *d, u8 cmd, u8 *o,
|
|
|
|
int olen, u8 *i, int ilen, int msec)
|
2005-09-09 20:02:41 +00:00
|
|
|
{
|
2011-03-21 10:19:13 +00:00
|
|
|
struct vp702x_device_state *st = d->priv;
|
2005-09-09 20:02:41 +00:00
|
|
|
int ret = 0;
|
2011-03-21 10:19:10 +00:00
|
|
|
u8 *buf;
|
|
|
|
int buflen = max(olen + 2, ilen + 1);
|
2005-09-09 20:02:41 +00:00
|
|
|
|
2011-03-21 10:19:13 +00:00
|
|
|
ret = mutex_lock_interruptible(&st->buf_mutex);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
if (buflen > st->buf_len) {
|
|
|
|
buf = kmalloc(buflen, GFP_KERNEL);
|
|
|
|
if (!buf) {
|
|
|
|
mutex_unlock(&st->buf_mutex);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
info("successfully reallocated a bigger buffer");
|
|
|
|
kfree(st->buf);
|
|
|
|
st->buf = buf;
|
|
|
|
st->buf_len = buflen;
|
|
|
|
} else {
|
|
|
|
buf = st->buf;
|
|
|
|
}
|
2005-09-09 20:02:41 +00:00
|
|
|
|
2011-03-21 10:19:10 +00:00
|
|
|
buf[0] = 0x00;
|
|
|
|
buf[1] = cmd;
|
|
|
|
memcpy(&buf[2], o, olen);
|
|
|
|
|
|
|
|
ret = vp702x_usb_inout_op(d, buf, olen+2, buf, ilen+1, msec);
|
2005-09-09 20:02:41 +00:00
|
|
|
|
|
|
|
if (ret == 0)
|
2011-03-21 10:19:10 +00:00
|
|
|
memcpy(i, &buf[1], ilen);
|
2011-03-21 10:19:13 +00:00
|
|
|
mutex_unlock(&st->buf_mutex);
|
2005-09-09 20:02:41 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2006-09-19 15:51:43 +00:00
|
|
|
static int vp702x_set_pld_mode(struct dvb_usb_adapter *adap, u8 bypass)
|
|
|
|
{
|
2011-03-21 10:19:10 +00:00
|
|
|
int ret;
|
2011-03-21 10:19:12 +00:00
|
|
|
struct vp702x_device_state *st = adap->dev->priv;
|
|
|
|
u8 *buf;
|
|
|
|
|
|
|
|
mutex_lock(&st->buf_mutex);
|
|
|
|
|
|
|
|
buf = st->buf;
|
|
|
|
memset(buf, 0, 16);
|
2011-03-21 10:19:10 +00:00
|
|
|
|
|
|
|
ret = vp702x_usb_in_op(adap->dev, 0xe0, (bypass << 8) | 0x0e,
|
|
|
|
0, buf, 16);
|
2011-03-21 10:19:12 +00:00
|
|
|
mutex_unlock(&st->buf_mutex);
|
2011-03-21 10:19:10 +00:00
|
|
|
return ret;
|
2006-09-19 15:51:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int vp702x_set_pld_state(struct dvb_usb_adapter *adap, u8 state)
|
|
|
|
{
|
2011-03-21 10:19:10 +00:00
|
|
|
int ret;
|
2011-03-21 10:19:12 +00:00
|
|
|
struct vp702x_device_state *st = adap->dev->priv;
|
|
|
|
u8 *buf;
|
|
|
|
|
|
|
|
mutex_lock(&st->buf_mutex);
|
2011-03-21 10:19:10 +00:00
|
|
|
|
2011-03-21 10:19:12 +00:00
|
|
|
buf = st->buf;
|
|
|
|
memset(buf, 0, 16);
|
2011-03-21 10:19:10 +00:00
|
|
|
ret = vp702x_usb_in_op(adap->dev, 0xe0, (state << 8) | 0x0f,
|
|
|
|
0, buf, 16);
|
2011-03-21 10:19:12 +00:00
|
|
|
|
|
|
|
mutex_unlock(&st->buf_mutex);
|
|
|
|
|
2011-03-21 10:19:10 +00:00
|
|
|
return ret;
|
2006-09-19 15:51:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int vp702x_set_pid(struct dvb_usb_adapter *adap, u16 pid, u8 id, int onoff)
|
2005-09-09 20:02:41 +00:00
|
|
|
{
|
2011-03-21 10:19:07 +00:00
|
|
|
struct vp702x_adapter_state *st = adap->priv;
|
2011-03-21 10:19:12 +00:00
|
|
|
struct vp702x_device_state *dst = adap->dev->priv;
|
2011-03-21 10:19:10 +00:00
|
|
|
u8 *buf;
|
|
|
|
|
2006-09-19 15:51:43 +00:00
|
|
|
if (onoff)
|
|
|
|
st->pid_filter_state |= (1 << id);
|
|
|
|
else {
|
|
|
|
st->pid_filter_state &= ~(1 << id);
|
|
|
|
pid = 0xffff;
|
2005-09-09 20:02:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-19 15:51:43 +00:00
|
|
|
id = 0x10 + id*2;
|
|
|
|
|
|
|
|
vp702x_set_pld_state(adap, st->pid_filter_state);
|
2011-03-21 10:19:12 +00:00
|
|
|
|
|
|
|
mutex_lock(&dst->buf_mutex);
|
|
|
|
|
|
|
|
buf = dst->buf;
|
|
|
|
memset(buf, 0, 16);
|
2006-09-19 15:51:43 +00:00
|
|
|
vp702x_usb_in_op(adap->dev, 0xe0, (((pid >> 8) & 0xff) << 8) | (id), 0, buf, 16);
|
|
|
|
vp702x_usb_in_op(adap->dev, 0xe0, (((pid ) & 0xff) << 8) | (id+1), 0, buf, 16);
|
2011-03-21 10:19:10 +00:00
|
|
|
|
2011-03-21 10:19:12 +00:00
|
|
|
mutex_unlock(&dst->buf_mutex);
|
|
|
|
|
2006-09-19 15:51:43 +00:00
|
|
|
return 0;
|
2005-09-09 20:02:41 +00:00
|
|
|
}
|
|
|
|
|
2006-09-19 15:51:43 +00:00
|
|
|
|
|
|
|
static int vp702x_init_pid_filter(struct dvb_usb_adapter *adap)
|
2005-09-09 20:02:41 +00:00
|
|
|
{
|
2011-03-21 10:19:07 +00:00
|
|
|
struct vp702x_adapter_state *st = adap->priv;
|
2011-03-21 10:19:12 +00:00
|
|
|
struct vp702x_device_state *dst = adap->dev->priv;
|
2006-09-19 15:51:43 +00:00
|
|
|
int i;
|
2011-03-21 10:19:10 +00:00
|
|
|
u8 *b;
|
|
|
|
|
2006-09-19 15:51:43 +00:00
|
|
|
st->pid_filter_count = 8;
|
|
|
|
st->pid_filter_can_bypass = 1;
|
|
|
|
st->pid_filter_state = 0x00;
|
|
|
|
|
2011-03-21 10:19:10 +00:00
|
|
|
vp702x_set_pld_mode(adap, 1); /* bypass */
|
2006-09-19 15:51:43 +00:00
|
|
|
|
|
|
|
for (i = 0; i < st->pid_filter_count; i++)
|
|
|
|
vp702x_set_pid(adap, 0xffff, i, 1);
|
|
|
|
|
2011-03-21 10:19:12 +00:00
|
|
|
mutex_lock(&dst->buf_mutex);
|
|
|
|
b = dst->buf;
|
|
|
|
memset(b, 0, 10);
|
2006-09-19 15:51:43 +00:00
|
|
|
vp702x_usb_in_op(adap->dev, 0xb5, 3, 0, b, 10);
|
|
|
|
vp702x_usb_in_op(adap->dev, 0xb5, 0, 0, b, 10);
|
|
|
|
vp702x_usb_in_op(adap->dev, 0xb5, 1, 0, b, 10);
|
2011-03-21 10:19:12 +00:00
|
|
|
mutex_unlock(&dst->buf_mutex);
|
|
|
|
/*vp702x_set_pld_mode(d, 0); // filter */
|
2006-09-19 15:51:43 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int vp702x_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
|
|
|
|
{
|
|
|
|
return 0;
|
2005-09-09 20:02:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* keys for the enclosed remote control */
|
[media] rc: Name RC keymap tables as rc_map_table
Remote keytables had different names all over the place. Part of the fault
is due to a bad naming when rc subsystem was created, but there were lots
of old names that were still here.
Use a common standard for everything.
Patch generated by this script:
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,ir_scancode,rc_map_table,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,ir_codes_,rc_map_,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,rc_key_map,rc_map_table,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,rc_map_table_size,rc_map_size,g <$i >a && mv a $i; done
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-11-17 18:46:09 +00:00
|
|
|
static struct rc_map_table rc_map_vp702x_table[] = {
|
2009-08-29 18:19:31 +00:00
|
|
|
{ 0x0001, KEY_1 },
|
|
|
|
{ 0x0002, KEY_2 },
|
2005-09-09 20:02:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* remote control stuff (does not work with my box) */
|
|
|
|
static int vp702x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
|
|
|
|
{
|
2011-03-21 10:19:10 +00:00
|
|
|
u8 *key;
|
2005-09-09 20:02:41 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
/* remove the following return to enabled remote querying */
|
|
|
|
return 0;
|
|
|
|
|
2011-03-21 10:19:10 +00:00
|
|
|
key = kmalloc(10, GFP_KERNEL);
|
|
|
|
if (!key)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
2005-09-09 20:02:41 +00:00
|
|
|
vp702x_usb_in_op(d,READ_REMOTE_REQ,0,0,key,10);
|
|
|
|
|
|
|
|
deb_rc("remote query key: %x %d\n",key[1],key[1]);
|
|
|
|
|
|
|
|
if (key[1] == 0x44) {
|
|
|
|
*state = REMOTE_NO_KEY_PRESSED;
|
2011-03-21 10:19:10 +00:00
|
|
|
kfree(key);
|
2005-09-09 20:02:41 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
[media] rc: Name RC keymap tables as rc_map_table
Remote keytables had different names all over the place. Part of the fault
is due to a bad naming when rc subsystem was created, but there were lots
of old names that were still here.
Use a common standard for everything.
Patch generated by this script:
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,ir_scancode,rc_map_table,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,ir_codes_,rc_map_,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,rc_key_map,rc_map_table,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,rc_map_table_size,rc_map_size,g <$i >a && mv a $i; done
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-11-17 18:46:09 +00:00
|
|
|
for (i = 0; i < ARRAY_SIZE(rc_map_vp702x_table); i++)
|
|
|
|
if (rc5_custom(&rc_map_vp702x_table[i]) == key[1]) {
|
2005-09-09 20:02:41 +00:00
|
|
|
*state = REMOTE_KEY_PRESSED;
|
[media] rc: Name RC keymap tables as rc_map_table
Remote keytables had different names all over the place. Part of the fault
is due to a bad naming when rc subsystem was created, but there were lots
of old names that were still here.
Use a common standard for everything.
Patch generated by this script:
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,ir_scancode,rc_map_table,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,ir_codes_,rc_map_,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,rc_key_map,rc_map_table,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,rc_map_table_size,rc_map_size,g <$i >a && mv a $i; done
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-11-17 18:46:09 +00:00
|
|
|
*event = rc_map_vp702x_table[i].keycode;
|
2005-09-09 20:02:41 +00:00
|
|
|
break;
|
|
|
|
}
|
2011-03-21 10:19:10 +00:00
|
|
|
kfree(key);
|
2005-09-09 20:02:41 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-09-19 15:51:43 +00:00
|
|
|
|
2005-09-09 20:02:41 +00:00
|
|
|
static int vp702x_read_mac_addr(struct dvb_usb_device *d,u8 mac[6])
|
|
|
|
{
|
2011-03-21 10:19:10 +00:00
|
|
|
u8 i, *buf;
|
2011-03-21 10:19:12 +00:00
|
|
|
struct vp702x_device_state *st = d->priv;
|
2011-03-21 10:19:10 +00:00
|
|
|
|
2011-03-21 10:19:12 +00:00
|
|
|
mutex_lock(&st->buf_mutex);
|
|
|
|
buf = st->buf;
|
2006-09-19 15:51:43 +00:00
|
|
|
for (i = 6; i < 12; i++)
|
2011-03-21 10:19:10 +00:00
|
|
|
vp702x_usb_in_op(d, READ_EEPROM_REQ, i, 1, &buf[i - 6], 1);
|
|
|
|
|
|
|
|
memcpy(mac, buf, 6);
|
2011-03-21 10:19:12 +00:00
|
|
|
mutex_unlock(&st->buf_mutex);
|
2005-09-09 20:02:41 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-09-30 09:53:48 +00:00
|
|
|
static int vp702x_frontend_attach(struct dvb_usb_adapter *adap)
|
2005-09-09 20:02:41 +00:00
|
|
|
{
|
2006-09-19 15:51:43 +00:00
|
|
|
u8 buf[10] = { 0 };
|
|
|
|
|
|
|
|
vp702x_usb_out_op(adap->dev, SET_TUNER_POWER_REQ, 0, 7, NULL, 0);
|
2005-09-09 20:02:41 +00:00
|
|
|
|
2011-03-21 10:19:06 +00:00
|
|
|
if (vp702x_usb_inout_cmd(adap->dev, GET_SYSTEM_STRING, NULL, 0,
|
|
|
|
buf, 10, 10))
|
2005-09-09 20:02:41 +00:00
|
|
|
return -EIO;
|
|
|
|
|
2006-09-19 15:51:43 +00:00
|
|
|
buf[9] = '\0';
|
2005-09-09 20:02:41 +00:00
|
|
|
info("system string: %s",&buf[1]);
|
|
|
|
|
2006-09-19 15:51:43 +00:00
|
|
|
vp702x_init_pid_filter(adap);
|
|
|
|
|
2011-09-06 12:31:57 +00:00
|
|
|
adap->fe_adap[0].fe = vp702x_fe_attach(adap->dev);
|
2006-09-19 15:51:43 +00:00
|
|
|
vp702x_usb_out_op(adap->dev, SET_TUNER_POWER_REQ, 1, 7, NULL, 0);
|
|
|
|
|
2005-09-09 20:02:41 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-09-30 09:53:48 +00:00
|
|
|
static struct dvb_usb_device_properties vp702x_properties;
|
2005-09-09 20:02:41 +00:00
|
|
|
|
|
|
|
static int vp702x_usb_probe(struct usb_interface *intf,
|
|
|
|
const struct usb_device_id *id)
|
|
|
|
{
|
2011-03-21 10:19:08 +00:00
|
|
|
struct dvb_usb_device *d;
|
|
|
|
struct vp702x_device_state *st;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = dvb_usb_device_init(intf, &vp702x_properties,
|
|
|
|
THIS_MODULE, &d, adapter_nr);
|
|
|
|
if (ret)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
st = d->priv;
|
|
|
|
st->buf_len = 16;
|
|
|
|
st->buf = kmalloc(st->buf_len, GFP_KERNEL);
|
|
|
|
if (!st->buf) {
|
|
|
|
ret = -ENOMEM;
|
|
|
|
dvb_usb_device_exit(intf);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
mutex_init(&st->buf_mutex);
|
|
|
|
|
|
|
|
out:
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void vp702x_usb_disconnect(struct usb_interface *intf)
|
|
|
|
{
|
|
|
|
struct dvb_usb_device *d = usb_get_intfdata(intf);
|
|
|
|
struct vp702x_device_state *st = d->priv;
|
|
|
|
mutex_lock(&st->buf_mutex);
|
|
|
|
kfree(st->buf);
|
|
|
|
mutex_unlock(&st->buf_mutex);
|
|
|
|
dvb_usb_device_exit(intf);
|
2005-09-09 20:02:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct usb_device_id vp702x_usb_table [] = {
|
|
|
|
{ USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7021_COLD) },
|
2006-09-19 15:51:43 +00:00
|
|
|
// { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7020_COLD) },
|
|
|
|
// { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7020_WARM) },
|
2005-09-09 20:02:41 +00:00
|
|
|
{ 0 },
|
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(usb, vp702x_usb_table);
|
|
|
|
|
2006-09-30 09:53:48 +00:00
|
|
|
static struct dvb_usb_device_properties vp702x_properties = {
|
2005-09-09 20:02:41 +00:00
|
|
|
.usb_ctrl = CYPRESS_FX2,
|
2006-09-19 15:51:43 +00:00
|
|
|
.firmware = "dvb-usb-vp702x-02.fw",
|
|
|
|
.no_reconnect = 1,
|
|
|
|
|
|
|
|
.size_of_priv = sizeof(struct vp702x_device_state),
|
2005-09-09 20:02:41 +00:00
|
|
|
|
2006-09-30 09:53:48 +00:00
|
|
|
.num_adapters = 1,
|
|
|
|
.adapter = {
|
|
|
|
{
|
2011-09-06 12:31:57 +00:00
|
|
|
.num_frontends = 1,
|
|
|
|
.fe = {{
|
2006-09-19 15:51:43 +00:00
|
|
|
.caps = DVB_USB_ADAP_RECEIVES_204_BYTE_TS,
|
2006-09-30 09:53:48 +00:00
|
|
|
|
2006-09-19 15:51:43 +00:00
|
|
|
.streaming_ctrl = vp702x_streaming_ctrl,
|
2006-10-13 14:34:46 +00:00
|
|
|
.frontend_attach = vp702x_frontend_attach,
|
2006-09-19 15:51:43 +00:00
|
|
|
|
2006-10-13 14:34:46 +00:00
|
|
|
/* parameter for the MPEG2-data transfer */
|
2006-09-30 09:53:48 +00:00
|
|
|
.stream = {
|
|
|
|
.type = USB_BULK,
|
2006-09-19 15:51:43 +00:00
|
|
|
.count = 10,
|
2006-10-13 14:34:46 +00:00
|
|
|
.endpoint = 0x02,
|
|
|
|
.u = {
|
|
|
|
.bulk = {
|
|
|
|
.buffersize = 4096,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2011-09-06 12:31:57 +00:00
|
|
|
}},
|
2011-03-21 10:19:07 +00:00
|
|
|
.size_of_priv = sizeof(struct vp702x_adapter_state),
|
2006-09-19 15:51:43 +00:00
|
|
|
}
|
2006-10-13 14:34:46 +00:00
|
|
|
},
|
2006-09-30 09:53:48 +00:00
|
|
|
.read_mac_address = vp702x_read_mac_addr,
|
|
|
|
|
2010-07-31 21:04:09 +00:00
|
|
|
.rc.legacy = {
|
[media] rc: Name RC keymap tables as rc_map_table
Remote keytables had different names all over the place. Part of the fault
is due to a bad naming when rc subsystem was created, but there were lots
of old names that were still here.
Use a common standard for everything.
Patch generated by this script:
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,ir_scancode,rc_map_table,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,ir_codes_,rc_map_,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,rc_key_map,rc_map_table,g <$i >a && mv a $i; done
for i in `find drivers/staging -type f -name *.[ch]` `find include/media -type f -name *.[ch]` `find drivers/media -type f -name *.[ch]`; do sed s,rc_map_table_size,rc_map_size,g <$i >a && mv a $i; done
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-11-17 18:46:09 +00:00
|
|
|
.rc_map_table = rc_map_vp702x_table,
|
|
|
|
.rc_map_size = ARRAY_SIZE(rc_map_vp702x_table),
|
2010-07-31 21:04:09 +00:00
|
|
|
.rc_interval = 400,
|
|
|
|
.rc_query = vp702x_rc_query,
|
|
|
|
},
|
2005-09-09 20:02:41 +00:00
|
|
|
|
2006-09-19 15:51:43 +00:00
|
|
|
.num_device_descs = 1,
|
2005-09-09 20:02:41 +00:00
|
|
|
.devices = {
|
|
|
|
{ .name = "TwinhanDTV StarBox DVB-S USB2.0 (VP7021)",
|
|
|
|
.cold_ids = { &vp702x_usb_table[0], NULL },
|
2006-09-19 15:51:43 +00:00
|
|
|
.warm_ids = { NULL },
|
2005-09-09 20:02:41 +00:00
|
|
|
},
|
2006-09-19 15:51:43 +00:00
|
|
|
/* { .name = "TwinhanDTV StarBox DVB-S USB2.0 (VP7020)",
|
2005-09-09 20:02:41 +00:00
|
|
|
.cold_ids = { &vp702x_usb_table[2], NULL },
|
|
|
|
.warm_ids = { &vp702x_usb_table[3], NULL },
|
|
|
|
},
|
2006-09-19 15:51:43 +00:00
|
|
|
*/ { NULL },
|
2005-09-09 20:02:41 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/* usb specific object needed to register this driver with the usb subsystem */
|
|
|
|
static struct usb_driver vp702x_usb_driver = {
|
2006-09-19 15:51:43 +00:00
|
|
|
.name = "dvb_usb_vp702x",
|
2011-03-21 10:19:06 +00:00
|
|
|
.probe = vp702x_usb_probe,
|
2011-03-21 10:19:08 +00:00
|
|
|
.disconnect = vp702x_usb_disconnect,
|
2011-03-21 10:19:06 +00:00
|
|
|
.id_table = vp702x_usb_table,
|
2005-09-09 20:02:41 +00:00
|
|
|
};
|
|
|
|
|
2011-11-18 17:46:12 +00:00
|
|
|
module_usb_driver(vp702x_usb_driver);
|
2005-09-09 20:02:41 +00:00
|
|
|
|
|
|
|
MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
|
|
|
|
MODULE_DESCRIPTION("Driver for Twinhan StarBox DVB-S USB2.0 and clones");
|
2006-09-19 15:51:43 +00:00
|
|
|
MODULE_VERSION("1.0");
|
2005-09-09 20:02:41 +00:00
|
|
|
MODULE_LICENSE("GPL");
|