Skip to content

Commit c025a85

Browse files
committed
testing kiosk
1 parent 180e0f4 commit c025a85

File tree

3 files changed

+23
-40
lines changed

3 files changed

+23
-40
lines changed

lib/kiosk_test/application.ex

+18-36
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,28 @@ defmodule KioskTest.Application do
66
use Application
77
require Logger
88

9+
@kiosk_options [
10+
fullscreen: true,
11+
virtualkeyboard: true,
12+
context_menu: false,
13+
sounds: false,
14+
15+
data_dir: "/root/browser/",
16+
homepage: "about:blank",
17+
18+
run_as_root: true,
19+
platform_udev: true,
20+
platform_shared_memory: true,
21+
platform_cache_dir: true,
22+
]
23+
924
def start(_type, _args) do
1025
# See https://hexdocs.pm/elixir/Supervisor.html
11-
# for other strategies and supported options
1226
opts = [strategy: :one_for_one, name: KioskTest.Supervisor]
1327

1428
children =
1529
[
16-
# Children for all targets
17-
# Starts a worker by calling: KioskTest.Worker.start_link(arg)
18-
# {KioskTest.Worker, arg},
30+
{WebengineKiosk, {@kiosk_options, name: Display}},
1931
] ++ children(target())
2032

2133
Supervisor.start_link(children, opts)
@@ -32,51 +44,21 @@ defmodule KioskTest.Application do
3244

3345
def children(_target) do
3446
[
35-
# Children for all targets except host
36-
# Starts a worker by calling: KioskTest.Worker.start_link(arg)
37-
# {KioskTest.Worker, arg},
3847
]
3948
end
4049

4150
def target() do
4251
Application.get_env(:kiosk_test, :target)
4352
end
4453

45-
def platform_init_events(udev_init_delay_ms \\ 5_000) do
46-
# Initialize eudev
47-
:os.cmd('udevd -d');
48-
:os.cmd('udevadm trigger --type=subsystems --action=add');
49-
:os.cmd('udevadm trigger --type=devices --action=add');
50-
:os.cmd('udevadm settle --timeout=30');
51-
Process.sleep(udev_init_delay_ms)
52-
end
53-
54-
def init_kiosk(udev_init \\ true) do
55-
if udev_init, do: platform_init_events()
56-
57-
# Need to set the cache dir to not reside in /tmp/...
58-
System.put_env("XDG_RUNTIME_DIR", "/root/cache/")
59-
# Not sure these are needed now... but it's working and it's late ;)
60-
# System.put_env("QTWEBENGINE_CHROMIUM_FLAGS", " --no-sandbox --remote-debugging-port=1234 ")
61-
# System.put_env("QTWEBENGINE_CHROMIUM_FLAGS", " --no-sandbox ")
62-
63-
# webengine (aka chromium) uses /dev/shm for shared memory.
64-
# On Nerves it maps to devtmpfs which is waay too small.
65-
# Haven't found an option to set the shm file, so we get this hack:
66-
File.rm_rf "/root/shm"
67-
File.mkdir_p! "/root/shm"
68-
File.rm_rf "/dev/shm"
69-
File.ln_s! "/root/shm", "/dev/shm"
70-
71-
Process.sleep(100)
54+
def init_kiosk() do
7255
Logger.info("starting web kiosk")
7356

7457
{:ok, kiosk} = WebengineKiosk.start_link(
7558
fullscreen: true,
59+
virtualkeyboard: true,
7660
data_dir: "/root/browser/",
7761
homepage: "blank",
78-
background_color: "black",
79-
sounds: false,
8062
run_as_root: true)
8163

8264
kiosk

mix.exs

+3-2
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,15 @@ defmodule KioskTest.MixProject do
4040
{:nerves_runtime, "~> 0.11.3", targets: @all_targets},
4141
{:nerves_pack, "~> 0.4.0", targets: @all_targets},
4242

43-
{:webengine_kiosk, "~> 0.3.0", github: "nerves-web-kiosk/webengine_kiosk"},
43+
{:webengine_kiosk, "~> 0.4.0", path: "../webengine_kiosk"},
44+
# {:webengine_kiosk, "~> 0.4.0", github: "elcritch/webengine_kiosk", branch: "devel"},
4445

4546
# Dependencies for specific targets
4647
# {:nerves_system_rpi4, "~> 1.13", runtime: false, targets: :rpi4},
4748

4849
{:nerves_system_rpi4, "~> 1.16.0-webengineV2",
4950
github: "elcritch/nerves_system_rpi4",
50-
tag: "v1.16.0-webengineV2",
51+
tag: "v1.16.0-webengineV3",
5152
runtime: false,
5253
targets: [:rpi4_kiosk]},
5354

mix.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"nerves_system_rpi2": {:hex, :nerves_system_rpi2, "1.15.1", "157126eb234ae1f031b3fa089c1fa9a4bcee425e8a0fa1b0ab9d2d810ec4f870", [:mix], [{:nerves, "~> 1.5.4 or ~> 1.6.0 or ~> 1.7.4", [hex: :nerves, repo: "hexpm", optional: false]}, {:nerves_system_br, "1.15.1", [hex: :nerves_system_br, repo: "hexpm", optional: false]}, {:nerves_toolchain_armv7_nerves_linux_gnueabihf, "~> 1.4.0", [hex: :nerves_toolchain_armv7_nerves_linux_gnueabihf, repo: "hexpm", optional: false]}], "hexpm", "303cf468e2e1da71c4a911dc8402e8ff18f1eddb5ee66ad62855a12a5f972493"},
1818
"nerves_system_rpi3": {:hex, :nerves_system_rpi3, "1.15.1", "93961035d242168258556e1813c310b4e269fd5c0980d95aaed9088a157e6dce", [:mix], [{:nerves, "~> 1.5.4 or ~> 1.6.0 or ~> 1.7.4", [hex: :nerves, repo: "hexpm", optional: false]}, {:nerves_system_br, "1.15.1", [hex: :nerves_system_br, repo: "hexpm", optional: false]}, {:nerves_toolchain_armv7_nerves_linux_gnueabihf, "~> 1.4.2", [hex: :nerves_toolchain_armv7_nerves_linux_gnueabihf, repo: "hexpm", optional: false]}], "hexpm", "ff9a3242e6a07663a62e6b86f88e8aceabcf7b4dd12fe7d4aab58277b979d524"},
1919
"nerves_system_rpi3a": {:hex, :nerves_system_rpi3a, "1.15.1", "004783e91059e2992dfc5a9dfa3a06b35858579e264bad8ced0ff523f349a93e", [:mix], [{:nerves, "~> 1.5.4 or ~> 1.6.0 or ~> 1.7.3", [hex: :nerves, repo: "hexpm", optional: false]}, {:nerves_system_br, "1.15.1", [hex: :nerves_system_br, repo: "hexpm", optional: false]}, {:nerves_toolchain_armv7_nerves_linux_gnueabihf, "~> 1.4.2", [hex: :nerves_toolchain_armv7_nerves_linux_gnueabihf, repo: "hexpm", optional: false]}], "hexpm", "9b68e384177de84951f57af8f6ec26cd134307b3d69dbe8bbe1eca935e7f1fa6"},
20-
"nerves_system_rpi4": {:git, "https://github.com/elcritch/nerves_system_rpi4.git", "12dc92c9fbc0e41bc97adc217fb635891aa6163c", [tag: "v1.16.0-webengineV2"]},
20+
"nerves_system_rpi4": {:git, "https://github.com/elcritch/nerves_system_rpi4.git", "d3e1b2c62a00abdbd3dd51d90e01e4f5d2d09850", [tag: "v1.16.0-webengineV3"]},
2121
"nerves_system_x86_64": {:hex, :nerves_system_x86_64, "1.15.1", "ff859e98ce386ef019548e4eba91724c9467d5d527b08a6ea06d82a2deb2935d", [:mix], [{:nerves, "~> 1.5.4 or ~> 1.6.0 or ~> 1.7.4", [hex: :nerves, repo: "hexpm", optional: false]}, {:nerves_system_br, "1.15.1", [hex: :nerves_system_br, repo: "hexpm", optional: false]}, {:nerves_toolchain_x86_64_nerves_linux_musl, "~> 1.4.2", [hex: :nerves_toolchain_x86_64_nerves_linux_musl, repo: "hexpm", optional: false]}], "hexpm", "8d2de48f56fcf105be511478134eb2b3927b6367e89e3a2f05d3486dbcd00bce"},
2222
"nerves_time": {:hex, :nerves_time, "0.4.2", "38da1774cf18f4561d6e71cb468b7145961e4acc288142a4247c8248cb1e810d", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}, {:muontrap, "~> 0.5", [hex: :muontrap, repo: "hexpm", optional: false]}], "hexpm", "0e5dab49383750790f041b606db2c1165d9a1d762bcc2c53928b294fbfc634ca"},
2323
"nerves_toolchain_aarch64_nerves_linux_gnu": {:hex, :nerves_toolchain_aarch64_nerves_linux_gnu, "1.4.3", "6aa784fd3779251a4438e9874ed646492c3a4289f10581d01c4d61acda7d0b2d", [:mix], [{:nerves, "~> 1.4", [hex: :nerves, repo: "hexpm", optional: false]}, {:nerves_toolchain_ctng, "~> 1.8.4", [hex: :nerves_toolchain_ctng, repo: "hexpm", optional: false]}], "hexpm", "75ab06af12118b423b4bba870a4f10d81f83678fd7fc57278927ce9d52516c5e"},
@@ -36,5 +36,5 @@
3636
"vintage_net_direct": {:hex, :vintage_net_direct, "0.10.1", "3daf4bc86595119f144b4956cbcef0916a2fd8b1238164040f82fe6fa6c1bcd9", [:mix], [{:one_dhcpd, "~> 0.2.3", [hex: :one_dhcpd, repo: "hexpm", optional: false]}, {:vintage_net, "~> 0.9.1 or ~> 0.10.0", [hex: :vintage_net, repo: "hexpm", optional: false]}], "hexpm", "bf0643a1f6533eddcac88ca94d16c52285d0252fe1675b140886c96f0e8ae39d"},
3737
"vintage_net_ethernet": {:hex, :vintage_net_ethernet, "0.10.2", "7af44e5db1a536238061358bb3111f65e6b80157100016b34012ce68d2b34031", [:mix], [{:vintage_net, "~> 0.10.0", [hex: :vintage_net, repo: "hexpm", optional: false]}], "hexpm", "f80d3f8a80cebcf2f2091f46fb8f3f0dee1aea7f4e94890c19cfc512e26e496f"},
3838
"vintage_net_wifi": {:hex, :vintage_net_wifi, "0.10.2", "bec3c9eda658f714512bebc7494d4169ca7556972766c2c7d7e1bb5cae84239c", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}, {:vintage_net, "~> 0.10.0", [hex: :vintage_net, repo: "hexpm", optional: false]}], "hexpm", "666a9e17e54a5c466ae5adce8c5d11e76e7ee8b12de8fb6f3637652cd13776d6"},
39-
"webengine_kiosk": {:git, "https://github.com/nerves-web-kiosk/webengine_kiosk.git", "a339354a499361325ce3aefef3fdb854cf9f2e0b", []},
39+
"webengine_kiosk": {:git, "https://github.com/elcritch/webengine_kiosk.git", "b2ce52311cea07e42291ff39923f937e1e1cb8ce", [branch: "devel"]},
4040
}

0 commit comments

Comments
 (0)