Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
Have PC, want to use serial connection, not monitor?
-
- Posts: 40
- Joined: 2021-12-23 22:22
Have PC, want to use serial connection, not monitor?
Have a PC, and want to use a USB to Serial connection, rather than a monitor. The PC happen to have a traditional DB-9 serial port as well as USB ports. How do I configure Debian on the PC to use the serial port or one of the USB ports to a serial connection, rather than use a monitor via the VGA port, HDMI, etc. Tried to Google this, but just did not seem to find the right query to find how to do this. Initial setup using typical monitor is fine, but I want to be able to disconnect the monitor and just use a serial connection for input/output.
- FreewheelinFrank
- Global Moderator
- Posts: 2082
- Joined: 2010-06-07 16:59
- Has thanked: 38 times
- Been thanked: 225 times
Re: Have PC, want to use serial connection, not monitor?
Searching "USB to Serial connection linux" gives many results.
The method differs according to the connection.
USB to serial:
https://www.fir3net.com/UNIX/Linux/how- ... linux.html
Serial to USB:
https://stackoverflow.com/questions/534 ... -10-maveri
The first step in either case is to identify the device.
USB to serial:
Serial to USB:
Try those guides and if you get stuck say what you tried and what the output was.
The method differs according to the connection.
USB to serial:
https://www.fir3net.com/UNIX/Linux/how- ... linux.html
Serial to USB:
https://stackoverflow.com/questions/534 ... -10-maveri
The first step in either case is to identify the device.
USB to serial:
Code: Select all
$ lsusb
Code: Select all
# dmesg | grep tty
-
- Posts: 295
- Joined: 2015-06-07 14:38
- Has thanked: 11 times
- Been thanked: 32 times
Re: Have PC, want to use serial connection, not monitor?
https://wiki.archlinux.org/title/workin ... al_console
and of course we can't forget the biggest most current linux wiki there is
and of course we can't forget the biggest most current linux wiki there is
-
- Posts: 40
- Joined: 2021-12-23 22:22
Re: Have PC, want to use serial connection, not monitor?
Guys,
Thanks for the reference links, that is a big help.
I am quite familiar with the typical GND, TX, RX Pin to USB serial cables/adapters that various micro-controllers can use to connect to PCs, for example ESP8266 modules. But my old PC has a DB-9 serial port (likely RS-232 right?), and USB ports. So I need a DB9 to USB or USB to USB based solution. I plan to use PuTTY Serial Port Profile is possible, so I am thinking I just need a Linux driver that can send data to the DP-9 TX pin and receive data on the RX pin, if I use the RS-232 serial port? I need to allow for voltage levels of course, Typical USB to Serial cable I need to ensure the TX and RX signal voltage is 3.3v or 5v depending on what type of adapter I use.
Now if I could some how direct the 'console' of the PC to a specific USB port that is then connected to a USB port on the other system running minicom or PuTTY that would require a USB cross over, cross connected TX to RX and RX to TX and GND common, right? Got some reading to do!
I think this pretty lose to what I need... I need to figure out exactly what my old PC presents for the RS-232, but you guys gave me the references to figure that out, I think. I found the below out on the web and all I need now is a DB-9 to USB cable that as FTDI support.
Various ways to have Linux console session communicate over RS-232
Exert of above...
According to this site a systemd solution may be as simple as
To make use of a serial console, just use console=ttyS0 on the kernel command line, and systemd will automatically start a getty on it for you.
You would probably configure your GRUB2 to do this. Analyze what Arch Wiki says and adjust to your distro, if needed:
To make grub enable the serial console, open /etc/default/grub in an editor. Change the GRUB_CMDLINE_DEFAULT line to start the console on /dev/ttyS0. Note in the example below, we set two consoles up; one on tty0 and one on the serial port.
GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,38400n8"
Now we need to tell grub where is the console and what command to start in order to enable the serial console (Note as above for Linux kernel, one can append multiple input/output terminals in grub e.g. GRUB_TERMINAL="console serial" would enable both display and serial):
## Serial console
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=38400 --unit=0 --word=8 --parity=no --stop=1"
Rebuild the grub.cfg file with following command:
grub-mkconfig -o /boot/grub/grub.cfg
After a reboot, getty will be listening on /dev/ttyS0, expecting 38400 baud, 8 data bits, no parity and one stop bit. When Arch boots, systemd will automatically start a getty session to listen on the same device with the same settings.
Both sites agree that if you do not want GRUB2 to listen on the serial device, but only want getty listening after boot then you will need something like
systemctl enable serial-getty@ttyS0.service
systemctl start serial-getty@ttyS0.service
Thanks for the reference links, that is a big help.
I am quite familiar with the typical GND, TX, RX Pin to USB serial cables/adapters that various micro-controllers can use to connect to PCs, for example ESP8266 modules. But my old PC has a DB-9 serial port (likely RS-232 right?), and USB ports. So I need a DB9 to USB or USB to USB based solution. I plan to use PuTTY Serial Port Profile is possible, so I am thinking I just need a Linux driver that can send data to the DP-9 TX pin and receive data on the RX pin, if I use the RS-232 serial port? I need to allow for voltage levels of course, Typical USB to Serial cable I need to ensure the TX and RX signal voltage is 3.3v or 5v depending on what type of adapter I use.
Now if I could some how direct the 'console' of the PC to a specific USB port that is then connected to a USB port on the other system running minicom or PuTTY that would require a USB cross over, cross connected TX to RX and RX to TX and GND common, right? Got some reading to do!
I think this pretty lose to what I need... I need to figure out exactly what my old PC presents for the RS-232, but you guys gave me the references to figure that out, I think. I found the below out on the web and all I need now is a DB-9 to USB cable that as FTDI support.
Various ways to have Linux console session communicate over RS-232
Exert of above...
According to this site a systemd solution may be as simple as
To make use of a serial console, just use console=ttyS0 on the kernel command line, and systemd will automatically start a getty on it for you.
You would probably configure your GRUB2 to do this. Analyze what Arch Wiki says and adjust to your distro, if needed:
To make grub enable the serial console, open /etc/default/grub in an editor. Change the GRUB_CMDLINE_DEFAULT line to start the console on /dev/ttyS0. Note in the example below, we set two consoles up; one on tty0 and one on the serial port.
GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,38400n8"
Now we need to tell grub where is the console and what command to start in order to enable the serial console (Note as above for Linux kernel, one can append multiple input/output terminals in grub e.g. GRUB_TERMINAL="console serial" would enable both display and serial):
## Serial console
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=38400 --unit=0 --word=8 --parity=no --stop=1"
Rebuild the grub.cfg file with following command:
grub-mkconfig -o /boot/grub/grub.cfg
After a reboot, getty will be listening on /dev/ttyS0, expecting 38400 baud, 8 data bits, no parity and one stop bit. When Arch boots, systemd will automatically start a getty session to listen on the same device with the same settings.
Both sites agree that if you do not want GRUB2 to listen on the serial device, but only want getty listening after boot then you will need something like
systemctl enable serial-getty@ttyS0.service
systemctl start serial-getty@ttyS0.service
- FreewheelinFrank
- Global Moderator
- Posts: 2082
- Joined: 2010-06-07 16:59
- Has thanked: 38 times
- Been thanked: 225 times
Re: Have PC, want to use serial connection, not monitor?
Glad to hear you're making progress.dachshund-digital wrote: ↑2022-11-24 03:45 Guys,
Thanks for the reference links, that is a big help.
I think this pretty lose to what I need... I need to figure out exactly what my old PC presents for the RS-232, but you guys gave me the references to figure that out, I think. I found the below out on the web and all I need now is a DB-9 to USB cable that as FTDI support.
Such things seem to be available, this one even claims Linux support. It's USB C, so I don't know if it's exactly what you want.
https://www.ebay.co.uk/itm/392375952426 ... SwArNdT-6m
-
- Posts: 40
- Joined: 2021-12-23 22:22
Re: Have PC, want to use serial connection, not monitor?
I have the right cables now, so working on the software implementation, is to use a USB port as a mimic of an RS-232 port. The trick is to get a terminal (getty session) linked to the USB port. Will post back once I have this working.