All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] cmd: improve coninfo output formatting
@ 2023-01-28  0:11 Heinrich Schuchardt
  2023-01-28 22:01 ` Simon Glass
  0 siblings, 1 reply; 4+ messages in thread
From: Heinrich Schuchardt @ 2023-01-28  0:11 UTC (permalink / raw)
  To: Tom Rini; +Cc: u-boot, Heinrich Schuchardt

Device name are typically longer than 8 characters. This leads to ragged
output.
Only the I and O bit of the device flags are of interest for the user.
Writing a hexadecimal number is just confusing.

Before the patch the output looked like this:

    => coninfo
    List of available devices:
    pl011@9000000 00000007 IO stdin stdout stderr
    serial   00000003 IO
    usbkbd   00000001 I.

With the patch the output looks like this:

    => coninfo
    List of available devices
    |-- pl011@9000000 (IO)
    |   |-- stdin
    |   |-- stdout
    |   |-- stderr
    |-- serial (IO)
    |-- usbkbd (I)

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 cmd/console.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/cmd/console.c b/cmd/console.c
index 9a1db83c7c..620a961cde 100644
--- a/cmd/console.c
+++ b/cmd/console.c
@@ -22,23 +22,21 @@ static int do_coninfo(struct cmd_tbl *cmd, int flag, int argc,
 
 	/* Scan for valid output and input devices */
 
-	puts ("List of available devices:\n");
+	puts("List of available devices\n");
 
 	list_for_each(pos, list) {
 		dev = list_entry(pos, struct stdio_dev, list);
 
-		printf ("%-8s %08x %c%c ",
-			dev->name,
-			dev->flags,
-			(dev->flags & DEV_FLAGS_INPUT) ? 'I' : '.',
-			(dev->flags & DEV_FLAGS_OUTPUT) ? 'O' : '.');
+		printf("|-- %s (%s%s)\n",
+		       dev->name,
+		       (dev->flags & DEV_FLAGS_INPUT) ? "I" : "",
+		       (dev->flags & DEV_FLAGS_OUTPUT) ? "O" : "");
 
 		for (l = 0; l < MAX_FILES; l++) {
 			if (stdio_devices[l] == dev) {
-				printf ("%s ", stdio_names[l]);
+				printf("|   |-- %s\n", stdio_names[l]);
 			}
 		}
-		putc ('\n');
 	}
 	return 0;
 }
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] cmd: improve coninfo output formatting
  2023-01-28  0:11 [PATCH 1/1] cmd: improve coninfo output formatting Heinrich Schuchardt
@ 2023-01-28 22:01 ` Simon Glass
  2023-01-29 20:58   ` Heinrich Schuchardt
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Glass @ 2023-01-28 22:01 UTC (permalink / raw)
  To: Heinrich Schuchardt; +Cc: Tom Rini, u-boot

On Fri, 27 Jan 2023 at 17:12, Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> Device name are typically longer than 8 characters. This leads to ragged
> output.
> Only the I and O bit of the device flags are of interest for the user.
> Writing a hexadecimal number is just confusing.
>
> Before the patch the output looked like this:
>
>     => coninfo
>     List of available devices:
>     pl011@9000000 00000007 IO stdin stdout stderr
>     serial   00000003 IO
>     usbkbd   00000001 I.
>
> With the patch the output looks like this:
>
>     => coninfo
>     List of available devices
>     |-- pl011@9000000 (IO)
>     |   |-- stdin
>     |   |-- stdout
>     |   |-- stderr
>     |-- serial (IO)
>     |-- usbkbd (I)
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  cmd/console.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

Is there a help update for this?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] cmd: improve coninfo output formatting
  2023-01-28 22:01 ` Simon Glass
@ 2023-01-29 20:58   ` Heinrich Schuchardt
  2023-01-31 14:16     ` Simon Glass
  0 siblings, 1 reply; 4+ messages in thread
From: Heinrich Schuchardt @ 2023-01-29 20:58 UTC (permalink / raw)
  To: Simon Glass; +Cc: Tom Rini, u-boot



On 1/28/23 23:01, Simon Glass wrote:
> On Fri, 27 Jan 2023 at 17:12, Heinrich Schuchardt
> <heinrich.schuchardt@canonical.com> wrote:
>>
>> Device name are typically longer than 8 characters. This leads to ragged
>> output.
>> Only the I and O bit of the device flags are of interest for the user.
>> Writing a hexadecimal number is just confusing.
>>
>> Before the patch the output looked like this:
>>
>>      => coninfo
>>      List of available devices:
>>      pl011@9000000 00000007 IO stdin stdout stderr
>>      serial   00000003 IO
>>      usbkbd   00000001 I.
>>
>> With the patch the output looks like this:
>>
>>      => coninfo
>>      List of available devices
>>      |-- pl011@9000000 (IO)
>>      |   |-- stdin
>>      |   |-- stdout
>>      |   |-- stderr
>>      |-- serial (IO)
>>      |-- usbkbd (I)
>>
>> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
>> ---
>>   cmd/console.c | 14 ++++++--------
>>   1 file changed, 6 insertions(+), 8 deletions(-)
> 
> Reviewed-by: Simon Glass <sjg@chromium.org>
> 
> Is there a help update for this?

The online help does not need a change.

But a man-page in the HTML documentation with an example showing 
reassignment of stdios would be helpful.

In drv_system_init() we create a stdio device called "serial". Do we 
need this dummy device if CONFIG_$(SPL_TPL_)DM_SERIAL=y? I find this 
device duplicating the default serial device confusing.

Best regards

Heinrich

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] cmd: improve coninfo output formatting
  2023-01-29 20:58   ` Heinrich Schuchardt
@ 2023-01-31 14:16     ` Simon Glass
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2023-01-31 14:16 UTC (permalink / raw)
  To: Heinrich Schuchardt; +Cc: Tom Rini, u-boot

Hi Heinrich,

On Sun, 29 Jan 2023 at 13:58, Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
>
>
> On 1/28/23 23:01, Simon Glass wrote:
> > On Fri, 27 Jan 2023 at 17:12, Heinrich Schuchardt
> > <heinrich.schuchardt@canonical.com> wrote:
> >>
> >> Device name are typically longer than 8 characters. This leads to ragged
> >> output.
> >> Only the I and O bit of the device flags are of interest for the user.
> >> Writing a hexadecimal number is just confusing.
> >>
> >> Before the patch the output looked like this:
> >>
> >>      => coninfo
> >>      List of available devices:
> >>      pl011@9000000 00000007 IO stdin stdout stderr
> >>      serial   00000003 IO
> >>      usbkbd   00000001 I.
> >>
> >> With the patch the output looks like this:
> >>
> >>      => coninfo
> >>      List of available devices
> >>      |-- pl011@9000000 (IO)
> >>      |   |-- stdin
> >>      |   |-- stdout
> >>      |   |-- stderr
> >>      |-- serial (IO)
> >>      |-- usbkbd (I)
> >>
> >> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> >> ---
> >>   cmd/console.c | 14 ++++++--------
> >>   1 file changed, 6 insertions(+), 8 deletions(-)
> >
> > Reviewed-by: Simon Glass <sjg@chromium.org>
> >
> > Is there a help update for this?
>
> The online help does not need a change.
>
> But a man-page in the HTML documentation with an example showing
> reassignment of stdios would be helpful.
>
> In drv_system_init() we create a stdio device called "serial". Do we
> need this dummy device if CONFIG_$(SPL_TPL_)DM_SERIAL=y? I find this
> device duplicating the default serial device confusing.

I believe this is the console device for serial and that it is needed.
But please take a look as I may be out of date on that.

Regards,
Simon

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-31 14:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-28  0:11 [PATCH 1/1] cmd: improve coninfo output formatting Heinrich Schuchardt
2023-01-28 22:01 ` Simon Glass
2023-01-29 20:58   ` Heinrich Schuchardt
2023-01-31 14:16     ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.