mce_lircd keys repeated

Help
2007-04-17
2013-04-15
  • Robert Fullarton

    Hi Florian,
               I've got a bit of a problem with mce_lircd. The keyboard keys all work but after about 2 sec of releasing a key the key is repeat for ever on the screen as if you are still pressing the key!

    Also it would be great if mce_lircd used the remote keys on the mce keyboard.

    Robert

     
    • Anonymous - 2007-04-17

      Hi Robert,

      in mce_lircd.c are lines starting with "//printf". If you remove the "//" and recompile it, some debug output is sent to the console. Maybe you could post it here. I fear that the release codes are somehow getting lost.

      How would you like to use the remote keys? Those are sent to lirc and with the conf file found somewhere on the main page here, you could decode them.

      Florian

       
    • Robert Fullarton

      Hi Florian,

      I recompiled without the //'s but there was no console output. I had a look in /var/log/messages and found this .

      Apr 17 18:14:27 mythtv kernel: [17258913.000000] input: mce_lircd as /class/input/input4
      Apr 17 18:14:45 mythtv kernel: [17258930.864000] keyboard.c: can't emulate rawmode for keycode 0
      Apr 17 18:14:47 mythtv kernel: [17258933.136000] keyboard.c: can't emulate rawmode for keycode 0

      Rob

       
      • Anonymous - 2007-04-17

        Hi Rob,

        those messages are a bit strange, but they should be no problem. What kernel version are you using? And which receiver?

        Florian

         
    • Anonymous - 2007-04-17

      Excuse me for butting in here but if I've understood things right you need to use lirc_mod_mce (rather than mce_lircd) if you want to use the remote keys on the MCE keyboard at the same time as the keyboard/mouse input (regardless of whether you also have a separate MCE remote control).

      HTH

      Simon

       
    • Anonymous - 2007-04-17

      Simon,

      this depends on the receiver used. If using the MCE receiver, then lirc_mod_mce should be used, but if using another receiver, mce_lircd should be used, but I am not sure whether running lirc and mce_lircd is possible at the same time (haven't tried it).

      Florian

       
      • Anonymous - 2007-04-17

        Florian,

        Gah just when I thought I understood mod_mce! ;-)

        If my experience compiling mod_mce and lirc_mod_mce is anything to go by I suspect it's one or the other.

        Supposedly (ie. according to Microsoft) the MCE keyboard only works with the MCE receiver in which case lirc_mod_mce would need to be used but theoretically (since it's only IR right!?) it should work with any IR receiver ... but since we're dealing with Linux we're way beyond "unsupported"!

        Simon

         
        • Anonymous - 2007-04-17

          Simon,

          lirc_mod_mce and mod_mce are kernel mode drivers which are attached to a usb device. The device is matched by an id, which is coded into the source code. mce_lircd is a user mode program which connects to a lirc driver which itself is connected to the device (usb, serial, whatever). Theoretically mce_lircd is independent on the receiver, but in fact, the receiver needs to deliver raw data. There are some receivers who don't (e.g. irTrans, which I am currently working on) and those won't work with the things presented on this site.

          The raw data simply consists of timing information (i.e. how long was the ir on, how long of etc.). This information carries the information. Basically any ir system works that way, but there are some receivers doing the decoding (transformation of pulse/pause information to (let's simply say) code numbers) on their own (then possibly limited to ir coding standards other than those used for the keyboard).

          Florian

           
    • Robert Fullarton

      Hi Florian,
                 I'm using a home made ir receiver that uses the serial port. When I bought the keyboard I didn't realize it didn't come with a receiver, you have to buy the mce remote to get the receiver!

      lirc won't run when mce_lircd is running, I can run lirc by itself and it works (with the remote keys on the keyboard) ((no repeat problem with the remote keys either))

      But when I run mce_lircd I get the keys repeating endlessly.
      At the moment I'm using ubuntu 6.10 and the kernel is
      Linux mythtv 2.6.17-11-generic #2 SMP Thu Feb 1 19:52:28 UTC 2007 i686 GNU/Linux

      I've also tryed mce_lircd with gentoo with a 2.6.19 kernel a few months ago and had the exact same problem with the repeating keys.

      Rob

       
      • Anonymous - 2007-04-17

        Hi Rob

        When I hear home made receiver, I am assuming that this is some sort of photo transistor hooked to one of the RS232 status line. So the whole timing base comes from the computer itself (since you are using SMP i686, I would think of a hyperthreading Pentium, which should provide enough processing power). However, I guess that somehow the key up events get lost.

        In order to provide a quick and dirty solution, you could change the contents of do_rc5_keys to:

        !-----------------

        static void do_rc5_keys(peak *peaks, int num_peaks)
        {
                int step1[1000];
                unsigned char keycode, mask;
                int i, j, unknown_bits;

                for (i=0, j=0; i<num_peaks; i++) {
                        if (RC5_1_MIN <= peaks[i].duration && peaks[i].duration <= RC5_1_MAX) {
                                step1[j++] = peaks[i].pulse;
                                if (j == 1000)
                                        return;
                        } else if (RC5_2_MIN <= peaks[i].duration && peaks[i].duration <= RC5_2_MAX) {
                                step1[j++] = peaks[i].pulse;
                                if (j == 1000)
                                        return;
                                step1[j++] = peaks[i].pulse;
                                if (j == 1000)
                                        return;
                        }
                }

                if (j&1 && j<1000) step1[j++] = SPACE;

                if (j != RC5_KEY_BUFLEN)
                        return;

                unknown_bits = 0;
                keycode = 0;
                mask = 0;

                for (i=0; i<RC5_KEY_BUFLEN; i+=2) {
                        if (step1[i] == SPACE && step1[i+1] == PULSE) {
                                if (i < RC5_KEY_START) {
                                        unknown_bits <<= 1;
                                } else if (i < RC5_MASK_START) {
                                        keycode <<= 1;
                                } else {
                                        mask <<= 1;
                                }
                        } else if (step1[i] == PULSE && step1[i+1] == SPACE) {
                                if (i < RC5_KEY_START) {
                                        unknown_bits <<= 1;
                                        unknown_bits |= 1;
                                } else if (i < RC5_MASK_START) {
                                        keycode <<= 1;
                                        keycode |= 1;
                                } else {
                                        mask <<= 1;
                                        mask |= 1;
                                }
                        } else {
                                //printf(PROGNAME "RC5: junk\n");
                                return;
                        }
                }

                //printf(PROGNAME " RC5: key=%02X mask=%02X\n", keycode, mask);

                for (i=0; i<7; i++) {
                        unsigned char tc;

                        tc = usb_kbd_keycode[MASK_KEYS + i];

                        if (((mask & (1<<i))>0)) {
                                do_event(EV_KEY, tc, 1);
                        }
                }

                if (keycode) {
                        unsigned char tc;

                        tc = usb_kbd_keycode[keycode];
                        do_event(EV_KEY, tc, 1);
                        do_event(EV_KEY, tc, 0);
                }

                for (i=0; i<7; i++) {
                        unsigned char tc;

                        tc = usb_kbd_keycode[MASK_KEYS + i];

                        if (((mask & (1<<i))>0)) {
                                do_event(EV_KEY, tc, 0);
                        }
                }
        }

        !----------------------

        Please note that I did not test this.

        This should reset each key as pressed, so when holding down a key, the repetition does not come from the kernel, but from the keyboard itself.

        If you provide me with the schematics used for your receiver and the lirc module you are using, then maybe I could get out my soldering iron and try that on my own.

        Florian

         
        • Anonymous - 2007-04-17

          That looks ugly. I'm preparing a patch.

           
    • Anonymous - 2007-04-17
       
    • Robert Fullarton

      Hi Florian,
      I'm using the circuit on the lirc web site. it works with other remotes ok, I'm just using lirc_serial.
      http://www.lirc.org/receivers.html

      Robert

       
    • Robert Fullarton

      hi Fflooriian,

      i can now use the keyboard but the key rrepeat delay is very very short.
      Ii still can'tt start lirc when mce_lirc is running.

      robeeert

       
      • Anonymous - 2007-04-19

        Hi Robert,

        I guess that there is the need for a special version of this software for your serial receiver. The repetition comes from the keyboard itself and somehow needs to be reduced (or the recognition of the key up event needs to be improved). I don't know if using lirc and the keyboard at the same time is possible. I need to take a deeper look into the lirc architecture.

        Florian

         
    • Anonymous - 2007-04-24

      Hi Robert,

      I finally got the time to build a serial receiver and I was able to reproduce the problem you described.

      When I've got a solution, I'll notify you.

      Florian

       
    • Anonymous - 2007-04-24

      Hi Robert,

      I just uploaded a new version of mce_lircd which is now working quite well with the keyboard. Now I'm up to solve the second issue, i.e.   adding a possibility to use lirc the same time.

      Regards,

      Florian

       
    • Anonymous - 2007-04-24

      Florian,

      I've now also seen repeated keys with lirc_mod_mce 0.1.4 (MS' USB receiver) though I wouldn't say I'm holding a key down for 2 seconds - I'm just typing and then all of a sudden a character will repeat.  If I then hit the Backspace key I can interrupt the repeat and delete the extraneous characters but it's annoying and unpredictable.

      Anything I can do to troubleshoot?

      Given your fix to mce_lircd does the same code apply to lirc_mod_mce?

      Simon

       
      • Anonymous - 2007-04-24

        Florian,

        I guess I should've added that I hadn't used the keyboard enough with lirc_mod_mce 0.1.3 so I wouldn't assume that this hiccup has occurred as a result of the changes to the kernel version checks I suggested (and they should have no effect whatsoever!).

        Since I'm still tinkering with my HTPC setup I'm not using 100% at the moment but I should be using it again tonight so I'll try to do some troubleshooting/timings.

        Simon

         
    • Anonymous - 2007-04-24

      Simon,

      the fix was somehow special for the serial driver. The problem is that the serial driver does not inform us when no more data is available, so the read functions waits until new data arrives. I just added some time-out to the read functions and 'faked' some long space (time where the ir is off). The USB receiver delivers such information, so that won't be the cause of your repetitions. I simply guess that the reception is bad (either physically [distance, transmission power] or the software does not detect all of the messages sent to the keyboard). Are your keys always decoded right? If not, you could play around with the time constants (RCX_Y_MIN and RCX_Y_MAX), but your results could get worse.Also you could turn on debugging (load the module with debug=1) and then check the key codes in your syslog. The message "RC5: junk" indicates that a message could not be decoded while "RC5: key=xx mask=yy" shows which keys have been recognized. A zero as key value is the release code. Normally this should be decoded after a key has been released. If this is missing, you will get repetititons.

      If you get a "junk" messages where a release code would be expected, you could change the "return" statement in line 349 to "key=0; mask=0;". With this, an automatic key up event would be generated, if junk is received. I do not know if there are any side effects, but that could be possible.

      Regards,

      Florian

       

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks