aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorJanne Grunau <janne-dvb@grunau.be>2007-07-31 18:45:13 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-09 21:04:05 -0400
commit89f4267d6fa96cb3db053d5183558c94ad5f46e5 (patch)
treef6eaa54326eb6a09617e30d6f128af1a289c352b /drivers/media/dvb
parent8d99996b0942ff566c62602d83ac2c13521bbe40 (diff)
V4L/DVB (5964): Fixed remote control for dib0700 with new firmware
The new firmware returns the data of the REQUEST_POLL_RC request in reversed order. The default is RC5, but it can be adjusted using a module parameter. Signed-off-by: Janne Grunau <janne-dvb@grunau.be> Signed-off-by: Patrick Boettcher <pb@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700.h1
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700_core.c21
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700_devices.c10
3 files changed, 26 insertions, 6 deletions
diff --git a/drivers/media/dvb/dvb-usb/dib0700.h b/drivers/media/dvb/dvb-usb/dib0700.h
index 74ae6c24087e..4a903ea95896 100644
--- a/drivers/media/dvb/dvb-usb/dib0700.h
+++ b/drivers/media/dvb/dvb-usb/dib0700.h
@@ -30,6 +30,7 @@ extern int dvb_usb_dib0700_debug;
30 // 1 Byte: 4MSB(1 = enable streaming, 0 = disable streaming) 4LSB(Video Mode: 0 = MPEG2 188Bytes, 1 = Analog) 30 // 1 Byte: 4MSB(1 = enable streaming, 0 = disable streaming) 4LSB(Video Mode: 0 = MPEG2 188Bytes, 1 = Analog)
31 // 2 Byte: MPEG2 mode: 4MSB(1 = Master Mode, 0 = Slave Mode) 4LSB(Channel 1 = bit0, Channel 2 = bit1) 31 // 2 Byte: MPEG2 mode: 4MSB(1 = Master Mode, 0 = Slave Mode) 4LSB(Channel 1 = bit0, Channel 2 = bit1)
32 // 2 Byte: Analog mode: 4MSB(0 = 625 lines, 1 = 525 lines) 4LSB( " " ) 32 // 2 Byte: Analog mode: 4MSB(0 = 625 lines, 1 = 525 lines) 4LSB( " " )
33#define REQUEST_SET_RC 0x11
33#define REQUEST_GET_VERSION 0x15 34#define REQUEST_GET_VERSION 0x15
34 35
35struct dib0700_state { 36struct dib0700_state {
diff --git a/drivers/media/dvb/dvb-usb/dib0700_core.c b/drivers/media/dvb/dvb-usb/dib0700_core.c
index 8a1ea114deb0..3ea294eb96bd 100644
--- a/drivers/media/dvb/dvb-usb/dib0700_core.c
+++ b/drivers/media/dvb/dvb-usb/dib0700_core.c
@@ -13,6 +13,10 @@ int dvb_usb_dib0700_debug;
13module_param_named(debug,dvb_usb_dib0700_debug, int, 0644); 13module_param_named(debug,dvb_usb_dib0700_debug, int, 0644);
14MODULE_PARM_DESC(debug, "set debugging level (1=info,2=fw,4=fwdata,8=data (or-able))." DVB_USB_DEBUG_STATUS); 14MODULE_PARM_DESC(debug, "set debugging level (1=info,2=fw,4=fwdata,8=data (or-able))." DVB_USB_DEBUG_STATUS);
15 15
16static int dvb_usb_dib0700_ir_proto = 1;
17module_param(dvb_usb_dib0700_ir_proto, int, 0644);
18MODULE_PARM_DESC(dvb_usb_dib0700_ir_proto, "set ir protocol (0=NEC, 1=RC5 (default), 2=RC6).");
19
16/* expecting rx buffer: request data[0] data[1] ... data[2] */ 20/* expecting rx buffer: request data[0] data[1] ... data[2] */
17static int dib0700_ctrl_wr(struct dvb_usb_device *d, u8 *tx, u8 txlen) 21static int dib0700_ctrl_wr(struct dvb_usb_device *d, u8 *tx, u8 txlen)
18{ 22{
@@ -260,14 +264,29 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
260 return dib0700_ctrl_wr(adap->dev, b, 4); 264 return dib0700_ctrl_wr(adap->dev, b, 4);
261} 265}
262 266
267static int dib0700_rc_setup(struct dvb_usb_device *d)
268{
269 u8 rc_setup[3] = {REQUEST_SET_RC, dvb_usb_dib0700_ir_proto, 0};
270 int i = dib0700_ctrl_wr(d, rc_setup, 3);
271 if (i<0) {
272 err("ir protocol setup failed");
273 return -1;
274 }
275 return 0;
276}
277
263static int dib0700_probe(struct usb_interface *intf, 278static int dib0700_probe(struct usb_interface *intf,
264 const struct usb_device_id *id) 279 const struct usb_device_id *id)
265{ 280{
266 int i; 281 int i;
282 struct dvb_usb_device *dev;
267 283
268 for (i = 0; i < dib0700_device_count; i++) 284 for (i = 0; i < dib0700_device_count; i++)
269 if (dvb_usb_device_init(intf, &dib0700_devices[i], THIS_MODULE, NULL) == 0) 285 if (dvb_usb_device_init(intf, &dib0700_devices[i], THIS_MODULE, &dev) == 0)
286 {
287 dib0700_rc_setup(dev);
270 return 0; 288 return 0;
289 }
271 290
272 return -ENODEV; 291 return -ENODEV;
273} 292}
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c
index 0eca0fc75327..4a3c5467d7e0 100644
--- a/drivers/media/dvb/dvb-usb/dib0700_devices.c
+++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c
@@ -275,19 +275,19 @@ static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
275 i=dib0700_ctrl_rd(d,rc_request,2,key,4); 275 i=dib0700_ctrl_rd(d,rc_request,2,key,4);
276 if (i<=0) { 276 if (i<=0) {
277 err("RC Query Failed"); 277 err("RC Query Failed");
278 return 0; 278 return -1;
279 } 279 }
280 if (key[0]==0 && key[1]==0 && key[2]==0 && key[3]==0) return 0; 280 if (key[0]==0 && key[1]==0 && key[2]==0 && key[3]==0) return 0;
281 if (key[1]!=st->rc_toggle) { 281 if (key[3-1]!=st->rc_toggle) {
282 for (i=0;i<d->props.rc_key_map_size; i++) { 282 for (i=0;i<d->props.rc_key_map_size; i++) {
283 if (keymap[i].custom == key[2] && keymap[i].data == key[3]) { 283 if (keymap[i].custom == key[3-2] && keymap[i].data == key[3-3]) {
284 *event = keymap[i].event; 284 *event = keymap[i].event;
285 *state = REMOTE_KEY_PRESSED; 285 *state = REMOTE_KEY_PRESSED;
286 st->rc_toggle=key[1]; 286 st->rc_toggle=key[3-1];
287 return 0; 287 return 0;
288 } 288 }
289 } 289 }
290 err("Unknown remote controller key : %2X %2X",(int)key[2],(int)key[3]); 290 err("Unknown remote controller key : %2X %2X",(int)key[3-2],(int)key[3-3]);
291 } 291 }
292 return 0; 292 return 0;
293} 293}