LoginSignup
0
1

More than 1 year has passed since last update.

raspberry pi zeroをkiosk端末っぽく表示したい

Posted at

51fzONF74wL._AC_.jpg

問題

キーボード、マウスは付けずにkiosk端末(タッチで操作もない、デジタルサイネージ的な)をやりたい。色々検索してみるが、どこから手を付けて良いのかわからない。

lite版を入れてからxwindowシステムなどを素で入れていくやり方も色々試したがエラーが多くうまく行かない。

素のデスクトップ版でどう出来るのか確認

一旦desktop版を入れてみて、まずはzeroでchromium-browser自体でフルスクリーン表示がコマンドからできるかどうかやってみた。

Raspberry Pi OS (Legacy) with desktop
Release date: December 2nd 2021
Kernel version: 5.10

とりあえずサイトを表示してみる
$ chromium-browser https://google.com
フルスクリーンにしてみる
$ chromium-browser --start-fullscreen https://google.com

とりあえずこの辺りは問題なさそう。

遅い

だが、さすがにzeroなので遅い。なので/boot/config.txtをこう言う風に編集。
やったのはoverclockingとGPUのメモリ増加。やったとしても最終的にはまだ全然遅い。

pi@raspberrypi:~ $ cat /boot/config.txt
# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800
##############################################################
# overclocking
##############################################################
# https://retropie.org.uk/docs/Overclocking/#raspberry-pi-zero
##############################################################
arm_freq=1100
gpu_freq=500
core_freq=500
sdram_freq=500
sdram_schmoo=0x02000020
over_voltage=6
over_voltage_sdram=2

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2

[all]
#dtoverlay=vc4-fkms-v3d
##############################################################
# gpu_mem 
# $ sudo raspi-config でも出来るが...
# https://nosubject.io/raspberry-pi4-gpu-memory-configuration/
##############################################################
gpu_mem=256
disable_splash=1

openbox ??

色々検索しているとopenboxでデスクトップ環境を超軽量にして表示しているっぽいが、同じような設定をしても同じように動かない。
タスクマネージャーを表示してパフォーマンスを確認している時、不意にopenboxというプロセスを見つけて下をやってみると

pi@raspberrypi:~ $ openbox --version
Openbox 3.6.1
著作権 (c) 2004   Mikael Magnusson
著作権 (c) 2002   Dana Jansens

This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions. See the file COPYING for details.

最近のイメージには元々入っているっぽい。そしてどうもLXDE上でopenboxが既に動いている?のかな

これを見ると/etc/xdg/lxsession/LXDE-pi/autostartで設定しているっぽい。
が、ユーザーディレクトリ配下~/.config/lxsession/LXDE-pi/autostartに同じ設定をしたほうが綺麗にまとまりそう。

pi@raspberrypi:~ $ cat ~/.config/lxsession/LXDE-pi/autostart
@xset s off
@xset -dpms
@xset s noblank

@xset s off

スクリーンセーバーOFF

@xset -dpms @xset s noblank

ディスプレイのスリープ禁止

~/.config/lxsession/LXDE-pi/autostartを設定した後に再起動してみるとopenboxの生の状態(画面が真っ暗)で起動したっぽい。

にあるように続けて@/home/pi/run.shを書いてみてみた。

# この2行はタスクバーとか表示するのでコメントアウトした
# @lxpanel --profile LXDE
# @pcmanfm --desktop --profile LXDE
@xset s off
@xset -dpms
@xset s noblank

@/home/pi/run.sh
run.sh_参考のサイトは\が消えてるっぽい
#!/bin/sh
/usr/bin/chromium-browser --app=http://your-site \
  --kiosk \
  --noerrdialogs \
  --disable-session-crashed-bubble \
  --disable-infobars \
  --check-for-update-interval=604800 \
  --disable-pinch

これで再起動するとある程度それっぽくなった。最後にマウスが表示されたままなので、

$ sudo apt-get install unclutter

として再度再起動すればマウスカーソルも消えてkiosk的に表示できたが、zeroじゃどうもおそすぎて使用に耐えない。

最後にchromium-browser --helpでオプションを見てみるが、

  • --kiosk
  • --noerrdialogs
  • --disable-session-crashed-bubble
  • --disable-infobars
  • --check-for-update-interval=604800
  • --disable-pinch は --no-touch-pinch

とか無い。この辺は秘伝のタレ的な隠しオプションなのか、実際もう無効なオプションなのか不明。

pi@raspberrypi:~ $ chromium-browser --help
chromium-browser [-h|--help] [-g|--debug] [--temp-profile] [--no-touch-pinch] [options] [URL]

        --verbose               Events logged to stderr.
        -g or --debug           Start within /usr/bin/gdb
        -h or --help            This help screen
        --temp-profile          Start with a new and temporary profile
        --no-touch-pinch        Disable pinch gestures.

 Other supported options are:
troff: <standard input>:117: warning [p 2, 8.5i]: cannot adjust line
       Chromium has hundreds of undocumented command-line flags that are added
       and removed at the whim of the developers.   Here,  we  document  rela‐
       tively stable flags.

       --user-data-dir=DIR
              Specifies  the directory that user data (your "profile") is kept
              in.  Defaults to $HOME/.config/chromium .  Separate instances of
              Chromium must use separate user data directories; repeated invo‐
              cations of chromium-browser will reuse an existing process for a
              given user data directory.

       --app=URL
              Runs URL in "app mode": with no browser toolbars.

       --incognito
              Open in incognito mode.

       --new-window
              If PATH or URL is given, open it in a new window.

       --proxy-server=host:port
              Specify the HTTP/SOCKS4/SOCKS5 proxy server to use for requests.
              This overrides any environment variables or settings picked  via
              the options dialog.  An individual proxy server is specified us‐
              ing the format:

                [<proxy-scheme>://]<proxy-host>[:<proxy-port>]

              Where <proxy-scheme> is the protocol of the proxy server, and is
              one of:

                "http", "socks", "socks4", "socks5".

              If  the  <proxy-scheme>  is omitted, it defaults to "http". Also
              note that "socks" is equivalent to "socks5".

              Examples:

                --proxy-server="foopy:99"
                    Use the HTTP proxy "foopy:99" to load all URLs.

                --proxy-server="socks://foobar:1080"
                    Use the SOCKS v5 proxy "foobar:1080" to load all URLs.

                --proxy-server="socks4://foobar:1080"
                    Use the SOCKS v4 proxy "foobar:1080" to load all URLs.

                --proxy-server="socks5://foobar:66"
                    Use the SOCKS v5 proxy "foobar:66" to load all URLs.

              It is also possible to specify a separate proxy server for  dif‐
              ferent URL types, by prefixing the proxy server specifier with a
              URL specifier:

              Example:

                --proxy-server="https=proxy1:80;http=socks4://baz:1080"
                    Load https://* URLs using the HTTP proxy "proxy1:80".  And
              load http://*
                    URLs using the SOCKS v4 proxy "baz:1080".

       --no-proxy-server
              Disables  the proxy server.  Overrides any environment variables
              or settings picked via the options dialog.

       --proxy-auto-detect
              Autodetect proxy configuration.  Overrides any environment vari‐
              ables or settings picked via the options dialog.

       --proxy-pac-url=URL
              Specify  proxy autoconfiguration URL.  Overrides any environment
              variables or settings picked via the options dialog.

       --password-store=<basic|gnome|kwallet>
              Set the password store to use.  The default is to  automatically
              detect  based  on  the  desktop  environment.  basic selects the
              built in,  unencrypted  password  store.   gnome  selects  Gnome
              keyring.  kwallet selects (KDE) KWallet.  (Note that KWallet may
              not work reliably outside KDE.)

       --version
              Show version information.

       As a GTK+ app, Chromium also obeys GTK+  command-line  flags,  such  as
       --display.  See the GTK documentation for more:

              <http://library.gnome.org/devel/gtk/stable/gtk-running.html>
              <http://library.gnome.org/devel/gtk/stable/gtk-x11.html>

 See 'man chromium-browser' for more details
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1