Skip to content
This repository has been archived by the owner on Nov 20, 2019. It is now read-only.

Keyboard/mouse when start from service #3

Open
alkabal opened this issue Dec 30, 2018 · 0 comments
Open

Keyboard/mouse when start from service #3

alkabal opened this issue Dec 30, 2018 · 0 comments

Comments

@alkabal
Copy link

alkabal commented Dec 30, 2018

Hi

I have issue when start config from systemd keyboard and mouse does not work and impossible to switch from tty.

If i start from command line over ssh or direct on screen keyboard and mouse work fine using /home/machinekit/cortini/./runXmotion.py

xmotion.service

[Unit]
Description=Cortini Xmotion service
After=getty@tty1
[Service]
Type=simple
ExecStart=/home/machinekit/cortini/./runXmotion.py
User=machinekit
[Install]
WantedBy=multi-user.target

runXmotion.py

#!/usr/bin/python

import sys
import os
import subprocess
import time
from machinekit import launcher
from machinekit import config

launcher.register_exit_handler()
#launcher.set_debug_level(5)
os.chdir(os.path.dirname(os.path.realpath(__file__)))

mkconfig = config.Config()
if 'MACHINEKIT_INI' not in os.environ:  # export for package installs
    os.environ['MACHINEKIT_INI'] = mkconfig.MACHINEKIT_INI
    
if 'HAL_RTMOD_DIR' not in os.environ:  # export for package installs
    os.environ['HAL_RTMOD_DIR'] = '/usr/lib/linuxcnc'
    
#if 'DISPLAY' not in os.environ:  # export for connecting to display
#    os.environ['DISPLAY'] = ':0.0'

try:
    launcher.check_installation()
    launcher.cleanup_session()
    launcher.load_bbio_file('furaday_stepgen.bbio')
    launcher.install_comp('fur.comp')
    launcher.install_comp('toolchanger.comp')
    launcher.start_process('machinekit mainXmotion.ini')
    launcher.register_exit_handler()  # enable on ctrl-C, needs to executed after HAL files
    while True:
        launcher.check_processes()
        time.sleep(1)
except subprocess.CalledProcessError:
    launcher.end_session()
    sys.exit(1)

sys.exit(0)

mainXmotion.ini

[DISPLAY]
 DISPLAY = /home/machinekit/cortini/Xmotion-sudo.sh

Xmotion-sudo.sh

#!/bin/bash
sudo /home/machinekit/Xmotion/bin/release/Xmotion

Br

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant