I search keymap.xml & lircmap.xml for MEDION X10
#1
Hey,
i search urgent a keymap.xml and lircmap.xml for my Medion X10 (P/N 20017670).
Image

I use ubuntu 9.04 and XBMC!

Please help me Sad
Thank you!

sensation
Reply
#2
same here.
Reply
#3
Hi,
First try to configure lirc to work with X10 remote, This link may help.
Second remap the keys to a Lircmap.xml file.
Good luck and sorry for my bad english Smile
Reply
#4
What do you mean with remap?

I have copy my lirc.conf and paste it in lircmap.xml
What is with the keymap.xml?

Greezz Laugh
Reply
#5
I have the same RC but it did not work properly with the normal "medion setting".

I works fine using "nVidia_UR88A" ... check this link http://linuxundich.de/de/ubuntu/pc-funkf...-mit-lirc/ for details. In short

Code:
sudo dpkg-reconfigure lirc

and select above nVdia remote control
Reply
#6
I know this is an old thread, but I have the same remote and had some problems with it for which I want to share my solution.
Note that this solution can work for any remote that exhibits the same problem with lirc. Look at the python script for some parameters you might modify.

First of all, I use this config, which is slightly modified from the ati one, with all the correct names for each button: my lirc config file

More important, I had problems with this remote in that I couldn't quickly press the same button multiple times. It would interpret it as a long held press instead of different single button presses. I think not everyone has this problem, but since I had it, some other people with the same remote might have it.

In irw, I would get something like:
Code:
00000014f41f0000 00 right Medion_X10
00000014f41f0000 01 right Medion_X10
00000014f41f0000 02 right Medion_X10
00000014f41f0000 03 right Medion_X10
00000014f41f0000 04 right Medion_X10
00000014f41f0000 05 right Medion_X10
00000014f41f0000 06 right Medion_X10
00000014f41f0000 07 right Medion_X10
00000014f41f0000 08 right Medion_X10
00000014f41f0000 09 right Medion_X10
...
when quickly pressing the same button continuously.

Notice that the counter just keeps increasing instead of resetting to 0.
Normally, a single button press for this remote should result in 5 events (meaning the counter goes from 00 to 04 and would then reset to 00)

This meant that I had to wait like a second between each button press before I could press it again, or it would start scrolling verry quickly, like when the button was held.

I fixed this by creating a python daemon that has to be started after starting lirc, it reads from the socket that lirc sends its data to, changes it and sends it to another socket. The output socket of the python program is the one that xbmc has to connect to, so you need to make sure that lirc outputs to a different socket than /dev/lircd, and make the python script output to /dev/lircd instead.
To test it, you can do this:

Code:
sudo lircd -n --output /dev/lircd_orig
python lirc_adapter.py
irw /dev/lircd

Try pressing quickly or holding a button on the remote. The counter will only go to 4 and then reset to 0.

Now quick key presses will work in xbmc. The negative is that you cannot change the repeat rate or delay of held buttons, but I quite like the values how they are. Anyway, for me this makes the remote much more usable in xbmc. (and any other program for that matter) It's a hack, but at least I'm not hacking the lirc code.

You can find the script here: lirc adapter script

To use this solution permanently, you might want to edit your /etc/init.d/lirc script to use the right options and start the python adapter alongside it.

Update: modified URLs to make sure they remain on the web
Reply
#7
i have the exact same issue with too many button presses.
i'm still looking for a fix.

could u post your lirc init script aswell?
i prolly modified it in the way it should be right?

regards
Reply
#8
Elf1sh Wrote:i have the exact same issue with too many button presses.
i'm still looking for a fix.

could u post your lirc init script aswell?
i prolly modified it in the way it should be right?

regards

Try this.

http://forum.xbmc.org/showthread.php?tid=83590
Reply
#9
My problems existed already on Ubuntu 10.04 and don't seem to have anything to do with the latest kernel update.
After having fiddled with both lirc and xbmc timeout and other settings, and having tried different kernel modules, I gave up and fixed it this way.

I'm still not exactly sure whether my problem is the same as the other threads indicate. It seems different, because with my remote keypresses aren't doubled when you press once, you just cannot press the same button twice within a second or XBMC starts scrolling like a madman.
I know one thing, setting higher delay times doesn't solve anything because at a lower level multiple keypresses keep being transmitted as an ever increasing counter.

After I solved it this way, I can tell you that I'm happily using my medion remote control with XBMC and never had a problem since. I guess that's what counts.
Reply
#10
Here is the startup script. It's a very simple and stupid mod and I didn't make scripts to stop or restart it.

/etc/init.d/lirc
Code:
#! /bin/sh
### BEGIN INIT INFO
# Provides:          lirc
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Starts LIRC daemon.
# Description:       LIRC is used to control different
#                    infrared receivers and transceivers.
### END INIT INFO

load_modules ()
{
    MODULES_MISSING=false

    log_daemon_msg "Loading LIRC modules"
    for mod in $*; do
        if [ $mod = "udev" ]; then
            log_end_msg 0
            log_success_msg "Restarted via udev, don't reload modules"
            break
        else
            modprobe $mod 2> /dev/null || MODULES_MISSING=true
        fi
    done
    log_end_msg $?

    if $MODULES_MISSING; then
        log_failure_msg "Unable to load LIRC kernel modules. Verify your"
        log_failure_msg "selected kernel modules in /etc/lirc/hardware.conf"
        START_LIRCMD=false
        START_LIRCD=false
    fi
}

build_remote_args ()
{
    REMOTE_ARGS="$*"

    #For remote only detection support, we need
    #both REMOTE_DEVICE and TRANSMITTER_DEVICE undefined
    if [ -z "$REMOTE_DEVICE" ] && [ -z "$TRANSMITTER_DEVICE" ] && [ -c $dev ]; then
        REMOTE_DEVICE="$dev"
    fi

    #If we have a REMOTE_DEVICE or REMOTE_DRIVER defined (either because no devices
    #were defined, OR if we explicitly did), then populate REMOTE_ARGS
    if [ ! -z "$REMOTE_DEVICE" ] || [ ! -z "$REMOTE_DRIVER" ]; then
        if [ -n "$REMOTE_DEVICE" ] && [ "$REMOTE_DEVICE" != "none" ]; then
            REMOTE_ARGS="--device=$REMOTE_DEVICE $REMOTE_ARGS"
        fi
    ## MODDED by duststorm: force driver
    #   if [ -n "$REMOTE_DRIVER" ] && [ "$REMOTE_DRIVER" != "none" ]; then
    #       REMOTE_ARGS="--driver=$REMOTE_DRIVER $REMOTE_ARGS"
    #   fi
        REMOTE_ARGS="--driver=atilibusb $REMOTE_ARGS"


        #Now, if we ALSO have a transmitter defined, add some args
        #To make the first lircd listen up
        if [ ! -z "$TRANSMITTER_DEVICE" ] || [ ! -z "$TRANSMITTER_DRIVER" ]; then
            REMOTE_ARGS="$REMOTE_ARGS --listen"
        fi
        ## MODDED by duststorm: use different socket
        #REMOTE_ARGS="--output=$REMOTE_SOCKET $REMOTE_ARGS"
        REMOTE_ARGS="--output=/dev/lircd_orig $REMOTE_ARGS"
    fi
    echo $REMOTE_ARGS
}

build_transmitter_args ()
{
    TRANSMITTER_ARGS="$*"

    #Transmitters must be explicitly be defined
    if [ ! -z "$TRANSMITTER_DEVICE" ] || [ ! -z "$TRANSMITTER_DRIVER" ]; then
        if [ -n "$TRANSMITTER_DEVICE" ] && [ "$TRANSMITTER_DEVICE" != "none" ]; then
            TRANSMITTER_ARGS="--device=$TRANSMITTER_DEVICE $TRANSMITTER_ARGS"
        fi
        if [ -n "$TRANSMITTER_DRIVER" ] && [ "$TRANSMITTER_DRIVER" != "none" ]; then
            TRANSMITTER_ARGS="--driver=$TRANSMITTER_DRIVER $TRANSMITTER_ARGS"
        fi

        #Now, if we ALSO have a remote defined, add some args
        #To make the second lircd connect
        if [ ! -z "$REMOTE_DEVICE" ] || [ ! -z "$REMOTE_DRIVER" ]; then
            TRANSMITTER_ARGS="$TRANSMITTER_ARGS --connect=localhost:8765 --pidfile=/var/run/lirc/lircd1.pid"
        fi
        TRANSMITTER_ARGS="--output=$TRANSMITTER_SOCKET $TRANSMITTER_ARGS"
    fi
    echo $TRANSMITTER_ARGS
}

. /lib/lsb/init-functions

test -f /usr/sbin/lircd || exit 0
test -f /usr/sbin/lircmd || exit 0

START_LIRCMD=true
START_LIRCD=true
START_IREXEC=true


if [ -f /etc/lirc/hardware.conf ];then
    . /etc/lirc/hardware.conf
fi

if [ ! -f /etc/lirc/lircd.conf ] || grep -q "^#UNCONFIGURED" /etc/lirc/lircd.conf; then
    if [ "$1" = "start" ]; then
        log_success_msg "No valid /etc/lirc/lircd.conf has been found."
        log_success_msg "Remote control support has been disabled."
        log_success_msg "Reconfigure LIRC or manually replace /etc/lirc/lircd.conf to enable."
    fi

    START_LIRCD=false
    START_LIRCMD=false
    START_IREXEC=false
fi

if [ ! -f /etc/lirc/lircmd.conf ] || grep -q "^#UNCONFIGURED" /etc/lirc/lircmd.conf; then
    START_LIRCMD=false
fi

if [ ! -f /etc/lirc/lircrc ] || grep -q "^#UNCONFIGURED" /etc/lirc/lircrc; then
    START_IREXEC=false
fi

#We need default socket locations
OLD_SOCKET="/dev/lircd"
if [ -z "$REMOTE_SOCKET" ]; then
    REMOTE_SOCKET="/var/run/lirc/lircd"
fi
if [ -z "$TRANSMITTER_SOCKET" ]; then
    TRANSMITTER_SOCKET="/var/run/lirc/lircd"
    #Now, if we ALSO have a remote defined,
    #change the default transmitter socket
    if [ ! -z "$REMOTE_DEVICE" ] || [ ! -z "$REMOTE_DRIVER" ]; then
        TRANSMITTER_SOCKET="${TRANSMITTER_SOCKET}1"
    fi
fi

case "$1" in
    start)
        if [ "$LOAD_MODULES" = "true" ] && [ "$START_LIRCD" = "true" ]; then
            load_modules $2 $REMOTE_MODULES $TRANSMITTER_MODULES $MODULES
        fi

        if [ "$START_LIRCD" = "true" ]; then
            [ -d "/var/run/lirc" ] || mkdir -p "/var/run/lirc"
            log_daemon_msg "Starting remote control daemon(s) : LIRC "
            REMOTE_LIRCD_ARGS=`build_remote_args $REMOTE_LIRCD_ARGS`
            TRANSMITTER_LIRCD_ARGS=`build_transmitter_args $TRANSMITTER_LIRCD_ARGS`

            #if we have a remote defined, it is primary process
            if [ ! -z "$REMOTE_LIRCD_ARGS" ]; then
                start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/lircd -- $REMOTE_LIRCD_ARGS < /dev/null
                log_end_msg $?
# MODDED by duststorm
             #  if [ -S "$REMOTE_SOCKET" -a "$OLD_SOCKET" != "$REMOTE_SOCKET" ]; then
             #      rm -f $OLD_SOCKET && ln -s $REMOTE_SOCKET $OLD_SOCKET
             #  fi
# Start in-between-daemon and make symlink to new socket location
            sleep 2
            chmod 666 /dev/lircd_orig
            python /home/duststorm/projects/lirc_medion_remote_fix/lirc_adapter.py &
            sleep 2
            chmod 666 /dev/lircd
            if [ ! -f "/var/run/lirc/lircd" ]; then
                ln -s /dev/lircd /var/run/lirc/lircd
            fi
            sleep 1
            chmod 666 /var/run/lirc/lircd

                #now if we additionally have a transmitter defined, it is secondary process
                if [ ! -z "$TRANSMITTER_LIRCD_ARGS" ]; then
                    /usr/sbin/lircd $TRANSMITTER_LIRCD_ARGS < /dev/null
                    if [ -S "$TRANSMITTER_SOCKET" ]; then
                        rm -f ${OLD_SOCKET}1 && ln -s $TRANSMITTER_SOCKET ${OLD_SOCKET}1
                    fi
                fi
            elif [ ! -z "$TRANSMITTER_LIRCD_ARGS" ]; then
                start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/lircd -- $TRANSMITTER_LIRCD_ARGS < /dev/null
                log_end_msg $?
                if [ -S "$TRANSMITTER_SOCKET" -a "$OLD_SOCKET" != "$TRANSMITTER_SOCKET" ]; then
                    rm -f $OLD_SOCKET && ln -s $TRANSMITTER_SOCKET $OLD_SOCKET
                fi
            else
                log_end_msg 1
            fi
        fi

        if [ "$START_LIRCMD" = "true" ]; then
            [ -d "/var/run/lirc" ] || mkdir -p "/var/run/lirc"
            log_daemon_msg "Starting remote control mouse daemon : LIRCMD "
            start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/lircmd < /dev/null
            log_end_msg $?
        fi

        if [ "$START_IREXEC" = "true" ]; then
            [ -d "/var/run/lirc" ] || mkdir -p "/var/run/lirc"
            log_daemon_msg "Starting execution daemon: irexec"
            start-stop-daemon --start --quiet --oknodo --exec /usr/bin/irexec -- -d /etc/lirc/lircrc < /dev/null
            log_end_msg $?
        fi
        ;;
    stop)
        if [ "$START_IREXEC" = "true" ]; then
            log_daemon_msg "Stopping execution daemon: irexec"
            start-stop-daemon --stop --quiet --exec /usr/bin/irexec
            log_end_msg $?
        fi

        if [ "$START_LIRCMD" = "true" ]; then
            log_daemon_msg "Stopping remote control mouse daemon: LIRCMD"
            start-stop-daemon --stop --quiet --exec /usr/sbin/lircmd
            log_end_msg $?
        fi

        if [ "$START_LIRCD" = "true" ]; then
            log_daemon_msg "Stopping remote control daemon(s): LIRC"
            start-stop-daemon --stop --quiet --exec /usr/sbin/lircd
            log_end_msg $?
            [ -h "$OLD_SOCKET" ] && rm -f $OLD_SOCKET
            [ -h "${OLD_SOCKET}1" ] && rm -f ${OLD_SOCKET}1
        fi
        ;;
    reload|force-reload)
        if [ "$START_IREXEC" = "true" ]; then
            start-stop-daemon --stop --quiet --signal 1 --exec /usr/bin/irexec
        fi

        if [ "$START_LIRCD" = "true" ]; then
            start-stop-daemon --stop --quiet --signal 1 --exec /usr/sbin/lircd
        fi

        if [ "$START_LIRCMD" = "true" ]; then
            start-stop-daemon --stop --quiet --signal 1 --exec /usr/sbin/lircmd
        fi
        ;;
    restart)
        $0 stop
        #passes parameter $2 which is possibly our udev paramater
        $0 start $2
        ;;
    *)
        echo "Usage: /etc/init.d/lircd {start|stop|reload|restart|force-reload}"
    exit 1
esac

exit 0
It's the original lirc daemon startup script with two changes: force override the configuration to use atiusb driver, and startup the intermediary script and move around the proper socket files.
You will need to change "/home/duststorm/projects/lirc_medion_remote_fix/lirc_adapter.py" into the location where your script resides.
Reply
#11
For reference I will inline the code of the links in this forum, in case the hosting might ever go down. These are the two same files as linked to in my previous post.

lirc_adapter.py
Code:
#! /usr/bin/env python

# Patching script for fixing faulty Medion X10 remote
# input (or similar)
# This fixes the issue where quickly  repeatet short key presses
# are read like a continuous press.
#
# This script must run in the background while using lirc (start it
# after starting lircd) and will read from the lircd socket, transform
# the data to eliminate the problem, and send it to a different output
# socket. This output socket contains the corrected signals and is the
# one that should be fed to any program using lirc.
import socket,os,sys,threading,thread

class MainServer(object):
    '''Main class of the server'''

    #Settings (change if necessary)
    REPEAT_COUNT = 5    # max sequence number (set to number of repeats for one keypress)
    LIRC_SOCKET = "/dev/lircd_orig"    # input: socket that lirc writes to
    OUTPUT_SOCKET = "/dev/lircd"    # output: socket to output to, let your programs listen to this
    DAEMONIZE = True
    DEBUG = False

    def __init__(self):
        self.connectedClients = []

    def start(self):
        '''Start server'''
        # Connect to input socket
        self.s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
        self.s.connect(MainServer.LIRC_SOCKET)
        print "Listening to socket %s" % MainServer.LIRC_SOCKET

        # Create worker for input processing
        inputWorker = InputWorker(self.s,self)
        inputWorker.start()

        # Create output socket
        self.o = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
        try:
            os.remove(MainServer.OUTPUT_SOCKET)
        except OSError as e:
            print e
        print "Sending output to socket %s" % MainServer.OUTPUT_SOCKET
        self.o.bind(MainServer.OUTPUT_SOCKET)
        os.chmod(MainServer.OUTPUT_SOCKET, 666)
        self.o.listen(5)  # queue up to 5 connect requests before refusing new ones

        # Main loop, wait for incoming connections
        try:
            while True:
                (clientSocket, address) = self.o.accept()
                print "Client connected"
                # add clientsocket to list of clients
                self.connectedClients.append(clientSocket)
        except (KeyboardInterrupt, SystemExit):
            print "Received keyboard interrupt, quitting."

    def broadcastMessage(self, message):
        '''Broadcast message to all connected clients'''
        newClients = []
        for client in self.connectedClients:
            try:
                client.send(message)
                newClients.append(client)
            except Exception:
                print "Error sending to client, disconnect"
                client.close()
        self.connectedClients = newClients

    def quit(self):
        '''Stop main thread and quit server'''
        print "Closing connections"
        self.s.close()
        self.o.close()
        [c.close() for c in self.connectedClients ]
        os._exit(1)


class InputWorker(threading.Thread):
    '''Worker process for handling input'''

    def __init__(self,inputSocket,mainServer):
        threading.Thread.__init__(self)
        self.inputSocket = inputSocket
        self.mainServer = mainServer
        self.daemon = True

    def run(self):
        while True:
            # Listen for new input
            inp = self.inputSocket.recv(1024)
            if not inp:
                print "Connection with lirc socket lost, quitting"
                self.mainServer.quit()
                break
            
            if MainServer.DEBUG:
                print "Received: %s" % inp
            output = self.processInput(inp)
            if MainServer.DEBUG:
                print "Sending: %s" % output
            self.mainServer.broadcastMessage(output)
        
    def processInput(self,inp):
        '''This is where the magic happens.
        This function transforms the lirc input into the output format we want.'''
        try:
            parts = inp.split(" ")
            seqNb = int(parts[1], 16)
            seqNb = seqNb % MainServer.REPEAT_COUNT
            parts[1] = str(hex(seqNb).lstrip("0x")).rjust(2,"0")
            return " ".join(parts)
        except Exception:
            return inp


def daemonize():
    '''Daemonize this server (fork in background)'''
    # Dual fork hack to make process run as a daemon
    # from: http://motomastyle.com/daemonizing-a-python-script/
    if __name__ == "__main__":
        try:
            pid = os.fork()
            if pid > 0:
                sys.exit(0)
        except OSError, e:
            sys.exit(1)
    
        os.chdir("/")
        os.setsid()
        os.umask(0)
    
        try:
            pid = os.fork()
            if pid > 0:
                sys.exit(0)
        except OSError, e:
            sys.exit(1)



## MAIN ##

if MainServer.DAEMONIZE:
    daemonize()

print 'Starting LIRC adapter server'
server = MainServer()
server.start()
print 'Stopping server'

medion-md8080xl-remote.conf
Code:
# Please make this file available to others
# by sending it to <[email protected]>
#
# this config file was automatically generated
# using lirc-0.7.0(atiusb) on Fri Feb 18 01:53:46 2005
#
# contributed by FUX 2005-02-17
#
# brand: Medion
# model no. of remote control: RF Remote Control
#                              FCC ID: B4S20016398
# devices being controlled by this remote:
#
  begin remote
  name  Medion_X10
  bits           16
  eps            30
  aeps          100
  one             0     0
  zero            0     0
  pre_data_bits   8
  pre_data       0x14
  post_data_bits  16
  post_data      0x0
  gap          235996
  toggle_bit_mask 0x80800000
begin codes
tv                       0x000000000000012C
vcr                      0x000000000000022D
dvd                      0x000000000000D904
music                    0x000000000000DB06
radio                    0x000000000000032E
photo                    0x000000000000DA05
preview                  0x000000000000042F
list                     0x0000000000000530
setup                    0x000000000000F01B
desktop                  0x0000000000000631
vol-                     0x000000000000DD08
vol+                     0x000000000000DE09
mute                     0x000000000000D500
ch-                      0x000000000000E10C
ch+                      0x000000000000E00B
red                      0x0000000000000732
green                    0x0000000000000833
yellow                   0x0000000000000934
blue                     0x0000000000000A35
txt                      0x000000000000EB16
1                        0x000000000000E20D
2                        0x000000000000E30E
3                        0x000000000000E40F
4                        0x000000000000E510
5                        0x000000000000E611
6                        0x000000000000E712
7                        0x000000000000E813
8                        0x000000000000E914
9                        0x000000000000EA15
0                        0x000000000000EC17
chsearch                 0x000000000000F11C
del                      0x000000000000F520
ren                      0x0000000000000B36
snapshot                 0x000000000000ED18
left                     0x000000000000F21D
up             0x6F9A
up2                      0xEF1A
right                    0x000000000000F41F
down                     0x000000000000F722
ok                       0x000000000000F31E
acquire                  0x0000000000000C37
editimage                0x0000000000000D38
rewind                   0x000000000000F924
play                     0x000000000000FA25
forward                  0x000000000000FB26
rec                      0x000000000000FC27
stop                     0x000000000000FD28
pause                    0x000000000000FE29
skipr                    0x000000000000F621
fullscreen               0x0000000000000E39
skipf                    0x000000000000F823
dvdmenu                  0x000000000000EE19
off                      0x000000000000D702
dvdaudio                 0x0000000000000F3A
end codes
end remote
Reply



Logout Mark Read Team Forum Stats Members Help
I search keymap.xml & lircmap.xml for MEDION X101
This forum uses Lukasz Tkacz MyBB addons.