1 /* DVB USB library compliant Linux driver for the WideView/ Yakumo/ Hama/
2 * Typhoon/ Yuan/ Miglia DVB-T USB2.0 receiver.
4 * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@posteo.de)
6 * Thanks to Steve Chang from WideView for providing support for the WT-220U.
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the Free
10 * Software Foundation, version 2.
12 * see Documentation/dvb/README.dvb-usb for more information
17 int dvb_usb_dtt200u_debug;
18 module_param_named(debug,dvb_usb_dtt200u_debug, int, 0644);
19 MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2 (or-able))." DVB_USB_DEBUG_STATUS);
21 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
23 static int dtt200u_power_ctrl(struct dvb_usb_device *d, int onoff)
28 dvb_usb_generic_write(d,&b,2);
33 static int dtt200u_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
35 u8 b_streaming[2] = { SET_STREAMING, onoff };
36 u8 b_rst_pid = RESET_PID_FILTER;
38 dvb_usb_generic_write(adap->dev, b_streaming, 2);
41 dvb_usb_generic_write(adap->dev, &b_rst_pid, 1);
45 static int dtt200u_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff)
48 pid = onoff ? pid : 0;
50 b_pid[0] = SET_PID_FILTER;
52 b_pid[2] = pid & 0xff;
53 b_pid[3] = (pid >> 8) & 0x1f;
55 return dvb_usb_generic_write(adap->dev, b_pid, 4);
58 static int dtt200u_rc_query(struct dvb_usb_device *d)
60 u8 key[5],cmd = GET_RC_CODE;
63 dvb_usb_generic_rw(d,&cmd,1,key,5,0);
65 enum rc_type proto = RC_TYPE_NEC;
68 if ((u8) ~key[1] != key[2]) {
70 scancode = scancode << 8;
74 scancode = scancode << 8;
77 /* Check command checksum is ok */
78 if ((u8) ~key[3] == key[4])
79 rc_keydown(d->rc_dev, proto, scancode, 0);
82 } else if (key[0] == 2) {
89 deb_info("key: %*ph\n", 5, key);
94 static int dtt200u_frontend_attach(struct dvb_usb_adapter *adap)
96 adap->fe_adap[0].fe = dtt200u_fe_attach(adap->dev);
100 static struct dvb_usb_device_properties dtt200u_properties;
101 static struct dvb_usb_device_properties wt220u_fc_properties;
102 static struct dvb_usb_device_properties wt220u_properties;
103 static struct dvb_usb_device_properties wt220u_zl0353_properties;
104 static struct dvb_usb_device_properties wt220u_miglia_properties;
106 static int dtt200u_usb_probe(struct usb_interface *intf,
107 const struct usb_device_id *id)
109 if (0 == dvb_usb_device_init(intf, &dtt200u_properties,
110 THIS_MODULE, NULL, adapter_nr) ||
111 0 == dvb_usb_device_init(intf, &wt220u_properties,
112 THIS_MODULE, NULL, adapter_nr) ||
113 0 == dvb_usb_device_init(intf, &wt220u_fc_properties,
114 THIS_MODULE, NULL, adapter_nr) ||
115 0 == dvb_usb_device_init(intf, &wt220u_zl0353_properties,
116 THIS_MODULE, NULL, adapter_nr) ||
117 0 == dvb_usb_device_init(intf, &wt220u_miglia_properties,
118 THIS_MODULE, NULL, adapter_nr))
124 static struct usb_device_id dtt200u_usb_table [] = {
125 { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_DTT200U_COLD) },
126 { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_DTT200U_WARM) },
127 { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_WT220U_COLD) },
128 { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_WT220U_WARM) },
129 { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_WT220U_ZL0353_COLD) },
130 { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_WT220U_ZL0353_WARM) },
131 { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_WT220U_FC_COLD) },
132 { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_WT220U_FC_WARM) },
133 { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_WT220U_ZAP250_COLD) },
134 { USB_DEVICE(USB_VID_MIGLIA, USB_PID_WT220U_ZAP250_COLD) },
137 MODULE_DEVICE_TABLE(usb, dtt200u_usb_table);
139 static struct dvb_usb_device_properties dtt200u_properties = {
140 .usb_ctrl = CYPRESS_FX2,
141 .firmware = "dvb-usb-dtt200u-01.fw",
148 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_NEED_PID_FILTERING,
149 .pid_filter_count = 15,
151 .streaming_ctrl = dtt200u_streaming_ctrl,
152 .pid_filter = dtt200u_pid_filter,
153 .frontend_attach = dtt200u_frontend_attach,
154 /* parameter for the MPEG2-data transfer */
168 .power_ctrl = dtt200u_power_ctrl,
172 .rc_codes = RC_MAP_DTT200U,
173 .rc_query = dtt200u_rc_query,
174 .allowed_protos = RC_BIT_NEC,
177 .generic_bulk_ctrl_endpoint = 0x01,
179 .num_device_descs = 1,
181 { .name = "WideView/Yuan/Yakumo/Hama/Typhoon DVB-T USB2.0 (WT-200U)",
182 .cold_ids = { &dtt200u_usb_table[0], NULL },
183 .warm_ids = { &dtt200u_usb_table[1], NULL },
189 static struct dvb_usb_device_properties wt220u_properties = {
190 .usb_ctrl = CYPRESS_FX2,
191 .firmware = "dvb-usb-wt220u-02.fw",
198 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_NEED_PID_FILTERING,
199 .pid_filter_count = 15,
201 .streaming_ctrl = dtt200u_streaming_ctrl,
202 .pid_filter = dtt200u_pid_filter,
203 .frontend_attach = dtt200u_frontend_attach,
204 /* parameter for the MPEG2-data transfer */
218 .power_ctrl = dtt200u_power_ctrl,
222 .rc_codes = RC_MAP_DTT200U,
223 .rc_query = dtt200u_rc_query,
224 .allowed_protos = RC_BIT_NEC,
227 .generic_bulk_ctrl_endpoint = 0x01,
229 .num_device_descs = 1,
231 { .name = "WideView WT-220U PenType Receiver (Typhoon/Freecom)",
232 .cold_ids = { &dtt200u_usb_table[2], &dtt200u_usb_table[8], NULL },
233 .warm_ids = { &dtt200u_usb_table[3], NULL },
239 static struct dvb_usb_device_properties wt220u_fc_properties = {
240 .usb_ctrl = CYPRESS_FX2,
241 .firmware = "dvb-usb-wt220u-fc03.fw",
248 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_NEED_PID_FILTERING,
249 .pid_filter_count = 15,
251 .streaming_ctrl = dtt200u_streaming_ctrl,
252 .pid_filter = dtt200u_pid_filter,
253 .frontend_attach = dtt200u_frontend_attach,
254 /* parameter for the MPEG2-data transfer */
268 .power_ctrl = dtt200u_power_ctrl,
272 .rc_codes = RC_MAP_DTT200U,
273 .rc_query = dtt200u_rc_query,
274 .allowed_protos = RC_BIT_NEC,
277 .generic_bulk_ctrl_endpoint = 0x01,
279 .num_device_descs = 1,
281 { .name = "WideView WT-220U PenType Receiver (Typhoon/Freecom)",
282 .cold_ids = { &dtt200u_usb_table[6], NULL },
283 .warm_ids = { &dtt200u_usb_table[7], NULL },
289 static struct dvb_usb_device_properties wt220u_zl0353_properties = {
290 .usb_ctrl = CYPRESS_FX2,
291 .firmware = "dvb-usb-wt220u-zl0353-01.fw",
298 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_NEED_PID_FILTERING,
299 .pid_filter_count = 15,
301 .streaming_ctrl = dtt200u_streaming_ctrl,
302 .pid_filter = dtt200u_pid_filter,
303 .frontend_attach = dtt200u_frontend_attach,
304 /* parameter for the MPEG2-data transfer */
318 .power_ctrl = dtt200u_power_ctrl,
322 .rc_codes = RC_MAP_DTT200U,
323 .rc_query = dtt200u_rc_query,
324 .allowed_protos = RC_BIT_NEC,
327 .generic_bulk_ctrl_endpoint = 0x01,
329 .num_device_descs = 1,
331 { .name = "WideView WT-220U PenType Receiver (based on ZL353)",
332 .cold_ids = { &dtt200u_usb_table[4], NULL },
333 .warm_ids = { &dtt200u_usb_table[5], NULL },
339 static struct dvb_usb_device_properties wt220u_miglia_properties = {
340 .usb_ctrl = CYPRESS_FX2,
341 .firmware = "dvb-usb-wt220u-miglia-01.fw",
344 .generic_bulk_ctrl_endpoint = 0x01,
346 .num_device_descs = 1,
348 { .name = "WideView WT-220U PenType Receiver (Miglia)",
349 .cold_ids = { &dtt200u_usb_table[9], NULL },
350 /* This device turns into WT220U_ZL0353_WARM when fw
352 .warm_ids = { NULL },
358 /* usb specific object needed to register this driver with the usb subsystem */
359 static struct usb_driver dtt200u_usb_driver = {
360 .name = "dvb_usb_dtt200u",
361 .probe = dtt200u_usb_probe,
362 .disconnect = dvb_usb_device_exit,
363 .id_table = dtt200u_usb_table,
366 module_usb_driver(dtt200u_usb_driver);
368 MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@posteo.de>");
369 MODULE_DESCRIPTION("Driver for the WideView/Yakumo/Hama/Typhoon/Club3D/Miglia DVB-T USB2.0 devices");
370 MODULE_VERSION("1.0");
371 MODULE_LICENSE("GPL");