* [OSS-Tools] [PATCH platsch 1/5] avoid unnecessary indirections
@ 2023-06-21 14:17 Ulrich Ölmann
2023-06-21 14:17 ` [OSS-Tools] [PATCH platsch 2/5] use pointers to immutable strings for cmdline options Ulrich Ölmann
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Ulrich Ölmann @ 2023-06-21 14:17 UTC (permalink / raw)
To: oss-tools
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
---
platsch.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/platsch.c b/platsch.c
index dfa42dc9d544..c75f934935f2 100644
--- a/platsch.c
+++ b/platsch.c
@@ -398,9 +398,9 @@ static int set_env_connector_mode(drmModeConnector *conn,
for (i = 0; i < conn->count_modes; i++) {
drmModeModeInfo mode = conn->modes[i];
if (mode.hdisplay == width && mode.vdisplay == height) {
- memcpy(&dev->mode, &conn->modes[i], sizeof(dev->mode));
- dev->width = conn->modes[i].hdisplay;
- dev->height = conn->modes[i].vdisplay;
+ memcpy(&dev->mode, &mode, sizeof(dev->mode));
+ dev->width = width;
+ dev->height = height;
break;
}
}
--
2.39.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* [OSS-Tools] [PATCH platsch 2/5] use pointers to immutable strings for cmdline options
2023-06-21 14:17 [OSS-Tools] [PATCH platsch 1/5] avoid unnecessary indirections Ulrich Ölmann
@ 2023-06-21 14:17 ` Ulrich Ölmann
2023-06-21 14:17 ` [OSS-Tools] [PATCH platsch 3/5] allow directory/basename selection via environment Ulrich Ölmann
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Ulrich Ölmann @ 2023-06-21 14:17 UTC (permalink / raw)
To: oss-tools
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
---
platsch.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/platsch.c b/platsch.c
index c75f934935f2..8228b2f8a886 100644
--- a/platsch.c
+++ b/platsch.c
@@ -565,8 +565,8 @@ int main(int argc, char *argv[])
char drmdev[128];
struct modeset_dev *iter;
bool pid1 = getpid() == 1;
- char *dir = "/usr/share/platsch";
- char *base = "splash";
+ const char *dir = "/usr/share/platsch";
+ const char *base = "splash";
int ret = 0, c, i;
if (!pid1) {
--
2.39.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* [OSS-Tools] [PATCH platsch 3/5] allow directory/basename selection via environment
2023-06-21 14:17 [OSS-Tools] [PATCH platsch 1/5] avoid unnecessary indirections Ulrich Ölmann
2023-06-21 14:17 ` [OSS-Tools] [PATCH platsch 2/5] use pointers to immutable strings for cmdline options Ulrich Ölmann
@ 2023-06-21 14:17 ` Ulrich Ölmann
2023-06-21 14:17 ` [OSS-Tools] [PATCH platsch 4/5] README.rst: fix typos Ulrich Ölmann
2023-06-21 14:17 ` [OSS-Tools] [PATCH platsch 5/5] README.rst: fix documented purpose of commandline arguments Ulrich Ölmann
3 siblings, 0 replies; 5+ messages in thread
From: Ulrich Ölmann @ 2023-06-21 14:17 UTC (permalink / raw)
To: oss-tools
Introduce the possibility to choose the directory searched for the splash-
images, as well as the images' basename via the process' environment
platsch_directory=/usr/share/plitschplatsch
platsch_basename=splosh
with the corresponding commandline parameters still having higher priority
compared to the environment.
The Kernel passes unrecognized key-value parameters not containing dots into
init’s environment [1]. So the above environment variable can be supplied via
the kernel commandline. This also allows dynamic use cases where the bootloader
decides which resolution to use on which connector.
[1] https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
---
README.rst | 12 ++++++++----
platsch.c | 9 +++++++++
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/README.rst b/README.rst
index 07f60177b510..96337bfd49f2 100644
--- a/README.rst
+++ b/README.rst
@@ -74,6 +74,12 @@ file::
Configuration
-------------
+The directory searched for the splash images (default: ``/usr/share/platsch``),
+as well as the image files' basename (default: ``splash``) can be controlled via
+the environment variables ``platsch_directory`` and ``platsch_basename`` (which
+in the case of PID != 1 would be overridden by the corresponding commandline
+parameters, see further downwards).
+
For each connector a corresponding environment variable is looked up::
platsch_<connector-type-name><connector-type-id>_mode
@@ -105,11 +111,9 @@ Debugging
For debugging purposes, platsch recognizes a couple of command line arguments:
-``--directory`` or ``-d`` sets the directory containing the splash screens
-(default: ``/usr/share/platsch``).
+``--directory`` or ``-d`` sets the directory containing the splash screens.
-``--basename`` or ``-b`` sets the prefix of the splash screen file names
-(default: ``splash``).
+``--basename`` or ``-b`` sets the prefix of the splash screen file names.
Contributing
------------
diff --git a/platsch.c b/platsch.c
index 8228b2f8a886..535b589a659a 100644
--- a/platsch.c
+++ b/platsch.c
@@ -567,8 +567,17 @@ int main(int argc, char *argv[])
bool pid1 = getpid() == 1;
const char *dir = "/usr/share/platsch";
const char *base = "splash";
+ const char *env;
int ret = 0, c, i;
+ env = getenv("platsch_directory");
+ if (env)
+ dir = env;
+
+ env = getenv("platsch_basename");
+ if (env)
+ base = env;
+
if (!pid1) {
while ((c = getopt_long(argc, argv, "hd:b:", longopts, NULL)) != EOF) {
switch(c) {
--
2.39.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* [OSS-Tools] [PATCH platsch 4/5] README.rst: fix typos
2023-06-21 14:17 [OSS-Tools] [PATCH platsch 1/5] avoid unnecessary indirections Ulrich Ölmann
2023-06-21 14:17 ` [OSS-Tools] [PATCH platsch 2/5] use pointers to immutable strings for cmdline options Ulrich Ölmann
2023-06-21 14:17 ` [OSS-Tools] [PATCH platsch 3/5] allow directory/basename selection via environment Ulrich Ölmann
@ 2023-06-21 14:17 ` Ulrich Ölmann
2023-06-21 14:17 ` [OSS-Tools] [PATCH platsch 5/5] README.rst: fix documented purpose of commandline arguments Ulrich Ölmann
3 siblings, 0 replies; 5+ messages in thread
From: Ulrich Ölmann @ 2023-06-21 14:17 UTC (permalink / raw)
To: oss-tools
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
---
README.rst | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/README.rst b/README.rst
index 96337bfd49f2..c1e914990ea8 100644
--- a/README.rst
+++ b/README.rst
@@ -1,7 +1,7 @@
platsch - Splash Screen Application
===================================
-platsch is a simple splash screen application meant to be run as pid 1
+platsch is a simple splash screen application meant to be run as PID 1
(``init=/usr/sbin/platsch``).
The image to be displayed for each DRM connector is expected here::
@@ -11,15 +11,15 @@ The image to be displayed for each DRM connector is expected here::
By default platsch uses the first mode on each DRM connector. ``<format>``
defaults to ``RGB565``. See below how to change that behavior.
-Splash screen image must have the specified resolution and format. See
+Splash screen images must have the specified resolution and format. See
below how to generate them.
After displaying the splash screen(s), platsch forks, sending its child to
sleep to keep the DRM device open and the splash image(s) on the display(s).
-Finally platsch gives pid 1 to ``/sbin/init``. Later another application can
+Finally platsch gives PID 1 to ``/sbin/init``. Later another application can
simply take over.
-Seamless transitions are possible (e.g. to *weston* having the same image
+Seamless transitions are possible (e.g. to *Weston* having the same image
configured as background). Depending on the SoC used, the same format might be
required to achieve that.
@@ -100,11 +100,11 @@ Or a resolution of 1920x1080 and ``XRGB8888`` format on ``LVDS-2``::
platsch_lvds2_mode=1920x1080@XRGB8888
The kernel passes unrecognized key-value parameters not containing dots into
-init’s environment, see
+init's environment, see
`Kernel Parameter Documentation <https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html>`_.
-Therefore the above setting can be supplied via the kernel cmdline. This also
-allows dynamic use cases where the bootloader decides which resolution/mode to
-use on which connector.
+Therefore the above settings can be supplied via the kernel commandline. This
+also allows dynamic use cases where the bootloader decides which resolution/mode
+to use on which connector.
Debugging
---------
--
2.39.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* [OSS-Tools] [PATCH platsch 5/5] README.rst: fix documented purpose of commandline arguments
2023-06-21 14:17 [OSS-Tools] [PATCH platsch 1/5] avoid unnecessary indirections Ulrich Ölmann
` (2 preceding siblings ...)
2023-06-21 14:17 ` [OSS-Tools] [PATCH platsch 4/5] README.rst: fix typos Ulrich Ölmann
@ 2023-06-21 14:17 ` Ulrich Ölmann
3 siblings, 0 replies; 5+ messages in thread
From: Ulrich Ölmann @ 2023-06-21 14:17 UTC (permalink / raw)
To: oss-tools
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
---
README.rst | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/README.rst b/README.rst
index c1e914990ea8..e318120605e6 100644
--- a/README.rst
+++ b/README.rst
@@ -106,10 +106,11 @@ Therefore the above settings can be supplied via the kernel commandline. This
also allows dynamic use cases where the bootloader decides which resolution/mode
to use on which connector.
-Debugging
----------
+Commandline Arguments
+---------------------
-For debugging purposes, platsch recognizes a couple of command line arguments:
+If the program is used in later Linux userspace (PID != 1), platsch recognizes a
+couple of command line arguments:
``--directory`` or ``-d`` sets the directory containing the splash screens.
--
2.39.2
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-06-21 14:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-21 14:17 [OSS-Tools] [PATCH platsch 1/5] avoid unnecessary indirections Ulrich Ölmann
2023-06-21 14:17 ` [OSS-Tools] [PATCH platsch 2/5] use pointers to immutable strings for cmdline options Ulrich Ölmann
2023-06-21 14:17 ` [OSS-Tools] [PATCH platsch 3/5] allow directory/basename selection via environment Ulrich Ölmann
2023-06-21 14:17 ` [OSS-Tools] [PATCH platsch 4/5] README.rst: fix typos Ulrich Ölmann
2023-06-21 14:17 ` [OSS-Tools] [PATCH platsch 5/5] README.rst: fix documented purpose of commandline arguments Ulrich Ölmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox