2019-05-31 16:09:32 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2005-06-24 13:02:35 +08:00
|
|
|
/* DVB USB framework compliant Linux driver for the Hauppauge WinTV-NOVA-T usb2
|
|
|
|
* DVB-T receiver.
|
|
|
|
*
|
2016-01-24 22:56:58 +08:00
|
|
|
* Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@posteo.de)
|
2005-06-24 13:02:35 +08:00
|
|
|
*
|
2018-05-09 05:29:30 +08:00
|
|
|
* see Documentation/media/dvb-drivers/dvb-usb.rst for more information
|
2005-06-24 13:02:35 +08:00
|
|
|
*/
|
|
|
|
#include "dibusb.h"
|
|
|
|
|
|
|
|
static int debug;
|
|
|
|
module_param(debug, int, 0644);
|
|
|
|
MODULE_PARM_DESC(debug, "set debugging level (1=rc,2=eeprom (|-able))." DVB_USB_DEBUG_STATUS);
|
|
|
|
|
2008-04-10 06:13:13 +08:00
|
|
|
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
|
|
|
|
|
2005-06-24 13:02:35 +08:00
|
|
|
#define deb_rc(args...) dprintk(debug,0x01,args)
|
|
|
|
#define deb_ee(args...) dprintk(debug,0x02,args)
|
|
|
|
|
|
|
|
/* Hauppauge NOVA-T USB2 keys */
|
[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-18 02:46:09 +08:00
|
|
|
static struct rc_map_table rc_map_haupp_table[] = {
|
2009-08-30 02:19:31 +08:00
|
|
|
{ 0x1e00, KEY_0 },
|
|
|
|
{ 0x1e01, KEY_1 },
|
|
|
|
{ 0x1e02, KEY_2 },
|
|
|
|
{ 0x1e03, KEY_3 },
|
|
|
|
{ 0x1e04, KEY_4 },
|
|
|
|
{ 0x1e05, KEY_5 },
|
|
|
|
{ 0x1e06, KEY_6 },
|
|
|
|
{ 0x1e07, KEY_7 },
|
|
|
|
{ 0x1e08, KEY_8 },
|
|
|
|
{ 0x1e09, KEY_9 },
|
|
|
|
{ 0x1e0a, KEY_KPASTERISK },
|
|
|
|
{ 0x1e0b, KEY_RED },
|
|
|
|
{ 0x1e0c, KEY_RADIO },
|
|
|
|
{ 0x1e0d, KEY_MENU },
|
|
|
|
{ 0x1e0e, KEY_GRAVE }, /* # */
|
|
|
|
{ 0x1e0f, KEY_MUTE },
|
|
|
|
{ 0x1e10, KEY_VOLUMEUP },
|
|
|
|
{ 0x1e11, KEY_VOLUMEDOWN },
|
|
|
|
{ 0x1e12, KEY_CHANNEL },
|
|
|
|
{ 0x1e14, KEY_UP },
|
|
|
|
{ 0x1e15, KEY_DOWN },
|
|
|
|
{ 0x1e16, KEY_LEFT },
|
|
|
|
{ 0x1e17, KEY_RIGHT },
|
|
|
|
{ 0x1e18, KEY_VIDEO },
|
|
|
|
{ 0x1e19, KEY_AUDIO },
|
2011-04-06 05:42:30 +08:00
|
|
|
{ 0x1e1a, KEY_IMAGES },
|
2009-08-30 02:19:31 +08:00
|
|
|
{ 0x1e1b, KEY_EPG },
|
|
|
|
{ 0x1e1c, KEY_TV },
|
|
|
|
{ 0x1e1e, KEY_NEXT },
|
|
|
|
{ 0x1e1f, KEY_BACK },
|
|
|
|
{ 0x1e20, KEY_CHANNELUP },
|
|
|
|
{ 0x1e21, KEY_CHANNELDOWN },
|
|
|
|
{ 0x1e24, KEY_LAST }, /* Skip backwards */
|
|
|
|
{ 0x1e25, KEY_OK },
|
|
|
|
{ 0x1e29, KEY_BLUE},
|
|
|
|
{ 0x1e2e, KEY_GREEN },
|
|
|
|
{ 0x1e30, KEY_PAUSE },
|
|
|
|
{ 0x1e32, KEY_REWIND },
|
|
|
|
{ 0x1e34, KEY_FASTFORWARD },
|
|
|
|
{ 0x1e35, KEY_PLAY },
|
|
|
|
{ 0x1e36, KEY_STOP },
|
|
|
|
{ 0x1e37, KEY_RECORD },
|
|
|
|
{ 0x1e38, KEY_YELLOW },
|
|
|
|
{ 0x1e3b, KEY_GOTO },
|
|
|
|
{ 0x1e3d, KEY_POWER },
|
2005-06-24 13:02:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Firmware bug? sometimes, when a new key is pressed, the previous pressed key
|
|
|
|
* is delivered. No workaround yet, maybe a new firmware.
|
|
|
|
*/
|
|
|
|
static int nova_t_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
|
|
|
|
{
|
2016-10-07 22:38:46 +08:00
|
|
|
u8 *buf, data, toggle, custom;
|
2005-06-24 13:02:35 +08:00
|
|
|
u16 raw;
|
2016-10-08 00:50:21 +08:00
|
|
|
int i, ret;
|
2006-10-13 22:33:26 +08:00
|
|
|
struct dibusb_device_state *st = d->priv;
|
2005-06-24 13:02:35 +08:00
|
|
|
|
2016-10-07 22:38:46 +08:00
|
|
|
buf = kmalloc(5, GFP_KERNEL);
|
|
|
|
if (!buf)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
buf[0] = DIBUSB_REQ_POLL_REMOTE;
|
|
|
|
buf[1] = 0x35;
|
2016-10-08 00:50:21 +08:00
|
|
|
ret = dvb_usb_generic_rw(d, buf, 2, buf, 5, 0);
|
|
|
|
if (ret < 0)
|
|
|
|
goto ret;
|
2005-06-24 13:02:35 +08:00
|
|
|
|
|
|
|
*state = REMOTE_NO_KEY_PRESSED;
|
2016-10-07 22:38:46 +08:00
|
|
|
switch (buf[0]) {
|
2005-06-24 13:02:35 +08:00
|
|
|
case DIBUSB_RC_HAUPPAUGE_KEY_PRESSED:
|
2016-10-07 22:38:46 +08:00
|
|
|
raw = ((buf[1] << 8) | buf[2]) >> 3;
|
2005-06-24 13:02:35 +08:00
|
|
|
toggle = !!(raw & 0x800);
|
|
|
|
data = raw & 0x3f;
|
|
|
|
custom = (raw >> 6) & 0x1f;
|
|
|
|
|
2016-10-07 22:38:46 +08:00
|
|
|
deb_rc("raw key code 0x%02x, 0x%02x, 0x%02x to c: %02x d: %02x toggle: %d\n",
|
|
|
|
buf[1], buf[2], buf[3], custom, data, toggle);
|
2005-06-24 13:02:35 +08:00
|
|
|
|
[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-18 02:46:09 +08:00
|
|
|
for (i = 0; i < ARRAY_SIZE(rc_map_haupp_table); i++) {
|
|
|
|
if (rc5_data(&rc_map_haupp_table[i]) == data &&
|
|
|
|
rc5_custom(&rc_map_haupp_table[i]) == custom) {
|
2006-12-11 16:42:36 +08:00
|
|
|
|
[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-18 02:46:09 +08:00
|
|
|
deb_rc("c: %x, d: %x\n", rc5_data(&rc_map_haupp_table[i]),
|
|
|
|
rc5_custom(&rc_map_haupp_table[i]));
|
2006-12-11 16:42:36 +08:00
|
|
|
|
[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-18 02:46:09 +08:00
|
|
|
*event = rc_map_haupp_table[i].keycode;
|
2005-06-24 13:02:35 +08:00
|
|
|
*state = REMOTE_KEY_PRESSED;
|
|
|
|
if (st->old_toggle == toggle) {
|
|
|
|
if (st->last_repeat_count++ < 2)
|
|
|
|
*state = REMOTE_NO_KEY_PRESSED;
|
|
|
|
} else {
|
|
|
|
st->last_repeat_count = 0;
|
|
|
|
st->old_toggle = toggle;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
case DIBUSB_RC_HAUPPAUGE_KEY_EMPTY:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-10-08 00:50:21 +08:00
|
|
|
ret:
|
2016-10-07 22:38:46 +08:00
|
|
|
kfree(buf);
|
2016-10-08 00:50:21 +08:00
|
|
|
return ret;
|
2005-06-24 13:02:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int nova_t_read_mac_address (struct dvb_usb_device *d, u8 mac[6])
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
u8 b;
|
|
|
|
|
|
|
|
mac[0] = 0x00;
|
|
|
|
mac[1] = 0x0d;
|
|
|
|
mac[2] = 0xfe;
|
|
|
|
|
|
|
|
/* this is a complete guess, but works for my box */
|
|
|
|
for (i = 136; i < 139; i++) {
|
|
|
|
dibusb_read_eeprom_byte(d,i, &b);
|
|
|
|
|
|
|
|
mac[5 - (i - 136)] = b;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* USB Driver stuff */
|
2006-09-30 17:53:48 +08:00
|
|
|
static struct dvb_usb_device_properties nova_t_properties;
|
2005-06-24 13:02:35 +08:00
|
|
|
|
|
|
|
static int nova_t_probe(struct usb_interface *intf,
|
|
|
|
const struct usb_device_id *id)
|
|
|
|
{
|
2008-04-10 06:13:13 +08:00
|
|
|
return dvb_usb_device_init(intf, &nova_t_properties,
|
|
|
|
THIS_MODULE, NULL, adapter_nr);
|
2005-06-24 13:02:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* do not change the order of the ID table */
|
|
|
|
static struct usb_device_id nova_t_table [] = {
|
|
|
|
/* 00 */ { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_WINTV_NOVA_T_USB2_COLD) },
|
|
|
|
/* 01 */ { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_WINTV_NOVA_T_USB2_WARM) },
|
|
|
|
{ } /* Terminating entry */
|
|
|
|
};
|
2006-01-10 04:21:35 +08:00
|
|
|
MODULE_DEVICE_TABLE(usb, nova_t_table);
|
2005-06-24 13:02:35 +08:00
|
|
|
|
2006-09-30 17:53:48 +08:00
|
|
|
static struct dvb_usb_device_properties nova_t_properties = {
|
|
|
|
.caps = DVB_USB_IS_AN_I2C_ADAPTER,
|
2005-06-24 13:02:35 +08:00
|
|
|
|
|
|
|
.usb_ctrl = CYPRESS_FX2,
|
2006-07-30 05:24:21 +08:00
|
|
|
.firmware = "dvb-usb-nova-t-usb2-02.fw",
|
2005-06-24 13:02:35 +08:00
|
|
|
|
2006-09-30 17:53:48 +08:00
|
|
|
.num_adapters = 1,
|
|
|
|
.adapter = {
|
|
|
|
{
|
2011-09-06 20:31:57 +08:00
|
|
|
.num_frontends = 1,
|
|
|
|
.fe = {{
|
2006-09-30 17:53:48 +08:00
|
|
|
.caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
|
|
|
|
.pid_filter_count = 32,
|
2005-06-24 13:02:35 +08:00
|
|
|
|
2006-10-13 22:34:46 +08:00
|
|
|
.streaming_ctrl = dibusb2_0_streaming_ctrl,
|
|
|
|
.pid_filter = dibusb_pid_filter,
|
|
|
|
.pid_filter_ctrl = dibusb_pid_filter_ctrl,
|
|
|
|
.frontend_attach = dibusb_dib3000mc_frontend_attach,
|
|
|
|
.tuner_attach = dibusb_dib3000mc_tuner_attach,
|
|
|
|
|
|
|
|
/* parameter for the MPEG2-data transfer */
|
|
|
|
.stream = {
|
|
|
|
.type = USB_BULK,
|
|
|
|
.count = 7,
|
|
|
|
.endpoint = 0x06,
|
|
|
|
.u = {
|
|
|
|
.bulk = {
|
|
|
|
.buffersize = 4096,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2011-09-06 20:31:57 +08:00
|
|
|
}},
|
2006-09-30 17:53:48 +08:00
|
|
|
.size_of_priv = sizeof(struct dibusb_state),
|
|
|
|
}
|
|
|
|
},
|
2006-10-13 22:33:26 +08:00
|
|
|
.size_of_priv = sizeof(struct dibusb_device_state),
|
2006-09-30 17:53:48 +08:00
|
|
|
|
|
|
|
.power_ctrl = dibusb2_0_power_ctrl,
|
|
|
|
.read_mac_address = nova_t_read_mac_address,
|
|
|
|
|
2010-08-01 05:04:09 +08:00
|
|
|
.rc.legacy = {
|
|
|
|
.rc_interval = 100,
|
[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-18 02:46:09 +08:00
|
|
|
.rc_map_table = rc_map_haupp_table,
|
|
|
|
.rc_map_size = ARRAY_SIZE(rc_map_haupp_table),
|
2010-08-01 05:04:09 +08:00
|
|
|
.rc_query = nova_t_rc_query,
|
|
|
|
},
|
2006-09-30 17:53:48 +08:00
|
|
|
|
|
|
|
.i2c_algo = &dibusb_i2c_algo,
|
|
|
|
|
|
|
|
.generic_bulk_ctrl_endpoint = 0x01,
|
|
|
|
|
2005-06-24 13:02:35 +08:00
|
|
|
.num_device_descs = 1,
|
|
|
|
.devices = {
|
|
|
|
{ "Hauppauge WinTV-NOVA-T usb2",
|
|
|
|
{ &nova_t_table[0], NULL },
|
|
|
|
{ &nova_t_table[1], NULL },
|
|
|
|
},
|
2006-01-10 04:21:35 +08:00
|
|
|
{ NULL },
|
2005-06-24 13:02:35 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct usb_driver nova_t_driver = {
|
2005-07-08 08:58:30 +08:00
|
|
|
.name = "dvb_usb_nova_t_usb2",
|
2005-06-24 13:02:35 +08:00
|
|
|
.probe = nova_t_probe,
|
|
|
|
.disconnect = dvb_usb_device_exit,
|
|
|
|
.id_table = nova_t_table,
|
|
|
|
};
|
|
|
|
|
2011-11-19 01:46:12 +08:00
|
|
|
module_usb_driver(nova_t_driver);
|
2005-06-24 13:02:35 +08:00
|
|
|
|
2016-01-24 22:56:58 +08:00
|
|
|
MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@posteo.de>");
|
2005-06-24 13:02:35 +08:00
|
|
|
MODULE_DESCRIPTION("Hauppauge WinTV-NOVA-T usb2");
|
|
|
|
MODULE_VERSION("1.0");
|
|
|
|
MODULE_LICENSE("GPL");
|