title: How to send Sysrq programmatically over serial and is CONFIG_MAGIC_SYSRQ_SERIAL required
body: <p>I keep getting the SysRq HELP printout, basically seems i can send over serial the sysrq but it won't accept the next key within 5 seconds ie the command key (b) to reboot.</p>
  <p>I need to send the command programmatically over serial console connection to reboot system.</p>
  <p>I can reboot the system via <code>echo b &gt; /proc/sysrq-trigger</code> and <code>cat /proc/sys/kernel/sysrq</code> is 1 (ie full sysrq is enabled)</p>
  <p>But I notice that kernel (2.6.32) image I'm booting with only has CONFIG_MAGIC_SYSRQ=y and there's no mention of CONFIG_MAGIC_SYSRQ_SERIAL. I'd like to know if that setting is required for 2.6.32 or if it was &quot;assumed enabled&quot; and its only required in new kernels.</p>
  <p>According to <a href="https://cateee.net/lkddb/web-lkddb/MAGIC_SYSRQ_SERIAL.html" rel="nofollow noreferrer">this</a>, I don't need that in my kernel since it was only added to apparently optionally disable sysrq over serial to prevent unwanted triggers.</p>
  <p>Anyway I don't really care if PERL is used or PYTHON or C code with tcsendbreak or any programmatic method to send alt-sysrq-b over /dev/ttyUSB0 to reboot linux over serial. So far all i can do is send break sequence and see output of:</p>
  <pre><code>SysRq : HELP : loglevel(0-9) reBoot Crash terminate-all-tasks(E) memory-full-oom
  l-active-cpus(L) show-memory-usage(M) nice-all-RT-tasks(N) powerOff show-registe
  -blocked-tasks(W)
  </code></pre>
  <p>But the command key sent afterward never does anything. So I'm not sure what's wrong. FYI, the system I'm trying to send sysrq over serial to is an embedded linux system that boots via uboot with uimage and dtb file.</p>
  <p>Instead of using a break signal I would prefer a technique where the code actually sends the Alt-SysRq-b keyboard keys over the serial console connection.</p>