2014-09-18 4 views
2

많은 사람들과 마찬가지로, BeagleBone Black boot가 실행될 때 직접 실행되는 Qt 애플리케이션을 갖고 싶습니다. 다음과 같은 다른 주제의 답변을 사용하십시오 : Beaglebone Boot to Qt App; Start QT Application on bootup on an Embedded Linux Device (Beaglebone Black)터치 스크린이있는 Qt 앱으로 BeagleBone 부팅

저는 Angstrom 2012-09-12와 함께 BeagleBone Black revC를 보유하고 있습니다.

나는 다음과 같은 서비스 설치를 부팅 시작하는 내 응용 프로그램을 얻을 달성 :

"autoShow.service" 
[Unit] 
Description=Autorun Qt app 
ConditionFileIsExecutable=/home/root/ShowcaseNice 

[Service] 
Type=simple 
TimeoutStartSec=120 
WorkingDirectory=/home/root 
ExecStart=/bin/sh -c 'source /etc/profile ; /home/root/ShowcaseNice -qws' 
Restart=always 

[Install] 
WantedBy=multi-user.target 

하지만 내 응용 프로그램은 터치 스크린 (4DCAPE-43T)를 통해 터치 인터페이스를 사용하고 작동하지 않습니다 모든. 시스템 응용 프로그램을 실행할 때 tslib 라이브러리가로드되지 않은 것 같습니다.

ConditionPathExists=/dev/input/touchscreen0 

그런 다음 서비스가 응용 프로그램을로드하지 않고 경로가 존재하지 않기 때문에 오류 메시지가 표시됩니다 : 나는 서비스에 [단위]이 줄을 추가 할 때 때문에 추론.

또한 단순한 유휴 상태에서 유형을 바꾸면 BeagleBone이 유휴 모드 일 때만 응용 프로그램을로드하므로 모든 부팅 프로세스가 끝날 때 대부분의 경우 응용 프로그램이로드되기 때문에 때때로 작동합니다.

tslib로드가 끝난 후 응용 프로그램 실행을 보장하는 방법을 찾으려고했지만 서비스가 아닌 tslib를로드하는 것을 찾을 수 없었습니다. 그렇다면 어떻게 실행하기 전에 "/ dev/input/touchscreen0"파일이 이미 존재하는지 어떻게 확인할 수 있습니까?

감사합니다.

PS : 내 프로필 파일이 때문에 환경 변수의 정의로 내 서비스에서 언급 된 바와 같이, 여기있다 :

# /etc/profile: system-wide .profile file for the Bourne shell (sh(1)) 
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...). 

PATH="/usr/local/bin:/usr/bin:/bin" 
EDITOR="/bin/vi"   # needed for packages like cron 
test -z "$TERM" && TERM="vt100" # Basic terminal capab. For screen etc. 

if [ ! -e /etc/localtime ]; then 
    TZ="UTC"  # Time Zone. Look at http://theory.uwinnipeg.ca/gnu/glibc/libc_303.html 
      # for an explanation of how to set this to your local timezone. 
    export TZ 
fi 
if [ "$HOME" = "/home/root" ]; then 
    PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin 
fi 
if [ "$PS1" ]; then 
    # works for bash and ash (no other shells known to be in use here) 
    PS1='\[email protected]\h:\w\$ ' 
fi 
if [ -d /etc/profile.d ]; then 
    for i in /etc/profile.d/* ; do 
     . $i 
    done 
    unset i 
fi 

PATH=$PATH:/opt/qt/lib 
QWS_MOUSE_PROTO="LinuxInput:/dev/input/touchscreen0 MouseMan:/dev/input/mouse2" 
SLOTS=/sys/devices/bone_capemgr.8/slots 
PINS=/sys/kernel/debug/pinctrl/44e10800.pinmux/pins 
export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM QWS_MOUSE_PROTO SLOTS PINS 
echo DM-GPIO-Test > $SLOTS 
umask 022 

EDIT1 :

"autoShow.service" 
[Unit] 
Description=Autorun Qt app 
ConditionFileIsExecutable=/home/root/ShowcaseNice 
After=systemd-modules-load.service 

[Service] 
Type=oneshot 
WorkingDirectory=/home/root 
ExecStart=/bin/sh -c 'source /etc/profile ; /home/root/ShowcaseNice -qws' 
Restart=always 
RemainAfterExit=1; 

[Install] 
WantedBy=multi-user.target 

그리고 : 서비스 파일에 수정 응용 프로그램이 실행 중일 때 (터치 기능이 작동하지 않는 상태) 상태를 확인한 후 다음 결과를 얻습니다.

[email protected]:~# systemctl status systemd-modules-load.service 
systemd-modules-load.service - Load Kernel Modules 
     Loaded: loaded (/lib/systemd/system/systemd-modules-load.service; static) 
     Active: active (exited) since Sat 2000-01-01 01:16:39 CET; 29s ago 
     Docs: man:systemd-modules-load.service(8) 
       man:modules-load.d(5) 
    Process: 89 ExecStart=/lib/systemd/systemd-modules-load (code=exited, status=0/SUCCESS) 
     CGroup: name=systemd:/system/systemd-modules-load.service 
Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable. 

[email protected]:~# systemctl status autoShow.service 
autoShow.service - Autorun Qt app 
     Loaded: loaded (/lib/systemd/system/autoShow.service; enabled) 
     Active: activating (start) since Sat 2000-01-01 01:16:39 CET; 32s ago 
    Main PID: 140 (sh) 
     CGroup: name=systemd:/system/autoShow.service 
      |-140 /bin/sh -c source /etc/profile ; /home/root/ShowcaseNice -qws 
      `-195 /home/root/ShowcaseNice -qws 
Jan 01 01:16:39 beaglebone systemd[1]: Starting Autorun Qt app... 
Jan 01 01:16:45 beaglebone sh[140]: Cannot open mouse input device '/dev/input/touchscreen0': No such file or directory 

[email protected]:~# systemctl status rc-local.service 
rc-local.service 
     Loaded: error (Reason: No such file or directory) 
     Active: inactive (dead) 

EDIT2 : 명제를 결합한 여러 가지 테스트를 수행 한 후에 대부분의 시간 동안 작동하는 것으로 보이는 중간 솔루션을 발견했습니다. 그러나 때로는 터치 기능이 여전히 작동하지 않습니다. systemd (see this post)와 함께 다른 문제를 겪고 있기 때문에 나는 그것을 옆에 두었다.

"autoShow.service" 
[Unit] 
Description=Autorun Qt app 
ConditionFileIsExecutable=/home/root/ShowcaseNice 

[Service] 
[email protected] or getty.target 
Requires=systemd-modules-load.service 
WorkingDirectory=/home/root 
ExecStart=/bin/sh -c 'source /etc/profile ; /home/root/ShowcaseNice -qws' 
Restart=always 
sysVStartPriority=99 
Type=idle 

[Install] 
WantedBy=multi-user.target 
+0

시도해 봤나 = getty @ .service 또는 getty.target –

+0

예, 전에 이미 시도한 및 (심지어 Erik 주어진 낮은 우선 순위 트릭 함께) 다시 시도했지만 작동하지 않습니다. – Puck

답변

1

아무것도 실제로 tslib를로드하지 :

은 여기 내 거의 작업 서비스 파일입니다. 그것은 사용자 토지 라이브러리입니다. systemd가 프로그램을 시작하려고 할 때 장치가 존재하지 않으면 하드웨어의 커널 모듈이 아직로드되지 않았기 때문일 가능성이 큽니다.

서비스에 추가하면 정적으로 정의 된 모든 커널 모듈이로드 된 후 systemd가 프로그램을 시작하게해야합니다.

아직 늦지 않았다면 /etc/rc.local에서 프로그램을 시작하거나 "After = rc-local.service"(execs/etc/rc.노동 조합 지부). /etc/rc.local은 기본적으로 systemd에 의해 시작된 마지막 것이어야합니다.

RC-local.service :

# This file is part of systemd. 
# 
# systemd is free software; you can redistribute it and/or modify it 
# under the terms of the GNU General Public License as published by 
# the Free Software Foundation; either version 2 of the License, or 
# (at your option) any later version. 

[Unit] 
Description=Local customization 

[Service] 
ExecStart=/etc/rc.local start 
TimeoutSec=0 
StandardOutput=tty 
RemainAfterExit=yes 
SysVStartPriority=99 

rc.local 파일이 실행되어야합니다 :

#!/bin/sh 
# 
# This script will be executed *after* all the other init scripts. 
# You can put your own initialization stuff in here if you don't 
# want to do the full Sys V style init stuff. 

나는조차 생각하지 않았다,하지만 당신은 단지 SysVStartPriority = 1을 추가 할 수 있습니다 -99]를 받으십시오. 권장되는 속성이 아니기 때문에 (systemd.service는 그 전후로 권장합니다.) 시스템에서 부팅 과정에있는 것들을 파악하는 것보다 쉽습니다. 그들은 부팅 순서를 보여주기 위해 더 나은 도구가 정말로 필요합니다.

+0

감사! 나는'After = systemd-modules-load.service' 라인을 추가하려고 시도했지만 완전히 성공하지 못했습니다. 유휴 상태로 변경했을 때처럼 작동하는 경우가 있습니다. 항상 그렇지는 않습니다. rc-local.service 또는 /etc/rc.local을 사용하려고했지만 커널에 서비스 나 파일이 존재하지 않았습니다. 3.8.13 ...이 버전에 해당하는 것을 알고 있습니까? (자세한 내용은 EDIT1 참조) – Puck

+0

내 편집보기. rc.local을 다시 사용하여 모든 사용자 정의 항목을 넣을 수 있지만 SysVStartPriority의 트릭을 사용하여 나중에 서비스가 시작되도록 할 수도 있습니다. –

+0

SysVStartPriority 트릭을 시도했지만 여전히 작동하지 않습니다. 유형 = 유휴 상태 만 약간 작동하는 것 같습니다. – Puck

관련 문제