linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Device to write to all (serial) consoles
@ 2019-08-02 13:23 Paul Menzel
  2019-08-02 16:02 ` Greg Kroah-Hartman
  2019-08-08 14:52 ` Enrico Weigelt, metux IT consult
  0 siblings, 2 replies; 8+ messages in thread
From: Paul Menzel @ 2019-08-02 13:23 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-serial, Linux Kernel Mailing List, Donald Buczek

[-- Attachment #1: Type: text/plain, Size: 682 bytes --]

Dear Linux folks,


On a lot of devices, like servers, you have more than one serial console,
and you do not always know, how they are numbered. Therefore, we start a
console on ttyS0 and ttyS1.

In user space, we also would like to write to both consoles to not worry
about the numbering. Writing to `/dev/console` only write to the active
console.

    $ more /proc/consoles # I think
    tty0                 -WU (EC p  )    4:1
    ttyS0                -W- (E  p a)    4:65
    ttyS1                -W- (E  p a)    4:65

Does a device exist, or can a device be configured so you can write to
all (serial) consoles from user space?


Kind regards,

Paul


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5174 bytes --]

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

* Re: Device to write to all (serial) consoles
  2019-08-02 13:23 Device to write to all (serial) consoles Paul Menzel
@ 2019-08-02 16:02 ` Greg Kroah-Hartman
  2019-08-02 19:59   ` Paul Menzel
  2019-08-08 14:52 ` Enrico Weigelt, metux IT consult
  1 sibling, 1 reply; 8+ messages in thread
From: Greg Kroah-Hartman @ 2019-08-02 16:02 UTC (permalink / raw)
  To: Paul Menzel; +Cc: linux-serial, Linux Kernel Mailing List, Donald Buczek

On Fri, Aug 02, 2019 at 03:23:08PM +0200, Paul Menzel wrote:
> Dear Linux folks,
> 
> 
> On a lot of devices, like servers, you have more than one serial console,
> and you do not always know, how they are numbered. Therefore, we start a
> console on ttyS0 and ttyS1.
> 
> In user space, we also would like to write to both consoles to not worry
> about the numbering. Writing to `/dev/console` only write to the active
> console.

So the same data to multiple console devices with just one userspace
call?  Why?

>     $ more /proc/consoles # I think
>     tty0                 -WU (EC p  )    4:1
>     ttyS0                -W- (E  p a)    4:65
>     ttyS1                -W- (E  p a)    4:65
> 
> Does a device exist, or can a device be configured so you can write to
> all (serial) consoles from user space?

With one syscall, not that I know of, sorry.

greg k-h

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

* Re: Device to write to all (serial) consoles
  2019-08-02 16:02 ` Greg Kroah-Hartman
@ 2019-08-02 19:59   ` Paul Menzel
  2019-08-03  6:46     ` Greg Kroah-Hartman
  2019-08-03 13:23     ` Adam Borowski
  0 siblings, 2 replies; 8+ messages in thread
From: Paul Menzel @ 2019-08-02 19:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-serial, Linux Kernel Mailing List, Donald Buczek

Dear Greg,


On 02.08.19 18:02, Greg Kroah-Hartman wrote:
> On Fri, Aug 02, 2019 at 03:23:08PM +0200, Paul Menzel wrote:

>> On a lot of devices, like servers, you have more than one serial console,
>> and you do not always know, how they are numbered. Therefore, we start a
>> console on ttyS0 and ttyS1.
>>
>> In user space, we also would like to write to both consoles to not worry
>> about the numbering. Writing to `/dev/console` only write to the active
>> console.
> 
> So the same data to multiple console devices with just one userspace
> call?  Why?

Because the cable is always connected to the port on the back side, and 
sometimes the port in the front has ID 0, and the one in the back 1, and 
other times vice versa. We do not want to track that, and it would be 
convenient to just write to both ports.

>>      $ more /proc/consoles # I think
>>      tty0                 -WU (EC p  )    4:1
>>      ttyS0                -W- (E  p a)    4:65
>>      ttyS1                -W- (E  p a)    4:65
>>
>> Does a device exist, or can a device be configured so you can write to
>> all (serial) consoles from user space?
> 
> With one syscall, not that I know of, sorry.

Can such a device be created with udev or so?


Kind regards,

Paul

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

* Re: Device to write to all (serial) consoles
  2019-08-02 19:59   ` Paul Menzel
@ 2019-08-03  6:46     ` Greg Kroah-Hartman
  2019-08-03 13:23     ` Adam Borowski
  1 sibling, 0 replies; 8+ messages in thread
From: Greg Kroah-Hartman @ 2019-08-03  6:46 UTC (permalink / raw)
  To: Paul Menzel; +Cc: linux-serial, Linux Kernel Mailing List, Donald Buczek

On Fri, Aug 02, 2019 at 09:59:06PM +0200, Paul Menzel wrote:
> Dear Greg,
> 
> 
> On 02.08.19 18:02, Greg Kroah-Hartman wrote:
> > On Fri, Aug 02, 2019 at 03:23:08PM +0200, Paul Menzel wrote:
> 
> > > On a lot of devices, like servers, you have more than one serial console,
> > > and you do not always know, how they are numbered. Therefore, we start a
> > > console on ttyS0 and ttyS1.
> > > 
> > > In user space, we also would like to write to both consoles to not worry
> > > about the numbering. Writing to `/dev/console` only write to the active
> > > console.
> > 
> > So the same data to multiple console devices with just one userspace
> > call?  Why?
> 
> Because the cable is always connected to the port on the back side, and
> sometimes the port in the front has ID 0, and the one in the back 1, and
> other times vice versa. We do not want to track that, and it would be
> convenient to just write to both ports.
> 
> > >      $ more /proc/consoles # I think
> > >      tty0                 -WU (EC p  )    4:1
> > >      ttyS0                -W- (E  p a)    4:65
> > >      ttyS1                -W- (E  p a)    4:65
> > > 
> > > Does a device exist, or can a device be configured so you can write to
> > > all (serial) consoles from user space?
> > 
> > With one syscall, not that I know of, sorry.
> 
> Can such a device be created with udev or so?

No, a single device node can not reference multiple device nodes at the
same time, sorry.  That's just not how they work at all.

thanks,

greg k-h

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

* Re: Device to write to all (serial) consoles
  2019-08-02 19:59   ` Paul Menzel
  2019-08-03  6:46     ` Greg Kroah-Hartman
@ 2019-08-03 13:23     ` Adam Borowski
  2019-08-03 13:55       ` Greg Kroah-Hartman
  1 sibling, 1 reply; 8+ messages in thread
From: Adam Borowski @ 2019-08-03 13:23 UTC (permalink / raw)
  To: Paul Menzel
  Cc: Greg Kroah-Hartman, linux-serial, Linux Kernel Mailing List,
	Donald Buczek

On Fri, Aug 02, 2019 at 09:59:06PM +0200, Paul Menzel wrote:
> On 02.08.19 18:02, Greg Kroah-Hartman wrote:
> > On Fri, Aug 02, 2019 at 03:23:08PM +0200, Paul Menzel wrote:
> > > On a lot of devices, like servers, you have more than one serial console,
> > > and you do not always know, how they are numbered. Therefore, we start a
> > > console on ttyS0 and ttyS1.
> 
> Because the cable is always connected to the port on the back side, and
> sometimes the port in the front has ID 0, and the one in the back 1, and
> other times vice versa. We do not want to track that, and it would be
> convenient to just write to both ports.

Sounds like an XY problem then: what you want is not writing to all ports,
but to have the port assignments stable (see also: disk device reordering).


Meow!
-- 
⢀⣴⠾⠻⢶⣦⠀ Latin:   meow 4 characters, 4 columns,  4 bytes
⣾⠁⢠⠒⠀⣿⡁ Greek:   μεου 4 characters, 4 columns,  8 bytes
⢿⡄⠘⠷⠚⠋  Runes:   ᛗᛖᛟᚹ 4 characters, 4 columns, 12 bytes
⠈⠳⣄⠀⠀⠀⠀ Chinese: 喵   1 character,  2 columns,  3 bytes <-- best!

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

* Re: Device to write to all (serial) consoles
  2019-08-03 13:23     ` Adam Borowski
@ 2019-08-03 13:55       ` Greg Kroah-Hartman
  2019-08-03 15:15         ` Adam Borowski
  0 siblings, 1 reply; 8+ messages in thread
From: Greg Kroah-Hartman @ 2019-08-03 13:55 UTC (permalink / raw)
  To: Adam Borowski
  Cc: Paul Menzel, linux-serial, Linux Kernel Mailing List, Donald Buczek

On Sat, Aug 03, 2019 at 03:23:23PM +0200, Adam Borowski wrote:
> On Fri, Aug 02, 2019 at 09:59:06PM +0200, Paul Menzel wrote:
> > On 02.08.19 18:02, Greg Kroah-Hartman wrote:
> > > On Fri, Aug 02, 2019 at 03:23:08PM +0200, Paul Menzel wrote:
> > > > On a lot of devices, like servers, you have more than one serial console,
> > > > and you do not always know, how they are numbered. Therefore, we start a
> > > > console on ttyS0 and ttyS1.
> > 
> > Because the cable is always connected to the port on the back side, and
> > sometimes the port in the front has ID 0, and the one in the back 1, and
> > other times vice versa. We do not want to track that, and it would be
> > convenient to just write to both ports.
> 
> Sounds like an XY problem then: what you want is not writing to all ports,
> but to have the port assignments stable (see also: disk device reordering).

You can get that information from the symlinks in /dev/serial/ which
udev creates.


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

* Re: Device to write to all (serial) consoles
  2019-08-03 13:55       ` Greg Kroah-Hartman
@ 2019-08-03 15:15         ` Adam Borowski
  0 siblings, 0 replies; 8+ messages in thread
From: Adam Borowski @ 2019-08-03 15:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Paul Menzel, linux-serial, Linux Kernel Mailing List, Donald Buczek

On Sat, Aug 03, 2019 at 03:55:37PM +0200, Greg Kroah-Hartman wrote:
> On Sat, Aug 03, 2019 at 03:23:23PM +0200, Adam Borowski wrote:
> > On Fri, Aug 02, 2019 at 09:59:06PM +0200, Paul Menzel wrote:
> > > Because the cable is always connected to the port on the back side, and
> > > sometimes the port in the front has ID 0, and the one in the back 1, and
> > > other times vice versa. We do not want to track that, and it would be
> > > convenient to just write to both ports.
> > 
> > Sounds like an XY problem then: what you want is not writing to all ports,
> > but to have the port assignments stable (see also: disk device reordering).
> 
> You can get that information from the symlinks in /dev/serial/ which
> udev creates.

Doesn't seem to work for me, for any ttyS0 ttyS1 ttySAC1 device:

Box one, PCIe card + one USB dongle:
07:00.0 Serial controller: MosChip Semiconductor Technology Ltd. MCS9922 PCIe Multi-I/O Controller
07:00.1 Serial controller: MosChip Semiconductor Technology Ltd. MCS9922 PCIe Multi-I/O Controller
Bus 003 Device 004: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter

/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0
/dev/serial/by-path/pci-0000:0b:00.3-usb-0:4:1.0-port0

Only ttyUSB0 is there.


Box two, on-board + one USB dongle:
[    3.404340] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    3.431287] 00:01: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
Bus 001 Device 002: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP2102/CP2109 UART Bridge Controller [CP210x family]

/dev/serial/by-id/usb-Silicon_Labs_CP2104_USB_to_UART_Bridge_Controller_00DB1604-if00-port0
/dev/serial/by-path/pci-0000:00:14.0-usb-0:1:1.0-port0


Box three: RockPro64, euler + USB dongle, kernel 4.4.
Box four: Pine64, euler.
Box five: Odroid-U2, something GPIOish (ttySAC1), kernel 5.0.


Most are running kernel 5.2, Debian unstable.

And indeed, in /lib/udev/rules.d/60-serial.rules :
# /dev/serial/by-path/, /dev/serial/by-id/ for USB devices
KERNEL!="ttyUSB[0-9]*|ttyACM[0-9]*", GOTO="serial_end"


Like me, Paul is using ttyS0 for server-side.


Meow!
-- 
⢀⣴⠾⠻⢶⣦⠀ 
⣾⠁⢰⠒⠀⣿⡁ 10 people enter a bar: 1 who understands binary,
⢿⡄⠘⠷⠚⠋⠀ 1 who doesn't, D who prefer to write it as hex,
⠈⠳⣄⠀⠀⠀⠀ and 1 who narrowly avoided an off-by-one error.

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

* Re: Device to write to all (serial) consoles
  2019-08-02 13:23 Device to write to all (serial) consoles Paul Menzel
  2019-08-02 16:02 ` Greg Kroah-Hartman
@ 2019-08-08 14:52 ` Enrico Weigelt, metux IT consult
  1 sibling, 0 replies; 8+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2019-08-08 14:52 UTC (permalink / raw)
  To: Paul Menzel, Greg Kroah-Hartman
  Cc: linux-serial, Linux Kernel Mailing List, Donald Buczek

On 02.08.19 15:23, Paul Menzel wrote:

> Does a device exist, or can a device be configured so you can write to
> all (serial) consoles from user space?

Why not just writing a little program that listens on a pipe or a pty
and writes out everything to all the tty's you want ?


--mtx

-- 
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
info@metux.net -- +49-151-27565287

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

end of thread, other threads:[~2019-08-08 14:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-02 13:23 Device to write to all (serial) consoles Paul Menzel
2019-08-02 16:02 ` Greg Kroah-Hartman
2019-08-02 19:59   ` Paul Menzel
2019-08-03  6:46     ` Greg Kroah-Hartman
2019-08-03 13:23     ` Adam Borowski
2019-08-03 13:55       ` Greg Kroah-Hartman
2019-08-03 15:15         ` Adam Borowski
2019-08-08 14:52 ` Enrico Weigelt, metux IT consult

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).