diff options
author | Allan Third <allan.third@cs.man.ac.uk> | 2006-09-10 11:05:50 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-09-26 11:30:36 -0400 |
commit | 774c0de4aed4d5171e8c3cb47402265d278d2591 (patch) | |
tree | 923a2c2c09e38066700ebc59719e9ee1aabbe922 | |
parent | e9f964da79f6dcdd1c1a85dea84e9e7d7236729e (diff) |
V4L/DVB (4616): [PATCH] Nebula DigiTV USB RC support
Attached is a patch against latest HG which adds remote control support
to the DigiTV driver. It works for me;
Signed-off-by: Allan Third <allan.third@gmail.com>
Signed-off-by: Patrick Boettcher <pb@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | drivers/media/dvb/dvb-usb/digitv.c | 82 |
1 files changed, 76 insertions, 6 deletions
diff --git a/drivers/media/dvb/dvb-usb/digitv.c b/drivers/media/dvb/dvb-usb/digitv.c index f5cd3a4f82a8..015854487308 100644 --- a/drivers/media/dvb/dvb-usb/digitv.c +++ b/drivers/media/dvb/dvb-usb/digitv.c | |||
@@ -147,21 +147,91 @@ static int digitv_tuner_attach(struct dvb_usb_device *d) | |||
147 | } | 147 | } |
148 | 148 | ||
149 | static struct dvb_usb_rc_key digitv_rc_keys[] = { | 149 | static struct dvb_usb_rc_key digitv_rc_keys[] = { |
150 | { 0x00, 0x16, KEY_POWER }, /* dummy key */ | 150 | { 0x5f, 0x55, KEY_0 }, |
151 | { 0x6f, 0x55, KEY_1 }, | ||
152 | { 0x9f, 0x55, KEY_2 }, | ||
153 | { 0xaf, 0x55, KEY_3 }, | ||
154 | { 0x5f, 0x56, KEY_4 }, | ||
155 | { 0x6f, 0x56, KEY_5 }, | ||
156 | { 0x9f, 0x56, KEY_6 }, | ||
157 | { 0xaf, 0x56, KEY_7 }, | ||
158 | { 0x5f, 0x59, KEY_8 }, | ||
159 | { 0x6f, 0x59, KEY_9 }, | ||
160 | { 0x9f, 0x59, KEY_TV }, | ||
161 | { 0xaf, 0x59, KEY_AUX }, | ||
162 | { 0x5f, 0x5a, KEY_DVD }, | ||
163 | { 0x6f, 0x5a, KEY_POWER }, | ||
164 | { 0x9f, 0x5a, KEY_MHP }, /* labelled 'Picture' */ | ||
165 | { 0xaf, 0x5a, KEY_AUDIO }, | ||
166 | { 0x5f, 0x65, KEY_INFO }, | ||
167 | { 0x6f, 0x65, KEY_F13 }, /* 16:9 */ | ||
168 | { 0x9f, 0x65, KEY_F14 }, /* 14:9 */ | ||
169 | { 0xaf, 0x65, KEY_EPG }, | ||
170 | { 0x5f, 0x66, KEY_EXIT }, | ||
171 | { 0x6f, 0x66, KEY_MENU }, | ||
172 | { 0x9f, 0x66, KEY_UP }, | ||
173 | { 0xaf, 0x66, KEY_DOWN }, | ||
174 | { 0x5f, 0x69, KEY_LEFT }, | ||
175 | { 0x6f, 0x69, KEY_RIGHT }, | ||
176 | { 0x9f, 0x69, KEY_ENTER }, | ||
177 | { 0xaf, 0x69, KEY_CHANNELUP }, | ||
178 | { 0x5f, 0x6a, KEY_CHANNELDOWN }, | ||
179 | { 0x6f, 0x6a, KEY_VOLUMEUP }, | ||
180 | { 0x9f, 0x6a, KEY_VOLUMEDOWN }, | ||
181 | { 0xaf, 0x6a, KEY_RED }, | ||
182 | { 0x5f, 0x95, KEY_GREEN }, | ||
183 | { 0x6f, 0x95, KEY_YELLOW }, | ||
184 | { 0x9f, 0x95, KEY_BLUE }, | ||
185 | { 0xaf, 0x95, KEY_SUBTITLE }, | ||
186 | { 0x5f, 0x96, KEY_F15 }, /* AD */ | ||
187 | { 0x6f, 0x96, KEY_TEXT }, | ||
188 | { 0x9f, 0x96, KEY_MUTE }, | ||
189 | { 0xaf, 0x96, KEY_REWIND }, | ||
190 | { 0x5f, 0x99, KEY_STOP }, | ||
191 | { 0x6f, 0x99, KEY_PLAY }, | ||
192 | { 0x9f, 0x99, KEY_FASTFORWARD }, | ||
193 | { 0xaf, 0x99, KEY_F16 }, /* chapter */ | ||
194 | { 0x5f, 0x9a, KEY_PAUSE }, | ||
195 | { 0x6f, 0x9a, KEY_PLAY }, | ||
196 | { 0x9f, 0x9a, KEY_RECORD }, | ||
197 | { 0xaf, 0x9a, KEY_F17 }, /* picture in picture */ | ||
198 | { 0x5f, 0xa5, KEY_KPPLUS }, /* zoom in */ | ||
199 | { 0x6f, 0xa5, KEY_KPMINUS }, /* zoom out */ | ||
200 | { 0x9f, 0xa5, KEY_F18 }, /* capture */ | ||
201 | { 0xaf, 0xa5, KEY_F19 }, /* web */ | ||
202 | { 0x5f, 0xa6, KEY_EMAIL }, | ||
203 | { 0x6f, 0xa6, KEY_PHONE }, | ||
204 | { 0x9f, 0xa6, KEY_PC }, | ||
151 | }; | 205 | }; |
152 | 206 | ||
153 | /* TODO is it really the NEC protocol ? */ | ||
154 | static int digitv_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | 207 | static int digitv_rc_query(struct dvb_usb_device *d, u32 *event, int *state) |
155 | { | 208 | { |
209 | int i; | ||
156 | u8 key[5]; | 210 | u8 key[5]; |
211 | u8 b[4] = { 0 }; | ||
212 | |||
213 | *event = 0; | ||
214 | *state = REMOTE_NO_KEY_PRESSED; | ||
157 | 215 | ||
158 | digitv_ctrl_msg(d,USB_READ_REMOTE,0,NULL,0,&key[1],4); | 216 | digitv_ctrl_msg(d,USB_READ_REMOTE,0,NULL,0,&key[1],4); |
159 | /* TODO state, maybe it is VV ? */ | 217 | |
218 | /* Tell the device we've read the remote. Not sure how necessary | ||
219 | this is, but the Nebula SDK does it. */ | ||
220 | digitv_ctrl_msg(d,USB_WRITE_REMOTE,0,b,4,NULL,0); | ||
221 | |||
222 | /* if something is inside the buffer, simulate key press */ | ||
160 | if (key[1] != 0) | 223 | if (key[1] != 0) |
161 | key[0] = 0x01; /* if something is inside the buffer, simulate key press */ | 224 | { |
225 | for (i = 0; i < d->props.rc_key_map_size; i++) { | ||
226 | if (d->props.rc_key_map[i].custom == key[1] && | ||
227 | d->props.rc_key_map[i].data == key[2]) { | ||
228 | *event = d->props.rc_key_map[i].event; | ||
229 | *state = REMOTE_KEY_PRESSED; | ||
230 | return 0; | ||
231 | } | ||
232 | } | ||
233 | } | ||
162 | 234 | ||
163 | /* call the universal NEC remote processor, to find out the key's state and event */ | ||
164 | dvb_usb_nec_rc_key_to_event(d,key,event,state); | ||
165 | if (key[0] != 0) | 235 | if (key[0] != 0) |
166 | deb_rc("key: %x %x %x %x %x\n",key[0],key[1],key[2],key[3],key[4]); | 236 | deb_rc("key: %x %x %x %x %x\n",key[0],key[1],key[2],key[3],key[4]); |
167 | return 0; | 237 | return 0; |