0

In Ubuntu 16.04 I have working serial mouse. It may be started from terminal by sudo inputattach --daemon --intellimouse /dev/ttyS0 and starts in boot process having inputattach --intellimouse /dev/ttyS0 line in /etc/rc.local

This is correct, but I failed to find a method for automatic restart after wake up from suspend. By proposition for other serial device I added 99_sermouse_restart executable script to /lib/systemd/system-sleep/ folder with content

#!/bin/bash
#  suspend_inputattach() {
#    inputattach automatically stops on suspend, so no need
#    usr/sbin/inputattach
#}
echo "Elindult..." > /tmp/inputattach_teszt
    resume_inputattach() {
echo "most ugrik..." >> /tmp/inputattach_teszt
# restart input attach program
#    sleep 10s && inputattach --daemon --intellimouse /dev/ttyS0
#    sleep 10s && inputattach --intellimouse /dev/ttyS0 &
    killall inputattach && sleep 10s && inputattach --intellimouse /dev/ttyS0 &
#    inputattach --intellimouse /dev/ttyS0 &
#echo "ugrott..." >> /tmp/inputattach_teszt
    }

    case "$1" in
    post)
    resume_inputattach
#echo "benne volt..." >> /tmp/inputattach_teszt
    ;;
    *)
echo "nincs benne..." >> /tmp/inputattach_teszt
    ;;
    esac
echo $? >> /tmp/inputattach_teszt
echo "befejezte..." >> /tmp/inputattach_teszt

    exit $?

By /tmp/inputattach_teszt

Elindult...
most ugrik...
0
befejezte...

it is obvious, inputattach in it runs with no error, but the mouse doesn't work (have to be activated by the described terminal command). I made trials with modification of inputattach line of the script, but with no success (some of them are in the script as comments).

I found the slices of log (/var/log/Xorg.0.log) generated before, during and after inputattach. The last lines before it (from previous suspend) were removing mouse and its module. iputattach itself generated lines describing the attach process. The later steps of wake up added end of its usability:

[ 62187.541] (II) config/udev: removing device Microsoft MZ Mouse 
[ 62187.560] (II) evdev: Microsoft MZ Mouse: Close 
[ 62187.561] (II) UnloadModule: "evdev" 

I am afraid, the script runs earlier then it would be optimal.

My questions: (1) how to put the script into a later point of resume, or (2) how to avoid the last described step of wake up? Thank you.

  • I GAVE UP. In the narrow sense this topic would not worth the energy invested (there are RS232 connectors on the very old machines only, and after wake up the serial mouse may be started by a single command). I wanted to understand a part of the UBUNTU: how to force the system to start a daemon automatically when it wakes up. I failed. – HGI Feb 1 at 20:57

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.