Skip to content

Commit

Permalink
Use DC2 instead of ENQ for marker of TTY Resizer
Browse files Browse the repository at this point in the history
  • Loading branch information
YaSuenag committed Jul 9, 2024
1 parent 2d910a9 commit c237820
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions common/common.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023, Yasumasa Suenaga
* Copyright (C) 2023, 2024, Yasumasa Suenaga
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Expand All @@ -19,12 +19,12 @@
#ifndef COMMON_H
#define COMMON_H

#define RESIZER_START_MARKER '\x05'
#define RESIZER_START_MARKER '\x12' // DC2
#define RESIZER_END_MARKER 't'
#define RESIZER_CANCEL_MARKER 'c'
#define RESIZER_SEPARATOR ";"

/* marker (0x05) + ushort (up to 65535) + separator (;) + ushort + end marker */
/* marker (0x12) + ushort (up to 65535) + separator (;) + ushort + end marker */
#define RINGBUF_SZ 13

#endif
4 changes: 2 additions & 2 deletions tty-resizer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ sudo systemctl restart tty-resizer
Send following format command to TTY console:

```
[0x05][Row];[Col]t
[0x12][Row];[Col]t
```

Both `Row` and `Col` are unsigned short.

When `0x05` (ENQ) is received in tty-resizer, subsequent chars are captured in tty-resizer, and they will not propagate to real TTY. `t` is terminator, then capture mode in tty-resizer is finished, and subsequent chars are propagated to real TTY, and `TIOCSWINSZ` ioctl would be issued to the specified TTY. `c` means "cancel" for tty-resizer, then capture mode will be finished, and happens nothing.
When `0x12` (DC2) is received in tty-resizer, subsequent chars are captured in tty-resizer, and they will not propagate to real TTY. `t` is terminator, then capture mode in tty-resizer is finished, and subsequent chars are propagated to real TTY, and `TIOCSWINSZ` ioctl would be issued to the specified TTY. `c` means "cancel" for tty-resizer, then capture mode will be finished, and happens nothing.

0-9 and `;`, `t`, `c` is valid chars on capture mode. Capture mode will be aborted when other char is received - it would be treated as `c`.

Expand Down

0 comments on commit c237820

Please sign in to comment.