]>
Commit | Line | Data |
---|---|---|
776338e1 JS |
1 | /* DVB USB framework compliant Linux driver for the AVerMedia AverTV DVB-T |
2 | * USB2.0 (A800) DVB-T receiver. | |
3 | * | |
4 | * Copyright (C) 2005 Patrick Boettcher (patrick.boettcher@desy.de) | |
5 | * | |
6 | * Thanks to | |
7 | * - AVerMedia who kindly provided information and | |
8 | * - Glen Harris who suffered from my mistakes during development. | |
9 | * | |
10 | * This program is free software; you can redistribute it and/or modify it | |
11 | * under the terms of the GNU General Public License as published by the Free | |
12 | * Software Foundation, version 2. | |
13 | * | |
14 | * see Documentation/dvb/README.dvb-usb for more information | |
15 | */ | |
16 | #include "dibusb.h" | |
17 | ||
18 | static int debug; | |
19 | module_param(debug, int, 0644); | |
20 | MODULE_PARM_DESC(debug, "set debugging level (rc=1 (or-able))." DVB_USB_DEBUG_STATUS); | |
21 | #define deb_rc(args...) dprintk(debug,0x01,args) | |
22 | ||
23 | static int a800_power_ctrl(struct dvb_usb_device *d, int onoff) | |
24 | { | |
25 | /* do nothing for the AVerMedia */ | |
26 | return 0; | |
27 | } | |
28 | ||
29 | static struct dvb_usb_rc_key a800_rc_keys[] = { | |
30 | { 0x02, 0x01, KEY_PROG1 }, /* SOURCE */ | |
31 | { 0x02, 0x00, KEY_POWER }, /* POWER */ | |
32 | { 0x02, 0x05, KEY_1 }, /* 1 */ | |
33 | { 0x02, 0x06, KEY_2 }, /* 2 */ | |
34 | { 0x02, 0x07, KEY_3 }, /* 3 */ | |
35 | { 0x02, 0x09, KEY_4 }, /* 4 */ | |
36 | { 0x02, 0x0a, KEY_5 }, /* 5 */ | |
37 | { 0x02, 0x0b, KEY_6 }, /* 6 */ | |
38 | { 0x02, 0x0d, KEY_7 }, /* 7 */ | |
39 | { 0x02, 0x0e, KEY_8 }, /* 8 */ | |
40 | { 0x02, 0x0f, KEY_9 }, /* 9 */ | |
41 | { 0x02, 0x12, KEY_LEFT }, /* L / DISPLAY */ | |
42 | { 0x02, 0x11, KEY_0 }, /* 0 */ | |
43 | { 0x02, 0x13, KEY_RIGHT }, /* R / CH RTN */ | |
44 | { 0x02, 0x17, KEY_PROG2 }, /* SNAP SHOT */ | |
45 | { 0x02, 0x10, KEY_PROG3 }, /* 16-CH PREV */ | |
776338e1 JS |
46 | { 0x02, 0x1e, KEY_VOLUMEDOWN }, /* VOL DOWN */ |
47 | { 0x02, 0x0c, KEY_ZOOM }, /* FULL SCREEN */ | |
48 | { 0x02, 0x1f, KEY_VOLUMEUP }, /* VOL UP */ | |
776338e1 JS |
49 | { 0x02, 0x14, KEY_MUTE }, /* MUTE */ |
50 | { 0x02, 0x08, KEY_AUDIO }, /* AUDIO */ | |
51 | { 0x02, 0x19, KEY_RECORD }, /* RECORD */ | |
52 | { 0x02, 0x18, KEY_PLAY }, /* PLAY */ | |
53 | { 0x02, 0x1b, KEY_STOP }, /* STOP */ | |
54 | { 0x02, 0x1a, KEY_PLAYPAUSE }, /* TIMESHIFT / PAUSE */ | |
55 | { 0x02, 0x1d, KEY_BACK }, /* << / RED */ | |
56 | { 0x02, 0x1c, KEY_FORWARD }, /* >> / YELLOW */ | |
57 | { 0x02, 0x03, KEY_TEXT }, /* TELETEXT */ | |
776338e1 JS |
58 | { 0x02, 0x04, KEY_EPG }, /* EPG */ |
59 | { 0x02, 0x15, KEY_MENU }, /* MENU */ | |
58769a54 AH |
60 | |
61 | { 0x03, 0x03, KEY_CHANNELUP }, /* CH UP */ | |
62 | { 0x03, 0x02, KEY_CHANNELDOWN }, /* CH DOWN */ | |
63 | { 0x03, 0x01, KEY_FIRST }, /* |<< / GREEN */ | |
64 | { 0x03, 0x00, KEY_LAST }, /* >>| / BLUE */ | |
65 | ||
776338e1 JS |
66 | }; |
67 | ||
15ac8e66 | 68 | static int a800_rc_query(struct dvb_usb_device *d, u32 *event, int *state) |
776338e1 JS |
69 | { |
70 | u8 key[5]; | |
71 | if (usb_control_msg(d->udev,usb_rcvctrlpipe(d->udev,0), | |
72 | 0x04, USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, key, 5, | |
58769a54 | 73 | 2000) != 5) |
776338e1 JS |
74 | return -ENODEV; |
75 | ||
76 | /* call the universal NEC remote processor, to find out the key's state and event */ | |
77 | dvb_usb_nec_rc_key_to_event(d,key,event,state); | |
78 | if (key[0] != 0) | |
79 | deb_rc("key: %x %x %x %x %x\n",key[0],key[1],key[2],key[3],key[4]); | |
80 | return 0; | |
81 | } | |
82 | ||
83 | /* USB Driver stuff */ | |
84 | static struct dvb_usb_properties a800_properties; | |
85 | ||
86 | static int a800_probe(struct usb_interface *intf, | |
87 | const struct usb_device_id *id) | |
88 | { | |
47dc3d68 | 89 | return dvb_usb_device_init(intf,&a800_properties,THIS_MODULE,NULL); |
776338e1 JS |
90 | } |
91 | ||
92 | /* do not change the order of the ID table */ | |
93 | static struct usb_device_id a800_table [] = { | |
94 | /* 00 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_DVBT_USB2_COLD) }, | |
95 | /* 01 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_DVBT_USB2_WARM) }, | |
96 | { } /* Terminating entry */ | |
97 | }; | |
98 | MODULE_DEVICE_TABLE (usb, a800_table); | |
99 | ||
100 | static struct dvb_usb_properties a800_properties = { | |
101 | .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, | |
102 | .pid_filter_count = 32, | |
103 | ||
104 | .usb_ctrl = CYPRESS_FX2, | |
105 | ||
106 | .firmware = "dvb-usb-avertv-a800-02.fw", | |
107 | ||
108 | .size_of_priv = sizeof(struct dibusb_state), | |
109 | ||
110 | .streaming_ctrl = dibusb2_0_streaming_ctrl, | |
111 | .pid_filter = dibusb_pid_filter, | |
112 | .pid_filter_ctrl = dibusb_pid_filter_ctrl, | |
113 | .power_ctrl = a800_power_ctrl, | |
114 | .frontend_attach = dibusb_dib3000mc_frontend_attach, | |
115 | .tuner_attach = dibusb_dib3000mc_tuner_attach, | |
116 | ||
117 | .rc_interval = DEFAULT_RC_INTERVAL, | |
118 | .rc_key_map = a800_rc_keys, | |
119 | .rc_key_map_size = ARRAY_SIZE(a800_rc_keys), | |
120 | .rc_query = a800_rc_query, | |
121 | ||
122 | .i2c_algo = &dibusb_i2c_algo, | |
123 | ||
124 | .generic_bulk_ctrl_endpoint = 0x01, | |
125 | /* parameter for the MPEG2-data transfer */ | |
126 | .urb = { | |
127 | .type = DVB_USB_BULK, | |
128 | .count = 7, | |
129 | .endpoint = 0x06, | |
130 | .u = { | |
131 | .bulk = { | |
132 | .buffersize = 4096, | |
133 | } | |
134 | } | |
135 | }, | |
136 | ||
137 | .num_device_descs = 1, | |
138 | .devices = { | |
139 | { "AVerMedia AverTV DVB-T USB 2.0 (A800)", | |
140 | { &a800_table[0], NULL }, | |
141 | { &a800_table[1], NULL }, | |
142 | }, | |
143 | } | |
144 | }; | |
145 | ||
146 | static struct usb_driver a800_driver = { | |
63b5c1c4 | 147 | .name = "dvb_usb_a800", |
776338e1 JS |
148 | .probe = a800_probe, |
149 | .disconnect = dvb_usb_device_exit, | |
150 | .id_table = a800_table, | |
151 | }; | |
152 | ||
153 | /* module stuff */ | |
154 | static int __init a800_module_init(void) | |
155 | { | |
156 | int result; | |
157 | if ((result = usb_register(&a800_driver))) { | |
158 | err("usb_register failed. Error number %d",result); | |
159 | return result; | |
160 | } | |
161 | ||
162 | return 0; | |
163 | } | |
164 | ||
165 | static void __exit a800_module_exit(void) | |
166 | { | |
167 | /* deregister this driver from the USB subsystem */ | |
168 | usb_deregister(&a800_driver); | |
169 | } | |
170 | ||
171 | module_init (a800_module_init); | |
172 | module_exit (a800_module_exit); | |
173 | ||
174 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); | |
175 | MODULE_DESCRIPTION("AVerMedia AverTV DVB-T USB 2.0 (A800)"); | |
176 | MODULE_VERSION("1.0"); | |
177 | MODULE_LICENSE("GPL"); |