Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #241353 > unrolled thread

sysrq over *USB*

Started byMarc SCHAEFER <schaefer@alphanet.ch>
First post2021-10-15 21:10 +0200
Last post2021-11-21 22:00 +0100
Articles 5 — 3 participants

Back to article view | Back to linux.debian.user


Contents

  sysrq over *USB* Marc SCHAEFER <schaefer@alphanet.ch> - 2021-10-15 21:10 +0200
    Re: sysrq over *USB* Nicholas Geovanis <nickgeovanis@gmail.com> - 2021-10-16 04:40 +0200
      Re: sysrq over *USB* Marc SCHAEFER <schaefer@alphanet.ch> - 2021-10-18 13:10 +0200
        Re: sysrq over *USB* David Wright <deblis@lionunicorn.co.uk> - 2021-10-18 18:20 +0200
    Re: sysrq over *USB* Marc SCHAEFER <schaefer@alphanet.ch> - 2021-11-21 22:00 +0100

#241353 — sysrq over *USB*

FromMarc SCHAEFER <schaefer@alphanet.ch>
Date2021-10-15 21:10 +0200
Subjectsysrq over *USB*
Message-ID<D8AKC-5jE-11@gated-at.bofh.it>
Hello,

I made the following setup work, that is I can send break and '?'
(to get the magic sysrq help) or 's' to do an Emergency sync, and the
kernel logs it:

 laptop                                        apu2
    USB serial port ------- null modem ------- ttyS0 internal 16550A

(an apu2 is an embedded amd64 computer [4])

As it works, of course MAGIC_SYSRQ is enabled, including for serial
ports, and the correct value is in the /proc pseudo-file.

It works with the getty enabled or disabled.

However, the following does not work to support magic sysrq, although
bidirectionnal communication also works with cu [5], with the correct
speed set:

 laptop                                        apu2
    USB serial port ------- null modem ------- USB serial port

First, reading documentation, I thought that this would not be possible
[1], but then, reading kernel source, it looks it should work with my
adapter:

   Oct 11 14:30:56 apu2-init7 kernel: [    9.915105] usb 2-2: pl2303 converter now attached to ttyUSB0

since the driver [2] contains code for magic sysrq, see line 993 for
sysrq mode and line 892 for break handling, with implementation in [3]
(lines 589-597).

I am running Debian buster kernel 4.19.0-18-amd64 on the apu2.

Should I abandon all hope to make it work with USB, or should it work?

Thank your for any pointers.

[1] https://www.kernel.org/doc/Documentation/admin-guide/sysrq.rst
    "On the serial console (PC style standard serial ports only)"

[2] https://github.com/jplozi/linux-4.19/blob/loadbalancing/drivers/usb/serial/pl2303.c

[3] https://github.com/jplozi/linux-4.19/blob/loadbalancing/drivers/usb/serial/generic.c

[4] https://pcengines.ch/apu2.htm

[5] https://linux.die.net/man/1/cu
    from the days before 2003 where I was doing UUCP
       cu -l ttyUSB0 -s 9600

[toc] | [next] | [standalone]


#241360

FromNicholas Geovanis <nickgeovanis@gmail.com>
Date2021-10-16 04:40 +0200
Message-ID<D8HM5-1lF-1@gated-at.bofh.it>
In reply to#241353

[Multipart message — attachments visible in raw view] — view raw

On Fri, Oct 15, 2021 at 2:09 PM Marc SCHAEFER <schaefer@alphanet.ch> wrote:

> Hello,
>
> I made the following setup work, that is I can send break and '?'
> (to get the magic sysrq help) or 's' to do an Emergency sync, and the
> kernel logs it:
>
>  laptop                                        apu2
>     USB serial port ------- null modem ------- ttyS0 internal 16550A
>
> (an apu2 is an embedded amd64 computer [4])
>

It's a side issue, not my main question, but.... If feel some details are
missing in
the "apu2 null modem" block-box there :-)


> As it works, of course MAGIC_SYSRQ is enabled, including for serial
> ports, and the correct value is in the /proc pseudo-file.
>
> It works with the getty enabled or disabled.
>
> However, the following does not work to support magic sysrq, although
> bidirectionnal communication also works with cu [5], with the correct
> speed set:
>
>  laptop                                        apu2
>     USB serial port ------- null modem ------- USB serial port
>

But don't you need to have a running getty now? Listening on the serial
device
file that should be associated with the USB source.

Interesting project though. Any involvement here with MIDI-over-USB?
Tschuss....

First, reading documentation, I thought that this would not be possible
> [1], but then, reading kernel source, it looks it should work with my
> adapter:
>
>    Oct 11 14:30:56 apu2-init7 kernel: [    9.915105] usb 2-2: pl2303
> converter now attached to ttyUSB0
>
> since the driver [2] contains code for magic sysrq, see line 993 for
> sysrq mode and line 892 for break handling, with implementation in [3]
> (lines 589-597).
>
> I am running Debian buster kernel 4.19.0-18-amd64 on the apu2.
>
> Should I abandon all hope to make it work with USB, or should it work?
>
> Thank your for any pointers.
>
> [1] https://www.kernel.org/doc/Documentation/admin-guide/sysrq.rst
>     "On the serial console (PC style standard serial ports only)"
>
> [2]
> https://github.com/jplozi/linux-4.19/blob/loadbalancing/drivers/usb/serial/pl2303.c
>
> [3]
> https://github.com/jplozi/linux-4.19/blob/loadbalancing/drivers/usb/serial/generic.c
>
> [4] https://pcengines.ch/apu2.htm
>
> [5] https://linux.die.net/man/1/cu
>     from the days before 2003 where I was doing UUCP
>        cu -l ttyUSB0 -s 9600
>
>

[toc] | [prev] | [next] | [standalone]


#241447

FromMarc SCHAEFER <schaefer@alphanet.ch>
Date2021-10-18 13:10 +0200
Message-ID<D9yGK-1KL-1@gated-at.bofh.it>
In reply to#241360
Hello,

On Fri, Oct 15, 2021 at 09:33:20PM -0500, Nicholas Geovanis wrote:
> It's a side issue, not my main question, but.... If feel some details are
> missing in
> the "apu2 null modem" block-box there :-)

It may be that your e-mail client is not handling ASCII art properly,
you can look at the correct version here:

   https://lists.debian.org/debian-user/2021/10/msg00658.html

Typically, the null modem is NOT the apu2.

> But don't you need to have a running getty now? Listening on the
> serial device file that should be associated with the USB source.

I have tested with a cu on both sides, so the port is "open" anyway, if
this is required.
 
> Interesting project though. Any involvement here with MIDI-over-USB?

No.

> Tschuss....

[36 useless quote lines removed ]

[toc] | [prev] | [next] | [standalone]


#241459

FromDavid Wright <deblis@lionunicorn.co.uk>
Date2021-10-18 18:20 +0200
Message-ID<D9Dn3-4MB-1@gated-at.bofh.it>
In reply to#241447
On Mon 18 Oct 2021 at 13:06:33 (+0200), Marc SCHAEFER wrote:
> On Fri, Oct 15, 2021 at 09:33:20PM -0500, Nicholas Geovanis wrote:
> > It's a side issue, not my main question, but.... If feel some details are
> > missing in
> > the "apu2 null modem" block-box there :-)
> 
> It may be that your e-mail client is not handling ASCII art properly,
> you can look at the correct version here:
> 
>    https://lists.debian.org/debian-user/2021/10/msg00658.html

It's even simpler; their response at:

    https://lists.debian.org/debian-user/2021/10/msg00665.html

that quotes your post, shows that they're reading technical list
emails in a proportional font, not a fixed one.

Cheers,
David.

[toc] | [prev] | [next] | [standalone]


#242316

FromMarc SCHAEFER <schaefer@alphanet.ch>
Date2021-11-21 22:00 +0100
Message-ID<Dm26l-751-5@gated-at.bofh.it>
In reply to#241353
On Fri, Oct 15, 2021 at 09:02:50PM +0200, Marc SCHAEFER wrote:
> Should I abandon all hope to make it work with USB, or should it work?

Yes, sysrq can work with USB, but not with stock Debian kernels,
because of [1].

Here is the work-around:

1) recompile kernel (see [2]) with the following options:

      CONFIG_USB=y
      CONFIG_USB_SERIAL=y
      CONFIG_USB_SERIAL_CONSOLE=y
      CONFIG_U_SERIAL_CONSOLE=y

2) configure /etc/default/grub with console=ttyUSB0,9600 console=tty0
   and run upgrade-grub

3) I then get:

      # cat /proc/consoles
      tty0                 -WU (EC p  )    4:1
      ttyUSB0              -W- (E  p  )  188:0

and I can then do sysrq from USB:

   schaefer@acer-1:~$ cu -l ttyUSB0 -s 9600
   Connected.
   ~%break
   [ 1633.701624] sysrq: HELP : loglevel(0-9) reboot(b) crash(c)
   terminate-all-tasks(e) memory-full-oom-kill(f) kill-all-tasks(i)
   thaw-filesystems(j) sak(k) show-backtrace-all-active-cpus(l)
   show-memory-usage(m) nice-all-RT-tasks(n) poweroff(o) show-registers(p)
   show-all-timers(q) unraw(r) sync(s) show-task-states(t) unmount(u)
   force-fb(V) show-blocked-tasks(w) dump-ftrace-buffer(z)

Also, the HDMI console still works (logs & sysrq).

The problem and solution was found with help from the kernel-newbies
mailing-list.

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=868352
[2] https://wiki.debian.org/BuildADebianKernelPackage

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web