summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/dvb-usb/vp7045.c
diff options
context:
space:
mode:
authorPatrick Boettcher <devnull@localhost>2005-04-02 14:42:56 +0000
committerPatrick Boettcher <devnull@localhost>2005-04-02 14:42:56 +0000
commit861784e76607eafbfb13c6ce1e3b87204b3978da (patch)
tree892e736a8c25848d2ccb0a3a8a46f6b92693ec56 /linux/drivers/media/dvb/dvb-usb/vp7045.c
parent302481a5ffb8737f5fcb821ee79576637aa85055 (diff)
downloadmediapointer-dvb-s2-861784e76607eafbfb13c6ce1e3b87204b3978da.tar.gz
mediapointer-dvb-s2-861784e76607eafbfb13c6ce1e3b87204b3978da.tar.bz2
re-enabled and improved commonly used remote control code for dvb-usb
Diffstat (limited to 'linux/drivers/media/dvb/dvb-usb/vp7045.c')
-rw-r--r--linux/drivers/media/dvb/dvb-usb/vp7045.c56
1 files changed, 48 insertions, 8 deletions
diff --git a/linux/drivers/media/dvb/dvb-usb/vp7045.c b/linux/drivers/media/dvb/dvb-usb/vp7045.c
index 10945591b..d3d0b267d 100644
--- a/linux/drivers/media/dvb/dvb-usb/vp7045.c
+++ b/linux/drivers/media/dvb/dvb-usb/vp7045.c
@@ -16,7 +16,7 @@
/* debug */
int dvb_usb_vp7045_debug;
module_param_named(debug,dvb_usb_vp7045_debug, int, 0644);
-MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2 (or-able))." DVB_USB_DEBUG_STATUS);
+MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS);
int vp7045_usb_op(struct dvb_usb_device *d, u8 cmd, u8 *out, int outlen, u8 *in, int inlen, int msec)
{
@@ -85,16 +85,56 @@ u8 vp7045_read_reg(struct dvb_usb_device *d, u8 reg)
static int vp7045_power_ctrl(struct dvb_usb_device *d, int onoff)
{
u8 v = onoff;
- deb_info("power control: %s\n",onoff ? "on" : "off");
-
return vp7045_usb_op(d,SET_TUNER_POWER,&v,1,NULL,0,150);
}
-static int vp7045_rc_query(struct dvb_usb_device *d, u8 *key_buf, int *state)
+/* remote control stuff */
+
+/* The keymapping struct. Somehow this should be loaded to the driver, but
+ * currently it is hardcoded. */
+struct {
+ u8 raw;
+ u32 key;
+} vp7045_rc_key_mapping[] = {
+
+ /* insert the keys like this. to make the raw keys visible, enable
+ * debug=0x04 when loading dvb-usb-vp7045. */
+
+ /* these keys are probably wrong. I don't have a working IR-receiver on my
+ * vp7045, so I can't test it. Patches are welcome. */
+ { 0x01, KEY_1 },
+ { 0x02, KEY_2 },
+};
+
+static int vp7045_rc_init(struct dvb_usb_device *d)
{
- deb_info("remote query\n");
- *state = REMOTE_KEY_NO;
- return 0; //vp7045_usb_op(d,RC_VAL_READ,NULL,0,&v,1,20);
+ int i;
+ for (i = 0; i < sizeof(vp7045_rc_key_mapping)/sizeof(vp7045_rc_key_mapping[0]); i++)
+ set_bit(vp7045_rc_key_mapping[i].key, d->rc_input_dev.keybit);
+
+ return 0;
+}
+
+static int vp7045_rc_query(struct dvb_usb_device *d, u32 *key_buf, int *state)
+{
+ u8 key;
+ int i;
+ vp7045_usb_op(d,RC_VAL_READ,NULL,0,&key,1,20);
+
+ deb_rc("remote query key: %x %d\n",key,key);
+
+ if (key == 0x44) {
+ *state = REMOTE_NO_KEY_PRESSED;
+ return 0;
+ }
+
+ for (i = 0; i < sizeof(vp7045_rc_key_mapping)/sizeof(vp7045_rc_key_mapping); i++)
+ if (vp7045_rc_key_mapping[i].raw == key) {
+ *state = REMOTE_KEY_PRESSED;
+ *key_buf = vp7045_rc_key_mapping[i].key;
+ break;
+ }
+ return 0;
}
static int vp7045_read_eeprom(struct dvb_usb_device *d,u8 *buf, int len, int offset)
@@ -169,7 +209,7 @@ static struct dvb_usb_properties vp7045_properties = {
.read_mac_address = vp7045_read_mac_addr,
.rc_interval = 400,
- .remote_protocol = USB_REMOTE_PROTO_NEC,
+ .init_rc = vp7045_rc_init,
.query_rc = vp7045_rc_query,
/* parameter for the MPEG2-data transfer */