Re: [linux-dvb] MT2266 I2C write failed, usb disconnet, WinTV Nova-TD stick, remote

2008-03-13 Thread Filippo Argiolas

Il giorno mer, 12/03/2008 alle 21.40 +, Philip Pemberton ha scritto:
 Bernhard Albers wrote:
  [  628.492000] hub 4-0:1.0: port 9 disabled by hub (EMI?), re-enabling...
  [  628.492000] usb 4-9: USB disconnect, address 2
  [  628.50] MT2266 I2C write failed
  [  628.50] MT2266 I2C write failed
  [  650.208000] dvb-usb: error while stopping stream.
 
  Maybe it is a problem of the mainboard. It is an Asus m2a-vm hdmi
  (amd690g chipset and ati x1250 onboard graphics) with the latest Bios
  (1604).
 
 Interesting theory...
 I'm seeing the same thing on a Biostar TA690G mainboard, which uses the same 

I've already told it to Bernard but not yet in the list:
Notice that this one seems to be a known issue (even to windows people)
related to an incompatibility between 690g mainboard (more precisely
sb600 southbridge) and nova td stick. It seems that it causes usb
disconnect when the stick works in dual mode (always in linux) using
both tuners at the same time. People reported the problem can be solved
with a pci usb expansion or using the stick with another mainboard.
There is also a note about it in the linuxtv wiki (NOVA-TD Stick page).
It's interesting to note that both you and Bernard experienced the
problem even with just one tuner.

Some link:
http://209.85.165.104/search?q=cache:3LygRMoeRqUJ:www.hauppauge.co.uk/board/showthread.php%3Ft%3D14152+nova+td+690ghl=itct=clnkcd=1

http://209.85.165.104/search?q=cache:KWnzteJ-zZkJ:www.hauppauge.co.uk/board/archive/index.php%3Ft-14247.html+nova+td+690ghl=itct=clnkcd=2

http://209.85.165.104/search?q=cache:-UJFsa42dsEJ:www.hauppauge.co.uk/board/archive/index.php%3Ft-14152.html+nova+td+sb600hl=itct=clnkcd=4

http://209.85.165.104/search?q=cache:tcwgQWV-jEUJ:www.hauppauge.co.uk/board/showthread.php%3Fp%3D63962+nova+td+sb600hl=itct=clnkcd=3



___
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb


[linux-dvb] [PATCH] support key repeat with dib0700 ir receiver - (resend signed off)

2008-03-11 Thread Filippo Argiolas
This patch enables support for repeating last event when a key is holded
down with dib0700 devices. It works with rc5 and nec remotes.
It also fixes an annoying bug that floods kernel log with Unknown key
messages after each keypress. This happened because the driver was not
resetting infrared register after each poll so it kept polling last key
even if nothing was being pressed. Fixing this, (calling rc_setup after
each poll), permits to implement key repeat.

Signed-off-by: Filippo Argiolas filippo.argiolas at gmail.com

I'm resending the patch because I didn't sign it off the first time.
It's been a while since it's out, it has been tested and received many
positive comments and no complaint. Please refer to my previous post for
a complete description of the problem and how the patch fixes it.
Hope everything is ok for inclusion :P
Thanks,

Cheers,
Filippo
diff -r 127f67dea087 linux/drivers/media/dvb/dvb-usb/dib0700.h
--- a/linux/drivers/media/dvb/dvb-usb/dib0700.h	Tue Feb 26 20:43:56 2008 +
+++ b/linux/drivers/media/dvb/dvb-usb/dib0700.h	Sun Mar 02 20:30:41 2008 +0100
@@ -37,6 +37,7 @@ struct dib0700_state {
 	u8 channel_state;
 	u16 mt2060_if1[2];
 	u8 rc_toggle;
+	u8 rc_counter;
 	u8 is_dib7000pc;
 };
 
@@ -44,12 +45,15 @@ extern int dib0700_ctrl_clock(struct dvb
 extern int dib0700_ctrl_clock(struct dvb_usb_device *d, u32 clk_MHz, u8 clock_out_gp3);
 extern int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u8 rxlen);
 extern int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw);
+extern int dib0700_rc_setup(struct dvb_usb_device *d);
 extern int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff);
 extern struct i2c_algorithm dib0700_i2c_algo;
 extern int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props,
 			struct dvb_usb_device_description **desc, int *cold);
 
 extern int dib0700_device_count;
+extern int dvb_usb_dib0700_ir_proto;
 extern struct dvb_usb_device_properties dib0700_devices[];
 extern struct usb_device_id dib0700_usb_id_table[];
+
 #endif
diff -r 127f67dea087 linux/drivers/media/dvb/dvb-usb/dib0700_core.c
--- a/linux/drivers/media/dvb/dvb-usb/dib0700_core.c	Tue Feb 26 20:43:56 2008 +
+++ b/linux/drivers/media/dvb/dvb-usb/dib0700_core.c	Sun Mar 02 20:30:41 2008 +0100
@@ -13,7 +13,7 @@ module_param_named(debug,dvb_usb_dib0700
 module_param_named(debug,dvb_usb_dib0700_debug, int, 0644);
 MODULE_PARM_DESC(debug, set debugging level (1=info,2=fw,4=fwdata,8=data (or-able)). DVB_USB_DEBUG_STATUS);
 
-static int dvb_usb_dib0700_ir_proto = 1;
+int dvb_usb_dib0700_ir_proto = 1;
 module_param(dvb_usb_dib0700_ir_proto, int, 0644);
 MODULE_PARM_DESC(dvb_usb_dib0700_ir_proto, set ir protocol (0=NEC, 1=RC5 (default), 2=RC6).);
 
@@ -261,7 +261,7 @@ int dib0700_streaming_ctrl(struct dvb_us
 	return dib0700_ctrl_wr(adap-dev, b, 4);
 }
 
-static int dib0700_rc_setup(struct dvb_usb_device *d)
+int dib0700_rc_setup(struct dvb_usb_device *d)
 {
 	u8 rc_setup[3] = {REQUEST_SET_RC, dvb_usb_dib0700_ir_proto, 0};
 	int i = dib0700_ctrl_wr(d, rc_setup, 3);
diff -r 127f67dea087 linux/drivers/media/dvb/dvb-usb/dib0700_devices.c
--- a/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c	Tue Feb 26 20:43:56 2008 +
+++ b/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c	Sun Mar 02 20:30:41 2008 +0100
@@ -301,6 +301,9 @@ static int stk7700d_tuner_attach(struct 
 
 static u8 rc_request[] = { REQUEST_POLL_RC, 0 };
 
+/* Number of keypresses to ignore before start repeating */
+#define RC_REPEAT_DELAY 2
+
 static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
 {
 	u8 key[4];
@@ -314,18 +317,67 @@ static int dib0700_rc_query(struct dvb_u
 		err(RC Query Failed);
 		return -1;
 	}
+
+	/* losing half of KEY_0 events from Philipps rc5 remotes.. */
 	if (key[0]==0  key[1]==0  key[2]==0  key[3]==0) return 0;
-	if (key[3-1]!=st-rc_toggle) {
+	
+	/* info(%d: %2X %2X %2X %2X,dvb_usb_dib0700_ir_proto,(int)key[3-2],(int)key[3-3],(int)key[3-1],(int)key[3]);  */
+
+	dib0700_rc_setup(d); /* reset ir sensor data to prevent false events */
+	
+	switch (dvb_usb_dib0700_ir_proto) {
+	case 0: {
+		/* NEC protocol sends repeat code as 0 0 0 FF */
+		if ((key[3-2] == 0x00)  (key[3-3] == 0x00) 
+		(key[3] == 0xFF)) {
+			st-rc_counter++; 
+			if(st-rc_counter  RC_REPEAT_DELAY) {
+*event = d-last_event;
+*state = REMOTE_KEY_PRESSED;
+st-rc_counter = RC_REPEAT_DELAY;
+			} 
+			return 0;
+		}
 		for (i=0;id-props.rc_key_map_size; i++) {
 			if (keymap[i].custom == key[3-2]  keymap[i].data == key[3-3]) {
+st-rc_counter = 0;
 *event = keymap[i].event;
 *state = REMOTE_KEY_PRESSED;
-st-rc_toggle=key[3-1];
+d-last_event = keymap[i].event;
 return 0;
 			}
 		}
-		err(Unknown remote controller key : %2X %2X,(int)key[3-2],(int)key[3-3]);
-	}
+		break;
+	}
+	default: {
+		/* RC-5 protocol changes toggle bit on new keypress */
+		for (i=0;id-props.rc_key_map_size; i

Re: [linux-dvb] [patch] support for key repeat with dib0700 ir receiver

2008-03-02 Thread Filippo Argiolas

Il giorno mer, 20/02/2008 alle 10.29 +0100, Filippo Argiolas ha scritto:

 I don't know yet how this could be done and maybe it involves some work
 rewriting the ir stuff. So I think in the meanwhile my patch could be
 merged (if you think it's good) waiting for this work to be done.

Hi all,
it's been a while since I've posted this patch. Looking at the whole
thread the overall impression is that it works properly. No one
complained about it causing any trouble. Many users tested it and
reported it works good. I've been using it during this time and it seems
fine to me. It also fixed the annoying bug that flooded syslog with
unknown key messages.
So what does it need to be merged? Is a post in this list the proper way
to ask for inclusion? I'm not familiar to mercurial so I've created the
patch as I would do with a svn with hg diff, it something wrong with
it? Is there a better way to produce a patch for submission?
I've attached a new patch where I've removed the keymaps I've used for
testing since these are not complete and I doubt anyone could find them
useful.
Please let me know what you think about it, thanks!
Best regards,

Filippo

diff -r 127f67dea087 linux/drivers/media/dvb/dvb-usb/dib0700.h
--- a/linux/drivers/media/dvb/dvb-usb/dib0700.h	Tue Feb 26 20:43:56 2008 +
+++ b/linux/drivers/media/dvb/dvb-usb/dib0700.h	Sun Mar 02 20:30:41 2008 +0100
@@ -37,6 +37,7 @@ struct dib0700_state {
 	u8 channel_state;
 	u16 mt2060_if1[2];
 	u8 rc_toggle;
+	u8 rc_counter;
 	u8 is_dib7000pc;
 };
 
@@ -44,12 +45,15 @@ extern int dib0700_ctrl_clock(struct dvb
 extern int dib0700_ctrl_clock(struct dvb_usb_device *d, u32 clk_MHz, u8 clock_out_gp3);
 extern int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u8 rxlen);
 extern int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw);
+extern int dib0700_rc_setup(struct dvb_usb_device *d);
 extern int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff);
 extern struct i2c_algorithm dib0700_i2c_algo;
 extern int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props,
 			struct dvb_usb_device_description **desc, int *cold);
 
 extern int dib0700_device_count;
+extern int dvb_usb_dib0700_ir_proto;
 extern struct dvb_usb_device_properties dib0700_devices[];
 extern struct usb_device_id dib0700_usb_id_table[];
+
 #endif
diff -r 127f67dea087 linux/drivers/media/dvb/dvb-usb/dib0700_core.c
--- a/linux/drivers/media/dvb/dvb-usb/dib0700_core.c	Tue Feb 26 20:43:56 2008 +
+++ b/linux/drivers/media/dvb/dvb-usb/dib0700_core.c	Sun Mar 02 20:30:41 2008 +0100
@@ -13,7 +13,7 @@ module_param_named(debug,dvb_usb_dib0700
 module_param_named(debug,dvb_usb_dib0700_debug, int, 0644);
 MODULE_PARM_DESC(debug, set debugging level (1=info,2=fw,4=fwdata,8=data (or-able)). DVB_USB_DEBUG_STATUS);
 
-static int dvb_usb_dib0700_ir_proto = 1;
+int dvb_usb_dib0700_ir_proto = 1;
 module_param(dvb_usb_dib0700_ir_proto, int, 0644);
 MODULE_PARM_DESC(dvb_usb_dib0700_ir_proto, set ir protocol (0=NEC, 1=RC5 (default), 2=RC6).);
 
@@ -261,7 +261,7 @@ int dib0700_streaming_ctrl(struct dvb_us
 	return dib0700_ctrl_wr(adap-dev, b, 4);
 }
 
-static int dib0700_rc_setup(struct dvb_usb_device *d)
+int dib0700_rc_setup(struct dvb_usb_device *d)
 {
 	u8 rc_setup[3] = {REQUEST_SET_RC, dvb_usb_dib0700_ir_proto, 0};
 	int i = dib0700_ctrl_wr(d, rc_setup, 3);
diff -r 127f67dea087 linux/drivers/media/dvb/dvb-usb/dib0700_devices.c
--- a/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c	Tue Feb 26 20:43:56 2008 +
+++ b/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c	Sun Mar 02 20:30:41 2008 +0100
@@ -301,6 +301,9 @@ static int stk7700d_tuner_attach(struct 
 
 static u8 rc_request[] = { REQUEST_POLL_RC, 0 };
 
+/* Number of keypresses to ignore before start repeating */
+#define RC_REPEAT_DELAY 2
+
 static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
 {
 	u8 key[4];
@@ -314,18 +317,67 @@ static int dib0700_rc_query(struct dvb_u
 		err(RC Query Failed);
 		return -1;
 	}
+
+	/* losing half of KEY_0 events from Philipps rc5 remotes.. */
 	if (key[0]==0  key[1]==0  key[2]==0  key[3]==0) return 0;
-	if (key[3-1]!=st-rc_toggle) {
+	
+	/* info(%d: %2X %2X %2X %2X,dvb_usb_dib0700_ir_proto,(int)key[3-2],(int)key[3-3],(int)key[3-1],(int)key[3]);  */
+
+	dib0700_rc_setup(d); /* reset ir sensor data to prevent false events */
+	
+	switch (dvb_usb_dib0700_ir_proto) {
+	case 0: {
+		/* NEC protocol sends repeat code as 0 0 0 FF */
+		if ((key[3-2] == 0x00)  (key[3-3] == 0x00) 
+		(key[3] == 0xFF)) {
+			st-rc_counter++; 
+			if(st-rc_counter  RC_REPEAT_DELAY) {
+*event = d-last_event;
+*state = REMOTE_KEY_PRESSED;
+st-rc_counter = RC_REPEAT_DELAY;
+			} 
+			return 0;
+		}
 		for (i=0;id-props.rc_key_map_size; i++) {
 			if (keymap[i].custom == key[3-2]  keymap[i].data == key[3-3]) {
+st-rc_counter = 0;
 *event = keymap[i].event;
 *state = REMOTE_KEY_PRESSED;
-st-rc_toggle=key

[linux-dvb] conflicts between v4l-dvb and out of tree modules

2008-02-24 Thread Filippo Argiolas
Hi since I've installed v4l-dvb drivers from the hg tree to make my
nova-t stick work, my webcam based on uvcvideo drivers stopped working
complaining about unknown symbol errors.
I ran make kernel-links and tried to recompile uvcvideo module. Even
with a freshly compiled module the unknown symbol error still stood.
You can find a summary of the problem in the linux-uvc mailing list with
the solution I've found:
https://lists.berlios.de/pipermail/linux-uvc-devel/2008-February/003088.html
https://lists.berlios.de/pipermail/linux-uvc-devel/2008-February/003104.html

I don't know too much about kernel development but it seems that
Module.symvers file contains a checksum of all the exported symbols.
This file is updated in the hg mercurial tree but not in the linux build
dir so external modules are compiled with outdated symbol versions.
Is there a way to update symbols in in /lib/modules/`uname
-r`/build/Module.symvers? maybe something like this should be done in
the makelinks.sh scripts?
Please note that, looking for a solution, I've many unaswered questions
from v4l-dvb and em28xx users complaining that their webcam stopped
working. So it's not an uncommon issue.

Regards,
Filippo


___
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb


Re: [linux-dvb] [patch] support for key repeat with dib0700 ir receiver

2008-02-21 Thread Filippo Argiolas
2008/2/21, Eduard Huguet [EMAIL PROTECTED]:

  I second that. This patch has greatly improved the experience with the 
 remote, now that it correctly supports auto-repeat when holding the button 
 down.

Great :)!

  PS @ Filippo: count on me for a beer also if you ever come to Barcelona.

Hehe thanks, I've not plans to travel to Barcelona at the moment but maybe :D!

___
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb


Re: [linux-dvb] [patch] support for key repeat with dib0700 ir receiver

2008-02-20 Thread Filippo Argiolas

Il giorno mar, 19/02/2008 alle 19.19 +, Nicolas Will ha scritto:
 Now this is rich!
 
 I love it!
 
 Key repeat works!

Great :)!

 And the log flooding has stopped without the manual patch that was
 needed previously.

Nice, fixing this was not my first purpose but I'm glad it's solved.

 I hope you live in Aberdeen, Scotland, because I want to buy you a few
 beers right here and now! (though your name suggest a very different
 origin)

Thanks! I'm pleased that someone else finds this useful!
I'm sorry I'm not from Scotland, I live in Italy but thank you for your
offer, if I will travel to Aberdeen a beer would be great :D!
Thanks also for mentioning me in the wiki.
Greets,
Filippo



___
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb


Re: [linux-dvb] [patch] support for key repeat with dib0700 ir receiver

2008-02-20 Thread Filippo Argiolas

Il giorno mer, 20/02/2008 alle 09.22 +0100, Filippo Argiolas ha scritto:
 Il giorno mer, 20/02/2008 alle 06.10 +0900, Matthew Vermeulen ha
 scritto:
  Hi all... I'm seeing exactly the same problems everyone else is (log
  flooding etc) except that I can't seem to get any keys picked by lirc
  or /dev/input/event7 at all...
 
 Are you sure that the input device is receiving the events?
 Did you try evtest /dev/input/event7?
 Is LIRC properly configured?
 Are you using this file for lircd.conf
 [http://linux.bytesex.org/v4l2/linux-input-layer-lircd.conf]?
 Does irw catch some event?

I forgot to say to not use irrecord with dev/input driver since it's
thinked to record raw events from remotes and doesn't work with input
devices (usually it ends up with a lircd.conf file that interprets key
press and release as separated events doubling each event).
Just use the proper input-layer-lircd.conf.


___
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb


Re: [linux-dvb] [patch] support for key repeat with dib0700 ir receiver

2008-02-20 Thread Filippo Argiolas
Il giorno mar, 19/02/2008 alle 22.14 +0100, Patrick Boettcher ha
scritto:
 That indeed looks OK to my eyes. I have to admit that I never took a look 
 into the IR-code from DiBcom...
 
 In any case, especially to that problem with unknown key code I think it 
 is time to change the IR-behavior of the DVB-USB.
 
 My problem is, I don't know how.
 
 My naive idea would be, that the IR-code is reporting each key (as raw as 
 possible) without mapping it to an event to the event interface and then 
 someone, somewhere is interpreting it. Also forward any repeat-attribute.
 
 Those endless tables in a lot of dvb-usb drivers are annoying me, firstly 
 because they are endless and huge, and secondly, they are never complete. 
 If there is an adequate replacement from userspace (somehow loading 
 key-lists to the event-layer or in the worst case, to the 
 dvb-usb-framework) would be a good solution.
 
 Filippo, it seems you understand quite some thing around that. Do you know 
 if what I'm saying is somehow possible?

Patrick, your doubts are the same that I've felt when, a few days ago, I
started looking at the dib0700 code.
I thinked why the driver decode events and binds them to a keymap
instead of passing them raw to a user space tool (lirc?)? This prevents
me to easily add a custom keymap for commercial remotes or even add a
keymap for the remotes I have. So my device can decode most of my
remote controllers but I cannot use them without editing the kernel code from
development branch.
Later I understood the idea behind all this:
as Nicolas said binding keypress to an event interface turns the remote
into a common input interface that works everywhere without additional
user space tools and without difficult per-app configurations. So I
think that current behavior is somewhat sane even if it lacks of a
simple system (from a user point of view) to add more keymaps or edit
current ones.
Please note that this behavior does not conflict with having different
settings for different application, since this is achievable configuring
lirc. 

Another problem (as far as I understood with a quick look at the code)
is that each different driver, being written by different people, faces
the whole thing in different ways. As you said almost each driver has
its own keymaps and its own methods to present events to the input
interface.
For example I've seen some effort towards a unified system in
dvb-usb-remote.c but dib0700 seems not to use it.

Regarding ir-common (as Darren suggested), after a quick look it seems
more a framework for decoding remote events but it cannot be extended to
all the devices since many of them do the decoding stuff on their own
outputting directly decoded data that only has to be binded to a keymap
and to an event device.
I think that all the drivers should output keypress decoded data in a
common format to be passed to a common framework that binds it to common
keymaps (better if user customizable in some way) and generates input
events.

I don't know yet how this could be done and maybe it involves some work
rewriting the ir stuff. So I think in the meanwhile my patch could be
merged (if you think it's good) waiting for this work to be done.
I'll take a deeper look at the code but I don't know if I'm able to do
this thing, I've read kernel code a few days ago for the very first time
and I've written the patch just because a I needed the repeat feature :)

Regards,

Filippo





___
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb


Re: [linux-dvb] [patch] support for key repeat with dib0700 ir receiver

2008-02-20 Thread Filippo Argiolas
2008/2/20, Nicolas Will [EMAIL PROTECTED]:
 Scratched an itch, heh? ;o)

eheh, the best thing of free software is that you can always take the
source and change it to reflect your needs :)

___
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb


Re: [linux-dvb] [patch] support for key repeat with dib0700 ir receiver

2008-02-20 Thread Filippo Argiolas
2008/2/20, Nicolas Will [EMAIL PROTECTED]:

 On Wed, 2008-02-20 at 09:22 +0100, Filippo Argiolas wrote:
  Are you using this file for lircd.conf
  [http://linux.bytesex.org/v4l2/linux-input-layer-lircd.conf]?

 Where is this file coming from?

I've found it here: http://osdir.com/ml/hardware.lirc/2005-01/msg00120.html
With the lircd.conf from irrecord every keypress was interpreted as
double since it was listeing to both keypress and release events.
For me worked good and it has almost every key supported by dev input.

___
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb


Re: [linux-dvb] [patch] support for key repeat with dib0700 ir receiver

2008-02-20 Thread Filippo Argiolas
Il giorno mer, 20/02/2008 alle 22.43 +0900, Matthew Vermeulen ha
scritto:
 Feb 20 22:39:53 matthew-desktop kernel: [39334.832815] dib0700:
 Unknown remote controller key: 13 7E  1  0
 Feb 20 22:39:53 matthew-desktop kernel: [39334.908277] dib0700:
 Unknown remote controller key: 13 7E  1  0
 Feb 20 22:39:53 matthew-desktop kernel: [39335.060139] dib0700:
 Unknown remote controller key: 13 7E  1  0
 Feb 20 22:39:53 matthew-desktop kernel: [39335.136473] dib0700:
 Unknown remote controller key: 13 7E  1  0
 Feb 20 22:39:53 matthew-desktop kernel: [39335.211810] dib0700:
 Unknown remote controller key: 13 7E  1  0
 Feb 20 22:39:54 matthew-desktop kernel: [39335.364108] dib0700:
 Unknown remote controller key: 13 7E  1  0
 
 Not sure if that's what we were hoping for...

It seems that your remote does not use the toggle bit. I don't know why
since afaik it is a feature of the rc5 protocol.
By the way you can try to make some test writing the keymap on your own.
Just edit dib0700_devices.c about at line 400, look at the other keymaps
to have a model:
for example if the key you logged was the UP key you have to add a line
like: 
{ 0x13, 0x7E, KEY_UP },
and so on for the other keys, after that see if the keymap works with
evtest.



___
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb


[linux-dvb] [patch] support for key repeat with dib0700 ir receiver

2008-02-19 Thread Filippo Argiolas
Hi, my last messages have been almost ignored.. so I'm opening a new
thread. Please refer to the other thread [wintv nova-t stick, dib0700
and remote controllers] for more info. 

Here is a brief summary of the problem as far as I can understand:
- when a keypress event is received the device stores its data somewhere
- every 150ms dib0700_rc_query reads this data 
- since there is nothing that resets device memory if no key is being
pressed anymore device still stores the data from the last keypress
event
- to prevent having false keypresses the driver reads rc5 toggle bit
that changes from 0 to 1 and viceversa when a new key is pressed or when
the same key is released and pressed again. So it ignores everything
until the toggle bit changes. The right behavior should be repeat last
key until toggle bit changes, but cannot be done since last data still
stored would be considered as a repeat even if nothing is pressed.
- this way it ignores even repeated key events (when a key is holded
down)
- this approach is wrong because it works just for rc5 (losing repeat
feature..) but doesn't work for example with nec remotes that don't set
the toggle bit and use a different system. 

The patch solves it calling dib0700_rc_setup after each poll resetting
last key data from the device. I've also implemented repeated key
feature (with repeat delay to avoid unwanted double hits) for rc-5 and
nec protocols. It also contains some keymap for the remotes I've used
for testing (a philipps compatible rc5 remote and a teac nec remote).
They are far from being complete since I've used them just for testing.

Thanks for reading this,
Let me know what do you think about it,
Greets,

Filippo
diff -r f89d5927677a linux/drivers/media/dvb/dvb-usb/dib0700.h
--- a/linux/drivers/media/dvb/dvb-usb/dib0700.h	Mon Feb 18 13:03:16 2008 -0300
+++ b/linux/drivers/media/dvb/dvb-usb/dib0700.h	Tue Feb 19 16:17:05 2008 +0100
@@ -37,6 +37,7 @@ struct dib0700_state {
 	u8 channel_state;
 	u16 mt2060_if1[2];
 	u8 rc_toggle;
+	u8 rc_counter;
 	u8 is_dib7000pc;
 };
 
@@ -44,12 +45,15 @@ extern int dib0700_ctrl_clock(struct dvb
 extern int dib0700_ctrl_clock(struct dvb_usb_device *d, u32 clk_MHz, u8 clock_out_gp3);
 extern int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u8 rxlen);
 extern int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw);
+extern int dib0700_rc_setup(struct dvb_usb_device *d);
 extern int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff);
 extern struct i2c_algorithm dib0700_i2c_algo;
 extern int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props,
 			struct dvb_usb_device_description **desc, int *cold);
 
 extern int dib0700_device_count;
+extern int dvb_usb_dib0700_ir_proto;
 extern struct dvb_usb_device_properties dib0700_devices[];
 extern struct usb_device_id dib0700_usb_id_table[];
+
 #endif
diff -r f89d5927677a linux/drivers/media/dvb/dvb-usb/dib0700_core.c
--- a/linux/drivers/media/dvb/dvb-usb/dib0700_core.c	Mon Feb 18 13:03:16 2008 -0300
+++ b/linux/drivers/media/dvb/dvb-usb/dib0700_core.c	Tue Feb 19 16:17:05 2008 +0100
@@ -13,7 +13,7 @@ module_param_named(debug,dvb_usb_dib0700
 module_param_named(debug,dvb_usb_dib0700_debug, int, 0644);
 MODULE_PARM_DESC(debug, set debugging level (1=info,2=fw,4=fwdata,8=data (or-able)). DVB_USB_DEBUG_STATUS);
 
-static int dvb_usb_dib0700_ir_proto = 1;
+int dvb_usb_dib0700_ir_proto = 1;
 module_param(dvb_usb_dib0700_ir_proto, int, 0644);
 MODULE_PARM_DESC(dvb_usb_dib0700_ir_proto, set ir protocol (0=NEC, 1=RC5 (default), 2=RC6).);
 
@@ -261,7 +261,7 @@ int dib0700_streaming_ctrl(struct dvb_us
 	return dib0700_ctrl_wr(adap-dev, b, 4);
 }
 
-static int dib0700_rc_setup(struct dvb_usb_device *d)
+int dib0700_rc_setup(struct dvb_usb_device *d)
 {
 	u8 rc_setup[3] = {REQUEST_SET_RC, dvb_usb_dib0700_ir_proto, 0};
 	int i = dib0700_ctrl_wr(d, rc_setup, 3);
diff -r f89d5927677a linux/drivers/media/dvb/dvb-usb/dib0700_devices.c
--- a/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c	Mon Feb 18 13:03:16 2008 -0300
+++ b/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c	Tue Feb 19 16:17:05 2008 +0100
@@ -301,6 +301,9 @@ static int stk7700d_tuner_attach(struct 
 
 static u8 rc_request[] = { REQUEST_POLL_RC, 0 };
 
+/* Number of keypresses to ignore before start repeating */
+#define RC_REPEAT_DELAY 2
+
 static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
 {
 	u8 key[4];
@@ -314,22 +317,116 @@ static int dib0700_rc_query(struct dvb_u
 		err(RC Query Failed);
 		return -1;
 	}
+
+	/* losing half of KEY_0 events from Philipps rc5 remotes.. */
 	if (key[0]==0  key[1]==0  key[2]==0  key[3]==0) return 0;
-	if (key[3-1]!=st-rc_toggle) {
+	
+	/* info(%d: %2X %2X %2X %2X,dvb_usb_dib0700_ir_proto,(int)key[3-2],(int)key[3-3],(int)key[3-1],(int)key[3]);  */
+
+	dib0700_rc_setup(d); /* reset ir sensor data to prevent false events */
+	
+	switch (dvb_usb_dib0700_ir_proto) {
+	case 0: {

Re: [linux-dvb] [patch] support for key repeat with dib0700 ir receiver

2008-02-19 Thread Filippo Argiolas

Il giorno mar, 19/02/2008 alle 17.33 +0100, Eduard Huguet ha scritto:

 Hi, 
 Thanks for your efforts. ¿Do you think this patch will also be
 useful to the unknown keycodes problem of the Nova-T 500 remote?
 
 If you don't know what I'm talking about here you have a brief
 description: whenever the Nova-T 500 receiver detects invalid or
 unknown IR codes (i.e. when you operate the TV remote, etc...) it
 keeps logging warning messages to kernel ring buffer until a valid
 code is received.
 
 There is a very simple patch in the wiki for this, but it doesn't cure
 the problem, just the symptons. I was wondering if your patch is a
 better way to solve it...
 
 Regards, 
   Eduard

Hi, I was not aware this was a known problem but I'm pretty sure this
patch should solve it. That problem happens because the toggle bit
control (on the unpatched code) is done in the keymap check cycle so
unknown repeated keys are not ignored and since the keypress data is
still saved into the device the error message is printed every 150ms
untill key data changes.
I didn't find the wiki page but I think this is the correct solution
since it resets ir data after each poll.
Please let me know if it works good if you are going to test the patch.
Thanks

Filippo



___
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

Re: [linux-dvb] [patch] support for key repeat with dib0700 ir receiver

2008-02-19 Thread Filippo Argiolas

Il giorno mar, 19/02/2008 alle 17.21 +, Nicolas Will ha scritto:
 On Tue, 2008-02-19 at 16:17 +0100, Filippo Argiolas wrote:
  I've also implemented repeated key
  feature (with repeat delay to avoid unwanted double hits) for rc-5 and
  nec protocols. It also contains some keymap for the remotes I've used
  for testing (a philipps compatible rc5 remote and a teac nec remote).
  They are far from being complete since I've used them just for
  testing.
 
 I'm quite interested in testing this patch, key repeats have been a
 nagging thing in the back of my mind.
 
 I'll be testing this patch, and I'll document it in the wiki here:
 
 http://linuxtv.org/wiki/index.php/Hauppauge_WinTV-NOVA-T-500
 
 I have a question about the quoted part.
 
 Will this mess in any way with the current keycodes of my Nova-T-500
 remote?

As far as I can tell the answer is no since the remotes I've mapped uses
address 0x00 (standard philipps adress for TVs) and 0x72 that are not
used in other keymaps. I cannot test it because I don't have a Hauppauge
remote but I think nothing messy should happen.



___
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb


Re: [linux-dvb] wintv nova-t stick, dib0700 and remote controllers..

2008-02-14 Thread Filippo Argiolas
No answer?
Please could someone tell me if is it dangerous to call
dib0700_rc_setup (from dib0700core.c) every 100ms to reset remote
control data? Do you know any other method to reset data about last
key received from the ir sensor?
Thanks
Filippo

___
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb


Re: [linux-dvb] wintv nova-t stick, dib0700 and remote controllers..

2008-02-14 Thread Filippo Argiolas
I'm asking this because calling dib0700_rc_setup after each keypress
poll resets the ir data into the  device to  0 0 0 0. What I'd like to
know since I know almost nothing about dvb devices if is this going to
someway damage my device if called each 150ms (period of the poll).
If not I'll write a patch to support some of my remotes as well
repeated keys events as soon I'll have some spare time.
Does any of you know a different method to erase last received data
from the device?



2008/2/14, Filippo Argiolas [EMAIL PROTECTED]:
 No answer?
  Please could someone tell me if is it dangerous to call
  dib0700_rc_setup (from dib0700core.c) every 100ms to reset remote
  control data? Do you know any other method to reset data about last
  key received from the ir sensor?
  Thanks

 Filippo


___
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb


[linux-dvb] wintv nova-t stick, dib0700 and remote controllers..

2008-02-13 Thread Filippo Argiolas
Hi, I've just bought a Hauppauge WinTV Nova-T Stick (model 1156 italy).
It has no remote controller bundled within but it has got a IR sensor
that works good with freshly updated mercurial drivers. So why not to
try some of my tv remotes I've got? I started pressing random keys with
evtest running but nothing happened. So I took a look at dmesg and I've
seen that keycodes are being received but classified as unknown. So my
first question was: why does the driver process keycodes instead of
passing them raw to lirc? I've looked into the code and seen that some
commercial remote is hardcoded into the source. But since my device can
receive almost every rc-5 and rc-6 remote why limit it to some known
commercial one? I've started taking notes of keycodes outputted to
kern.log by my remotes and writing some keymap for them.

I've encountered a problem; all works well with a remote from a philipps
tv but something strange happens with my sony remote let me explain what
i've understood looking at dib0700_devices.c:

1. when a remote key is received device stores key data somewhere
2. after the key press, key data into the device does not change so
retrieving it again ends up with receiving the same key even if nothing
is being pressed!!!

Key data is an array with 3 fields (4 but field 0 is always null), two
of them identifies the keycode and one is called rc_toggle.

With philipps remote:
- i press the volume up key
- the driver retrieves key data with volume up code and toggle bit 0
- the driver stop listening to events with toggle bit 0 to prevent
retrieving the last event still stored into the device.
- i press the volume up key
- the driver retrieves key data with volume up code and toggle bit 1
- ok this is a new a event, we can be sure it's not the old one still
stored and process the event.
Pressing again the same key outputs alternatively toggle bit 0 and 1.

With sony (and with a teac dvd player) remote:
- i press the volume up key
- key data is retrieved but toggle bit is ALWAYS set to 1.
- nothing happens anymore because toggle bit never changes..

I think that this behavior is not the correct one: we limit the number
of working remotes, we cannot listen to repeated keys (holding a key
down toggle bit does not change so we process it as a single keypress).
A good solution would be forcing the device to reset ir data after each
event but I don't know if this is achievable. Maybe calling
dib0700_rc_setup after each poll?

Thanks
Filippo




___
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb