@@ -132,10 +132,11 @@ $ sudo tee /usr/lib/systemd/system/minitel-getty@.service <<'EOT'
132
132
# (at your option) any later version.
133
133
134
134
[Unit]
135
- Description=Getty on %I
135
+ Description=Serial Getty on %I
136
136
Documentation=man:agetty(8) man:systemd-getty-generator(8)
137
137
Documentation=http://0pointer.de/blog/projects/serial-console.html
138
- After=systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target
138
+ BindsTo=dev-%i.device
139
+ After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target
139
140
After=rc-local.service
140
141
141
142
# If additional gettys are spawned during boot then we should make
@@ -150,36 +151,24 @@ IgnoreOnIsolate=yes
150
151
Conflicts=rescue.service
151
152
Before=rescue.service
152
153
153
- # On systems without virtual consoles, don't start any getty. Note
154
- # that serial gettys are covered by serial-getty@.service, not this
155
- # unit.
156
- ConditionPathExists=/dev/%I
157
-
158
154
[Service]
159
- # the VT is cleared by TTYVTDisallocate
160
155
# The '-o' option value tells agetty to replace 'login' arguments with an
161
156
# option to preserve environment (-p), followed by '--' for safety, and then
162
157
# the entered username.
163
- ExecStart=/sbin/agetty -o '-p -- \\u' --noclear - c %I 4800 m1b-x80 $TERM
158
+ ExecStart=/usr/bin/sh -c "sudo stty -F /dev/ttyUSB0 4800 istrip cs7 parenb -parodd brkint ignpar icrnl ixon ixany opost onlcr cread hupcl isig icanon echo echoe echok && / sbin/agetty -o '-p -- \\u' -c %I 4800 m1b-x80 $TERM"
164
159
Type=idle
165
160
Restart=always
166
- RestartSec=0
167
161
UtmpIdentifier=%I
168
162
TTYPath=/dev/%I
169
163
TTYReset=yes
170
164
TTYVHangup=yes
171
- TTYVTDisallocate=yes
172
165
IgnoreSIGPIPE=no
173
166
SendSIGHUP=yes
174
167
175
- # Unset locale for the console getty since the console has problems
176
- # displaying some internationalized messages.
177
- UnsetEnvironment=LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDEN>
178
-
179
168
[Install]
180
169
WantedBy=getty.target
181
- DefaultInstance=tty1
182
170
EOT
171
+ $ sudo chcon -t tty_device_t /dev/ttyUSB0
183
172
$ sudo systemctl daemon-reload
184
173
$ sudo systemctl enable --now minitel-getty@ttyUSB0
185
174
```
0 commit comments