You are not logged in.

#1 2006-07-24 08:28:55

Galdona
Member
Registered: 2006-03-15
Posts: 196

mouseemu problem

im trying to make mouseemu (http://geekounet.org/powerbook/files/mo … .16.tar.gz) work for arch. the mouseemu package supplies gentoo and debian daemon scripts.
how should they be modified so mouseemu can be used on arch?

these are the scripts:

debian:

#! /bin/sh
#
# init.d script for mouseemu

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/mouseemu
NAME=mouseemu
DESC="mouse emulation daemon"

test -x $DAEMON || exit 0

# Include mouseemu defaults if available
if [ -f /etc/default/mouseemu ] ; then
    . /etc/default/mouseemu
    MOUSEEMU_OPTS="$MID_CLICK $RIGHT_CLICK $SCROLL $TYPING_BLOCK"
fi

set -e

case "$1" in
  start)
    echo -n "Starting $DESC: "
    modprobe -q uinput
    # Give udev some time to create the device node
    sleep 1
    start-stop-daemon --start --quiet --exec $DAEMON -- $MOUSEEMU_OPTS >/dev/null
    echo "$NAME."
    ;;
  stop)
    echo -n "Stopping $DESC: "
    start-stop-daemon --stop --oknodo --retry 3 --quiet --exec $DAEMON >/dev/null
    echo "$NAME."
    ;;
  restart|force-reload)
    echo -n "Restarting $DESC: "
    start-stop-daemon --stop --oknodo --retry 3 --quiet --exec $DAEMON >/dev/null
    start-stop-daemon --start --quiet --exec $DAEMON -- $MOUSEEMU_OPTS >/dev/null
    echo "$NAME."
    ;;
  *)
    N=/etc/init.d/$NAME
    echo "Usage: $N {start|stop|restart|force-reload}" >&2
    exit 1
    ;;
esac

exit 0

gentoo:

#!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2

#MID_CLICK="-middle 0 68"         #F10 with no modifier
#RIGHT_CLICK="-right 0 125"       #Command with no modifier
#SCROLL="-scroll 56"              #Option 
#TYPING_BLOCK="-typing-block 300" #block mouse for 300ms after a keypress

depend() {
    use logger
}

start() {
    ebegin "Starting mouseemu"
    # Source configuration file /etc/mouseemu.conf
    if [ -f /etc/mouseemu.conf ] ; then
           . /etc/mouseemu.conf
    fi
    start-stop-daemon --start --quiet 
        --exec /usr/sbin/mouseemu -- 
            $MID_CLICK $RIGHT_CLICK $SCROLL $TYPING_BLOCK > /var/log/mouseemu.log

    eend $?
}

stop() {
    ebegin "Stopping mouseemu"
    start-stop-daemon --stop --quiet --exec /usr/sbin/mouseemu
    eend $?
}

Offline

#2 2006-07-24 12:59:27

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: mouseemu problem

Take any standard Arch init script - let's say /etc/rc.d/portmap. Copy/rename it, and substitute /usr/sbin/mouseemu for /sbin/portmap, and mouseemu for portmap.

If you intend to use the $MID_CLICK, $RIGHT_CLICK, $SCROLL, and $TYPING_BLOCK variables, create /etc/conf.d/mouseemu, set them there (in the same format as the commented lines in the gentoo script), and add

. /etc/conf.d/mouseemu

at the top of the init script, just after

. /etc/rc.d/functions

That's it - one freshly-baked init script, to go. smile

Offline

#3 2006-07-24 23:41:58

Galdona
Member
Registered: 2006-03-15
Posts: 196

Re: mouseemu problem

Thanks! ok, I used the portmap script as a skeleton and replaced every instance of portmap with mouseemu, and /sbin/portmap with /usr/sbin/mouseemu.

But I am getting a message upon running "/etc/rc.d/mouseemu start", same message that I get if I run the mouseemu exec directly (both as root or as regular user):

 open: No such file or directory

I also already have a /etc/conf.d/mouseemu file:

MID_CLICK="-middle 0 68"         #F10 with no modifier
RIGHT_CLICK="-right 0 125"       #Command with no modifier
SCROLL="-scroll 56"              #Option
TYPING_BLOCK="-typing-block 300" #block mouse for 300ms after a keypress

and this is the daemon script:

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions
. /etc/conf.d/mouseemu

PID=`pidof -o %PPID /usr/sbin/mouseemu`
case "$1" in
  start)
    stat_busy "Starting mouseemu"
    [ -z "$PID" ] && /usr/sbin/mouseemu
    if [ $? -gt 0 ]; then
      stat_fail
    else
      echo $PID > /var/run/mouseemu.pid
      add_daemon mouseemu
      stat_done
    fi
    ;;
  stop)
    stat_busy "Stopping mouseemu"
    [ ! -z "$PID" ]  && kill $PID &> /dev/null
    if [ $? -gt 0 ]; then
      stat_fail
    else
      rm /var/run/mouseemu.pid
      rm_daemon mouseemu
      stat_done
    fi
    ;;
  restart)
    $0 stop
    sleep 1
    $0 start
    ;;
  *)
    echo "usage: $0 {start|stop|restart}"  
esac
exit 0

(I guess this might already be a program-specific problem?)

PS I changed the thread title.

Offline

#4 2006-07-25 00:16:34

test1000
Member
Registered: 2005-04-03
Posts: 834

Re: mouseemu problem

by just glancing over this i think you have to compile mouseemu to use /etc/conf.d that arch uses. If that isn't possible make a symbolic link to the place it wants to open.

or grep the code for that place & change it & recompile(you could also sed it to change it permanently from a PKGBUILD for example)

if you were to run strace on this i suspect it would look like it's trying to open a place that doens't exist.

but then again i could be completely offguard smile


KISS = "It can scarcely be denied that the supreme goal of all theory is to make the irreducible basic elements as simple and as few as possible without having to surrender the adequate representation of a single datum of experience." - Albert Einstein

Offline

#5 2006-07-25 00:34:49

Galdona
Member
Registered: 2006-03-15
Posts: 196

Re: mouseemu problem

hmmm.
this is what mouseemu -h gives:

# mouseemu -h
usage: mouseemu
        [-middle B2_MOD B2_KEY]
        [-right B3_MOD B3_KEY]
        [-scroll SCROLL_MOD]
        [-typing-block DELAY]
        [-device UINPUT_DEVICE]
        [-nofork]
        [-autorescan]
        [-debug]
All modifier and button key arguments are
key scancodes. They can be found in
/usr/src/linux/include/linux/input.h,
or by using `showkey` in a console.
Use decimal values. BTN_LEFT(272) is usable as B2_KEY or B3_KEY.

Default uinput device: /dev/uinput.
Default keys:
        Middle click : none (0 0)
        Right click     : none (0 0)
        Scroll mod.     : Alt (56)
        Default blocking time while typing: 300ms

i tried some things (event1/mouse0 is the mouse)
please look at the last one:

# mouseemu -device /dev/input/event1
# ioctl UI_SET_KEYBIT: Invalid argument

# mouseemu -device /dev/input/mouse0
# ioctl UI_SET_KEYBIT: Inappropriate ioctl for device

# mouseemu -device /dev/input/mouse1
# ioctl UI_SET_KEYBIT: Inappropriate ioctl for device

# mouseemu -device /dev/input/event1 -nofork
mouseemu[1430]: mouseemu 0.15 (C) Colin Leroy <colin>
mouseemu[1430]: using (0+0) as middle button, (0+0) as right button, (56) as scroll.
mouseemu[1430]: Trying to open /dev/input/event1...
mouseemu[1430]:  ok.
ioctl UI_SET_KEYBIT: Invalid argument
mouseemu[1430]: Make sure uinput module is loaded or available in the kernel.
mouseemu[1430]: mouseemu: cleaning...
#

um, what does it mean? should I be using /dev/input/event1 in the first place?

Offline

#6 2006-07-25 06:36:51

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: mouseemu problem

The critical error message is

Make sure uinput module is loaded or available in the kernel.

Modprobe uinput and try again. Assuming it works, add it to your MODULES array in /etc/rc.conf.

test1000 wrote:

by just glancing over this i think you have to compile mouseemu to use /etc/conf.d that arch uses.

/etc/conf.d is the location Arch uses for settings like this - other distros put them elsewhere. There is no need to recompile - you just have to actually use the variables you have set. You have included them in the script

. /etc/conf.d/mouseemu

but you need to add them to the start-up command, as in the gentoo script

/usr/sbin/mouseemu $MID_CLICK $RIGHT_CLICK $SCROLL $TYPING_BLOCK

Offline

#7 2006-07-25 16:23:22

Galdona
Member
Registered: 2006-03-15
Posts: 196

Re: mouseemu problem

Thanks it works now!

Offline

#8 2011-06-28 13:10:09

oleg
Member
Registered: 2008-01-29
Posts: 2

Re: mouseemu problem

This is an old thread, I know, but mouseemu still seems like the most straightforward way to map keys to virtual mouse buttons. However, running X Server 1.10.2 and Linux 2.6.38-ARCH x86_64, I could not get it to work. It did complain on open, which I think is missing config files, but according to threads elsewhere this can be safely ignored. I tried modprobeing uinput and various configurations without any luck. Here is how I wanted to assign AltGr+Click to middle click and menu+click to right click:

$ mouseemu -middle 100 272 -right 127 272
open: No such file or directory

Offline

#9 2011-10-19 01:47:11

groundnuty
Member
Registered: 2010-11-16
Posts: 17

Re: mouseemu problem

got the same error when runing as normal user. mouseemu opens /dev/input/* as well as writes file to /var/run/ so it has to be run as a privileged user. After running it as a root it works fine.. tho it caused pommed demon to stop reating to F* keys.

Offline

#10 2011-10-19 02:21:21

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: mouseemu problem

Necro-bump of a necro-bump of a necro-bump. Time to start a new thread.
Closing.


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

Board footer

Powered by FluxBB