# mmm3k support forum

## vorgas

This is the support forum for people trying to follow the HOWTO on getting multimedia mice to work. The HOW TO is located at https://forums.gentoo.org/viewtopic-p-2854500.html#2854500

----------

## vorgas

 *Quote:*   

> I just cut out the bad if fi block as I didn't found an error to fix.
> 
> Code:
> 
> Checking for kernel 2.6 or greater... [Yes]
> ...

 

Slalomsk8er,

Unfortunately I am on a movie shoot right now, and don't have access to my computer. This stupid Windows comp can't extract a bz2 file, so I'm going to have to make some wild guesses.

It looks like only the automatic configuration of stuff is borked. The compile seemed to work fine. 

It looks like you have evdev enabled and possibly a link for the mouse at /dev/input/mx510 (being that that's a mouse). You should be able to run mmm3k and point it at /dev/input/mx510.

Of course, you still have to map commands to the button presses, as is explained in the README/INSTALL files.

I'm going to see if I can grab a bz2 extractor. In the meantime, if you want, paste the install script here and I'll see if I can figure out what's going on. Or, you can wait for 3 or 4 days when I can back to my comp.

Sorry I couldn't answer your problem straight off.Last edited by vorgas on Thu Apr 27, 2006 11:52 pm; edited 1 time in total

----------

## vorgas

Ok, I was able to get something to extract a bz2 file.

I'm not sure what caused the error during the install procedure. First let's cover that. All the if/then statements were checking was to see if there had been a symbolic link in place. You just want to make sure that /bin/mmm3k and /sbin/mmm3k are both linked to /opt/mmm3k/mmm3k.

Then, you'll want to make sure that there is an /etc/mmm3k/config.sample.

That handles install.sh.

Now, on to configure.sh which caused the error. The problem is I look for /dev/input/event0 to determine if evdev is active. You don't have /dev/input/event0, so the script kicks out.

The best thing to do is to create a symbolic link to event1

```
ln -s /dev/input/event1 /dev/input/event0
```

Everything should work after that. You do NOT want to link the node to your mouse event because then it will create more than one positive match, and begin asking you all sorts of questions.

Once you get a successful install, you should delete the /event0 link.

Now then, it appears that you have a udev link from mx510 to the mouse event. If this is correct, then you can aid the configure script by running it as:

```
./config.sh -n -H mx510
```

If that doesn't work just run ./config.sh normally.

Finally, if you're still having troubles, please run it with the -v switch (./config.sh -v) and post that output here.

----------

## Slalomsk8er

 *vorgas wrote:*   

> Ok, I was able to get something to extract a bz2 file.
> 
> 

 I used winrar before my switch  :Wink:  *Quote:*   

> 
> 
> I'm not sure what caused the error during the install procedure. First let's cover that. All the if/then statements were checking was to see if there had been a symbolic link in place. You just want to make sure that /bin/mmm3k and /sbin/mmm3k are both linked to /opt/mmm3k/mmm3k.
> 
> Then, you'll want to make sure that there is an /etc/mmm3k/config.sample.
> ...

 

All checked and OK.

 *Quote:*   

> 
> 
> Now, on to configure.sh which caused the error. The problem is I look for /dev/input/event0 to determine if evdev is active. You don't have /dev/input/event0, so the script kicks out.
> 
> The best thing to do is to create a symbolic link to event1
> ...

 

I rewrote my udev rules to make links to the eventN as the keyboard is now a link to event0 it now longer substitute it and your config.sh works.

Thanks

----------

## vorgas

Sweet!

I added making the config script work around missing event entries to my TODO list.

If you would, could you tell me the mouse you are using with mmm3k, and/or the keyboard if you are mapping that? Also, I would love to have the config file when you are done. If you call mmm3k with the makeconfig option, it should generate it for you. Please be sure to include the file name. That way I can include it in the package release and future users will have it work automatically.

Be sure to include name and contact info in the file if you want credit.

----------

## Slalomsk8er

Can you change to udev rules your script makes so that it just makes links to the old nodes that the /etc/udev/rules.d/50-udev.rules generates?

I had a mess and X did no longer start (just showed nvidia) because the /dev/input/mx510 was not generated. What ever, it looks cleaner to make links then to define the actual node.

```

cat  /etc/udev/rules.d/10-local.rules 

# Logitech Optical Mouse MX510

KERNEL=="event*", SYSFS{manufacturer}=="Logitech", SYSFS{product}=="USB-PS/2 Optical Mouse", SYSFS{idProduct}=="c01d", SYMLINK="input/mx510", MODE="0644", RUN="/usr/sbin/logitech_applet -e -s 800"

#KERNEL=="event*", SYSFS{manufacturer}=="B16_b_02", SYMLINK+="input/mx510", NAME="%k"

# Logitech Ultraflat Keyboard Y-SX49

KERNEL=="event*", BUS="serio", ID="serio1", SYMLINK="input/ultraflat", MODE="0644"

BUS=="usb", SYSFS{idProduct}=="c01d", SYSFS{idVendor}=="046d", KERNEL=="event*", SYMLINK="input/mmm3k" 
```

```
 ls -lah /dev/input/

insgesamt 0

drwxr-xr-x  2 root root    220  2. Mai 10:12 .

drwxr-xr-x 20 root root    14K  2. Mai 10:12 ..

crw-------  1 root root 13, 64  2. Mai 09:47 event0

crw-------  1 root root 13, 65  2. Mai 09:47 event1

crw-------  1 root root 13, 66  2. Mai 09:47 event2

crw-------  1 root root 13, 67  2. Mai 09:47 event3

crw-r--r--  1 root root 13, 63  2. Mai 09:47 mice

lrwxrwxrwx  1 root root      6  2. Mai 10:12 mmm3k -> event2

crw-r--r--  1 root root 13, 32  2. Mai 09:47 mouse0

lrwxrwxrwx  1 root root      6  2. Mai 07:49 mx510 -> event2

lrwxrwxrwx  1 root root      6  2. Mai 10:12 ultraflat -> event0
```

I hope things are the same after reboot.

About the mapping, I will post the info here after I finished it.

----------

## Slalomsk8er

mmm3k makeconfig /dev/input/mmm3k does not produce a config for me  :Sad: 

```
mmm3k makeconfig /dev/input/mmm3k

Password:

Input driver version is 1.0.0

Input device ID: bus 0x3 vendor 0x46d product 0xc01d version 0x2100

Input device name: "Logitech USB-PS/2 Optical Mouse"

Supported events:

  Event type 0 (Sync)

  Event type 1 (Key)

    Event code 272 (LeftBtn)

    Event code 273 (RightBtn)

    Event code 274 (MiddleBtn)

    Event code 275 (SideBtn)

    Event code 276 (ExtraBtn)

    Event code 277 (ForwardBtn)

    Event code 278 (BackBtn)

    Event code 279 (TaskBtn)

  Event type 2 (Axis)

    Event code 0 (X)

    Event code 1 (Y)

    Event code 8 (Wheel)

Testing ... (interrupt to exit)
```

Nothing happens if I press buttons.

Am I right that the config would be /etc/mmm3k/0xc01d ?

Why not 0x46d_0xc01d (vendor_product) it would reduce the possibility of a false match a lot and the files would sort nice  :Wink: 

<edit>OK, I got it sort of working in the tty. Can it be that Enlightenment DR17 blocks your script in some way?

Maybe state that it is not just PRODUCT that get used by mmm3k as key for the configfile. How about "mmm3k searches for a configuration file with the mmm3k device key as name. The mmm3k device key consists of the vendor and product IDs from SYSFS (SYSFS{idVendor}SYSFS{idProduct}) as used in udev rules." or some thing like this.</edit>

----------

## vorgas

I'll see what I can do. Maybe make it so a udev entry is not created by default. I guess I was expecting people to not have special udev entries already.

You can tell the configure program to not create a udev entry with the -n switch. You could also specify the node to use with -H. In this case, a new node would not have been created.

I'm not sure why nothing is happening when you press a button. In /opt/mmm3k should be a program called evtest. Try running it.

```
/opt/mmm3k/evtest /dev/input/mmm3k

or

/opt/mmm3k/evtest /dev/input/mx510

or

/opt/mmm3k/evtest /dev/input/event2
```

You should get ridiculous amounts of output, even when you move the mouse. I don't need any output from that, just whether or not it worked. If it does work, then it's a problem with mmm3k. If it doesn't work then it's something else blocking or interfering.

And I like your idea about separating product and vendor with an underscore. I'll do that.

----------

## Slalomsk8er

It seems to be X11 that can block a device so evtest (and mmm3k) can not do it's work.

Is there a way to remap the mouse buttons out side of X as I think this could be a huge thing for the users.

I got my mouse to work the X way but I needed days to get it right. A new user might think WTF if he needs to get his mouse to work the way he wants it to.

I am interessted to help build a universal tool to configure a mouse (or every evdev device) under linux.

What are the default mouse buttons 1-32 of the X11R7 and why does evdev order my mouse buttons in this strange way that does not work out of the box? Are there configuration files to change the way evdev interprets buttons?

----------

## vorgas

Honestly, I don't know the answer. This is very disappointing to me. Could you tell me the following:

Which version of X are you using (xorg, x11, and build number)?

Which kernel are you using?

Which window manager / desktop are you using?

When you listed the events codes and mappings earlier, were they accurate? Do you have 8 buttons?

Do you have an xmodmap somewhere remapping things?

What is the input section for the mouse from your X configuration file?

Can you try this:

Kill any running X environment you have: /etc/init.d/xdm stop

As root, start an X session: startx

Look at the output of: cat /proc/bus/input/devices

Find the section for your mouse, then look at the line with the handlers. It starts with "H: Handlers="

Look for eventX

Run evtest as root: /opt/mmm3k/evtest /dev/input/eventX (where X is the number)

Are the buttons initially recognized, as you listed before?

If it doesn't work, try exiting X, and from within a tty, run evtest again:

/opt/mmm3k/evtest /dev/input/eventX

As to making the universal tool, that's what I'm trying to do with mmm3k. Unless there is another program out there that translates any evdev event into any command you want. I'll just have to figure out what mmm stands for now, instead of multi media mouse.

----------

## Slalomsk8er

x11-base/xorg-x11 Installed: 7.0-r1

2.6.16-gentoo-r3

Enlightenment DR17 026

H: Handlers=mouse0 event2

```
mmm3k /dev/input/mx510

Input driver version is 1.0.0

Input device ID: bus 0x3 vendor 0x46d product 0xc01d version 0x2100

Input device name: "Logitech USB-PS/2 Optical Mouse"

Supported events:

  Event type 0 (Sync)

  Event type 1 (Key)

    Event code 272 (LeftBtn)

    Event code 273 (RightBtn)

    Event code 274 (MiddleBtn)

    Event code 275 (SideBtn)

    Event code 276 (ExtraBtn)

    Event code 277 (ForwardBtn)

    Event code 278 (BackBtn)

    Event code 279 (TaskBtn)

  Event type 2 (Axis)

    Event code 0 (X)

    Event code 1 (Y)

    Event code 8 (Wheel)

Testing ... (interrupt to exit)

Aufruf: grep [OPTION]... MUSTER [DATEI]...

»grep --help« gibt Ihnen mehr Informationen.

xdpyinfo:  unable to open display "".

/opt/mmm3k/wininfo.sh: line 7: xprop: command not found

Aufruf: grep [OPTION]... MUSTER [DATEI]...

»grep --help« gibt Ihnen mehr Informationen.

xdpyinfo:  unable to open display "".

/opt/mmm3k/wininfo.sh: line 7: xprop: command not found

3Aufruf: grep [OPTION]... MUSTER [DATEI]...

»grep --help« gibt Ihnen mehr Informationen.

xdpyinfo:  unable to open display "".

/opt/mmm3k/wininfo.sh: line 7: xprop: command not found

...
```

This is the output I get if I run it outside of X11 (evtest has the same errors but in addition it shows the mouse events). Inside X (in xterm and urxvt) it looks like the one I posted above (nothing after: Testing ... (interrupt to exit)). 

Well as my mouse works now the X way (udev rule that starts logitech_applet and  xmodmap -e "pointer = 1 3 2 4 5 8 9 6 7 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32" in a enlightenment start script ) it is a nobrainer to use imwheel to map button 10 to Alt_L|Tab (only a matter of days  :Wink:  ).

About the name, how about multi media mapper for the frontend? I was thinking about the problem with the evdev and X key and button codes. It came a idea to me about a device that listens to a evdev/udev device node like a link but it can be "rewired" with the mmm frontend. So the the mmm is the configuration tool and the place to use the X tools to do the window tricks. I think the the code that spawns the "fake" devices needs to be written in c but the mmm part can be in python. 

One tool to map them all and for as long as needed bind them  :Twisted Evil: 

----------

## vorgas

You said evtest showed the same errors? That's not right because evtest never passes information to another program. I expected the wininfo errors because it's looking for an X window, but of course can't find it. I still have the ability to work in a tty part of the to do.

I'm wondering if in some way logitech_applet/xmodmap aren't interfering. It doesn't make sense because the evdev handler should occur before the X handler. I'll play around with that a bit more when I'm done with this shoot.

Thanks for your perserverence and trying to get it to work for me.

----------

## Slalomsk8er

You are right evtest works like a charm so it must be the output of mmm3k with out x running that produced the error with the events in a mix.

I think it is strange that evtest works in the tty but mmm3k does only print info besids the error if no X is running.Last edited by Slalomsk8er on Thu May 04, 2006 6:56 am; edited 1 time in total

----------

## Slalomsk8er

I was not able to reproduce the mixed output (errors with info). So I believe now that it was evtest but I marked the error in the earlyer mmm3k run and by clicking on the mousewheel, pasted it in to the output of evtest.

I now try to get imwheel to do what I want from it but what are you thinking about splitting the solution to a lowlevel device part and a highlevel configuration tool?

----------

## vorgas

That's exactly what's going on. If you look at the code for mmm3k and evtest you'll find that they are basically the same. I just took out the axis and sync events. Then I formatted the output to be handled by another program that parses the config files.

Because you can have separate actions based on the window, it expects to have X running. I still have to code in a way to determine if you are in a tty.

Because you are getting errors in the tty from mmm3k, then I know that it is working, and passing the info off correctly. But it's not working in X. That means the problem is probably with the handler. Especially, if evtest works fine in X. 

Unfortunately, as I've mentioned, I'm on this movie shoot and don't have access to a linux machine. As soon as I am though, I'll be able to make a debugging version.

If you want, open up /opt/mmm3k/readconfig.py. There is a line at the very end:

print "PRODUCT=" + sys.argv[1] + ...

Copy and paste that line directly in front of the line:

def run_command(thisLine):

That should produce output with every button press. Be sure not to press buttons in the xterm you are running mmm3k from!

Let me know how that works.

----------

## Slalomsk8er

 *Quote:*   

> That means the problem is probably with the handler. Especially, if evtest works fine in X.

 It doesn't work at all in X (xterm and others) but it works if I run sudo /opt/mmm3k/evtest /dev/input/mx510 on the tty regardless of X runing or not.

----------

## vorgas

Are you running mmm3k as root or as a normal user? mmm3k is designed to be run as root.

Does evtest work as a normal user or as root only?

And from this point on, unless I specify otherwise, I am assuming you are running in a terminal within an X session (xterm, eterm, etc).

Were you able to update the readconfig.py file? Try doing that, then running mmm3k as root.

And thank you for your patience and help with this. I know you already have a working solution. It means a lot to me that you are helping me work this out, making it better for future users.

----------

## Slalomsk8er

```
Are you running mmm3k as root or as a normal user? mmm3k is designed to be run as root.

Does evtest work as a normal user or as root only?
```

I run it with sudo.

```
sudo /opt/mmm3k/mmm3k /dev/input/mx510

Input driver version is 1.0.0

Input device ID: bus 0x3 vendor 0x46d product 0xc01d version 0x2100

Input device name: "Logitech USB-PS/2 Optical Mouse"

Supported events:

  Event type 0 (Sync)

  Event type 1 (Key)

    Event code 272 (LeftBtn)

    Event code 273 (RightBtn)

    Event code 274 (MiddleBtn)

    Event code 275 (SideBtn)

    Event code 276 (ExtraBtn)

    Event code 277 (ForwardBtn)

    Event code 278 (BackBtn)

    Event code 279 (TaskBtn)

  Event type 2 (Axis)

    Event code 0 (X)

    Event code 1 (Y)

    Event code 8 (Wheel)

Testing ... (interrupt to exit)

PRODUCT=46dc01d   CATEGORY=mx510   ACTION=1|Key   CODE=272|LeftBtn   VALUE=1   WINDOW=

Usage: grep [OPTION]... PATTERN [FILE]...

Try `grep --help' for more information.

xdpyinfo:  unable to open display "".

/opt/mmm3k/wininfo.sh: line 7: xprop: command not found

PRODUCT=46dc01d   CATEGORY=mx510   ACTION=1|Key   CODE=272|LeftBtn   VALUE=0   WINDOW=

Usage: grep [OPTION]... PATTERN [FILE]...

Try `grep --help' for more information.

xdpyinfo:  unable to open display "".

/opt/mmm3k/wininfo.sh: line 7: xprop: command not found

PRODUCT=46dc01d   CATEGORY=mx510   ACTION=1|Key   CODE=273|RightBtn   VALUE=1   WINDOW=

Usage: grep [OPTION]... PATTERN [FILE]...

Try `grep --help' for more information.

xdpyinfo:  unable to open display "".

/opt/mmm3k/wininfo.sh: line 7: xprop: command not found

PRODUCT=46dc01d   CATEGORY=mx510   ACTION=1|Key   CODE=273|RightBtn   VALUE=0   WINDOW=

Usage: grep [OPTION]... PATTERN [FILE]...

Try `grep --help' for more information.

xdpyinfo:  unable to open display "".

/opt/mmm3k/wininfo.sh: line 7: xprop: command not found

PRODUCT=46dc01d   CATEGORY=mx510   ACTION=1|Key   CODE=272|LeftBtn   VALUE=1   WINDOW=

Usage: grep [OPTION]... PATTERN [FILE]...

Try `grep --help' for more information.

xdpyinfo:  unable to open display "".

/opt/mmm3k/wininfo.sh: line 7: xprop: command not found
```

Same thing, no events in X but as you can see if I run it outside of X I get some good looking output with the change you asked me to do.

----------

## STEDevil

mmm3k seems to start and work here, but not the maputility

```

/usr/local/mmm3k/scripts/maputility.py

  File "/usr/local/mmm3k/scripts/maputility.py", line 202

    else

       ^

SyntaxError: invalid syntax

```

Same result even if adding VENDOR_PRODUCT after the command

dev-lang/python 

     Installed:           2.4.3-r1

----------

## vorgas

Don't know how that slipped through. Sorry.

Just add a ":", changing "else" to "else:". 

It is important that you not change the tab settings and that your editor does not convert tab to spaces. Python will screw up otherwise.

I'm working on a new release which should be up in a few days. This problem is no longer there.

----------

## d_u_s_t

Hi out there! Just a little dirty hack:

I saw the mmm3k app and found it to be very usefull for my ir remote control which registers itself as a keyboard.

the bad news:

it sends keyevents like plain 1 2 3 [...] to the keyboard handler, even if mmm3k is running. in some cases there needs to be an exclusive device grab which unregisters the device from the keyboard or mouse collector. After searching a while I found the following:

```

ioctl(fd, EVIOCGRAB, 1)

```

so you could vi mmm3k.c and add something like:

```

...

        if (ioctl(fd, EVIOCGVERSION, &version)) {

                perror("mmm3k: can't get version");

                return 1;

        }

+       if (ioctl(fd, EVIOCGRAB, 1) == 0) {

+               printf("exclusive access granted\n");

+       }

+ 

        printf("Input driver version is %d.%d.%d\n",

                version >> 16, (version >> 8) & 0xfff, version & 0xff);

        ioctl(fd, EVIOCGID, id);

...

```

when you start mmm3k it requests exclusive access to the device (like the x6.7/7 evdev module). when mmm3k exits and the device is closed the handlers are automatically reconnected.

It works like a charm for me.

Hope this is helpfull for somebody! 

PS: a command line option would be great  :Wink: 

----------

## vorgas

Love it. Currently I'm working on the 0.50 release and I can put this in. Among other things, it can monitor multiple devices from a single instance. In regards to the command line switch, this becomes extremely problematic because I also have to parse an --axis switch as well. So the combinations get a little rough (although not impossible).

However, I see several options. These allow per button control over blocking (and by extension, per button/window/profile combination).

If a COMMAND= is specified block the normal output. Otherwise let it pass.

If the COMMAND is IGNORE then block the normal output. If it is PASS let it pass.

Add a Block=Yes | Block=No option to the map file.

I welcome any commentary or thoughts along this line. I will say that the default will almost certainly be to allow the keys through. My keyboard has way too many keys for me to go and free up all but 6 of them. And I don't want others to experience keyboards that suddenly stop working.

----------

## vorgas

On a related note: If you guys can please send me all the information about devices you get working that you can.

At the very least, let me know about the product so I can include it in the general list of what works. Including a working map file would be even better. 

You'll also notice in /usr/local/mmm3k/commands there are several files that provide command mappings with real world names for certain windows. These tie in to the maputility. If you have specified a window, these commands become available. If anybody cares to make some for additonal programs (xine, xmms) I would love it. Of course, you can always just comment your commands in the map file and I can convert it from there.

Feel free to PM me or email me at pointlesswaste AT gmail.com (replace the AT, of course).

And as always, thanks everyone for the help.

----------

## d_u_s_t

Just to give my two cents:

Your idears about event blocking sound great! I agree to the default of passing all to handlers and the ability to change behavior for individual events. But I got no idea if there is any ioctl that can do the job of controlling events(and it's really hard to find any docs about event stuff on the internet). I'm really interested, let me know!   :Wink: 

----------

## vorgas

"One loop to ring them all" is available at http://sourceforge.net/projects/mmm3k/. Get it now. Lot's of bug fixes. Ability to block entire devices. Still problems with starting as a service. Oh, and you only have to start one mmm3k to monitor all of your devices. If you're like me (two joysticks, a wheel, a mouse, a keyboard, and a remote control) this is huge.

----------

## vorgas

I do have an idea about why starting as a service causes a crash. When it does this, mmm3k is not able to acces information about the display. Trying to run xdpyinfo and xprop fails catastrophically. The X connection is refused by the server. It's just a mess. So, if anyone has ideas on getting around this, I would be appreciative.

----------

## vorgas

The latest and greatest is now available at http://sourceforge.net/projects/mmm3k. Version 0.51. In order to get around the display permission issues, I split mmm3k up into two parts.

evmon runs as the monitoring daemon. the user space program, mmm3k takes the event info and does what's necessary. That way I can get around those issues.

----------

