1 /* DVB USB library compliant Linux driver for the Yakumo/Hama/Typhoon DVB-T
4 * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de)
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation, version 2.
10 * see Documentation/dvb/README.dvb-usb for more information
15 int dvb_usb_dtt200u_debug;
16 module_param_named(debug,dvb_usb_dtt200u_debug, int, 0644);
17 MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2 (or-able))." DVB_USB_DEBUG_STATUS);
19 static int dtt200u_streaming_ctrl(struct dvb_usb_device *d, int onoff)
21 u8 b_streaming[2] = { SET_TS_CTRL, onoff };
22 u8 b_rst_pid = RESET_PID_FILTER;
24 dvb_usb_generic_write(d,b_streaming,2);
27 dvb_usb_generic_write(d,&b_rst_pid,1);
31 static int dtt200u_pid_filter(struct dvb_usb_device *d, int index, u16 pid, int onoff)
34 pid = onoff ? pid : 0;
36 b_pid[0] = SET_PID_FILTER;
38 b_pid[2] = pid & 0xff;
39 b_pid[3] = (pid >> 8) & 0xff;
41 return dvb_usb_generic_write(d,b_pid,4);
45 /* key list for the tiny remote control (Yakumo, don't know about the others) */
46 static struct dvb_usb_rc_key dtt200u_rc_keys[] = {
47 { 0x80, 0x01, KEY_MUTE },
48 { 0x80, 0x02, KEY_CHANNELDOWN },
49 { 0x80, 0x03, KEY_VOLUMEDOWN },
50 { 0x80, 0x04, KEY_1 },
51 { 0x80, 0x05, KEY_2 },
52 { 0x80, 0x06, KEY_3 },
53 { 0x80, 0x07, KEY_4 },
54 { 0x80, 0x08, KEY_5 },
55 { 0x80, 0x09, KEY_6 },
56 { 0x80, 0x0a, KEY_7 },
57 { 0x00, 0x0c, KEY_ZOOM },
58 { 0x80, 0x0d, KEY_0 },
59 { 0x00, 0x0e, KEY_SELECT },
60 { 0x80, 0x12, KEY_POWER },
61 { 0x80, 0x1a, KEY_CHANNELUP },
62 { 0x80, 0x1b, KEY_8 },
63 { 0x80, 0x1e, KEY_VOLUMEUP },
64 { 0x80, 0x1f, KEY_9 },
67 static int dtt200u_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
69 u8 key[5],cmd = GET_RC_KEY;
70 dvb_usb_generic_rw(d,&cmd,1,key,5,0);
71 dvb_usb_nec_rc_key_to_event(d,key,event,state);
73 deb_info("key: %x %x %x %x %x\n",key[0],key[1],key[2],key[3],key[4]);
77 static int dtt200u_frontend_attach(struct dvb_usb_device *d)
79 d->fe = dtt200u_fe_attach(d);
83 static struct dvb_usb_properties dtt200u_properties;
85 static int dtt200u_usb_probe(struct usb_interface *intf,
86 const struct usb_device_id *id)
88 return dvb_usb_device_init(intf,&dtt200u_properties,THIS_MODULE);
91 static struct usb_device_id dtt200u_usb_table [] = {
92 { USB_DEVICE(USB_VID_AVERMEDIA_UNK, USB_PID_DTT200U_COLD) },
93 { USB_DEVICE(USB_VID_AVERMEDIA_UNK, USB_PID_DTT200U_WARM) },
96 MODULE_DEVICE_TABLE(usb, dtt200u_usb_table);
98 static struct dvb_usb_properties dtt200u_properties = {
99 .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_NEED_PID_FILTERING,
100 .pid_filter_count = 255, /* It is a guess, but there are at least 10 */
102 .usb_ctrl = CYPRESS_FX2,
103 .firmware = "dvb-usb-dtt200u-01.fw",
105 .streaming_ctrl = dtt200u_streaming_ctrl,
106 .pid_filter = dtt200u_pid_filter,
107 .frontend_attach = dtt200u_frontend_attach,
110 .rc_key_map = dtt200u_rc_keys,
111 .rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys),
112 .rc_query = dtt200u_rc_query,
114 .generic_bulk_ctrl_endpoint = 0x01,
116 /* parameter for the MPEG2-data transfer */
118 .type = DVB_USB_BULK,
128 .num_device_descs = 1,
130 { .name = "Yakumo/Hama/Typhoon DVB-T USB2.0)",
131 .cold_ids = { &dtt200u_usb_table[0], &dtt200u_usb_table[2] },
132 .warm_ids = { &dtt200u_usb_table[1], NULL },
138 /* usb specific object needed to register this driver with the usb subsystem */
139 static struct usb_driver dtt200u_usb_driver = {
140 .owner = THIS_MODULE,
141 .name = "Yakumo/Hama/Typhoon DVB-T USB2.0",
142 .probe = dtt200u_usb_probe,
143 .disconnect = dvb_usb_device_exit,
144 .id_table = dtt200u_usb_table,
148 static int __init dtt200u_usb_module_init(void)
151 if ((result = usb_register(&dtt200u_usb_driver))) {
152 err("usb_register failed. (%d)",result);
159 static void __exit dtt200u_usb_module_exit(void)
161 /* deregister this driver from the USB subsystem */
162 usb_deregister(&dtt200u_usb_driver);
165 module_init(dtt200u_usb_module_init);
166 module_exit(dtt200u_usb_module_exit);
168 MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
169 MODULE_DESCRIPTION("Driver for the Yakumo/Hama/Typhoon DVB-T USB2.0 device");
170 MODULE_VERSION("1.0");
171 MODULE_LICENSE("GPL");