1

I am trying to access a remote machine through ssh and check the model of a device that it is connected to a specific COM port; I know what port it is.

I have tried some commands, but they either don't work cause I am on a ssh connection or the machine I am accessing doesn't have the modules to run this commands installed.

So far, I have tried:

dmesg

lspci

lsblk

lsusb

the ones that are recognized as commands are dmesg but it didn't give me the information I want, and lspci which prints a bunch of unknown devices messages

Honestly I'm starting to think that this can't be done. Also, I would need to do this without installing any modules on the machine I am connecting to by ssh.

  • What "COM" device? A serial port? If yes, does the device attached speak the Hayes AT command set? If yes, you can try (exec <>/dev/ttySn; stty sane; echo ATI >&0; cat), where n is serial port (ttyS0 for COM1). – mosvy Jun 11 at 9:21
  • this does not work, i suppose hayes is not supported – Letho123 Jun 11 at 10:10
3

OK, so the PC is not the important thing but the mystery device attached to the COM port is?

Unfortunately, the COM port is a very low-level connection with no automatically provided metadata, so there is no universal tool like lsserial that could straight up tell you useful information to identify the device with 100% confidence.

If you cannot identify the software communicating with it (perhaps by using fuser /dev/ttyS* and getting the process information on any PIDs revealed), and use that as a clue, or if there are no processes actively using the device, then you must try and "talk" to the device and see if it responds to a commonly-used protocol, as indicated by @mosvy.

If a COM port-connected device is in use, there is a reasonable probability that there might be some kind of serial-port-oriented terminal emulator installed, like cutecom, minicom, seyon or similar. Even an old-school UUCP serial port utility like cu might be useful. If you can find signs that they've been used, or existing configuration files for them, you might be able to find out the serial port parameters used from them, otherwise there might be a lot of trial and error required.

Modems would generally respond to "ATEnter" with "OK", and would often auto-detect the COM port speed; once basic communication was established, you could use ATI1 Enter and other ATI commands with increasing numbers to get basic identification information from the modem.

Things like GPS time receivers or UPSes might periodically output some data on their own, and might use a speed as low as 1200 bps. Switches, routers and similar network hardware might present a recognizable login prompt, typically using port speeds like 9600 bps, 38400 bps or 115200 bps. Another variation would be whether or not hardware handshaking (RTS/CTS and/or DSR/DTR) is required or not. For the bits/parity combinations, the overwhelmingly most common one is 8n1, i.e. 8 data bits, no parity, 1 stop bit.

You might also try more indirect methods like checking the shell history file of the root user for any special commands used before in association with the COM port.

Getting someone on site to actually look at the device at the end of the COM port cable and e.g. taking a photo of the device with any identifying information like manufacturer's logos or model numbers clearly visible would be great, but I guess that you wouldn't be asking if that was easily doable.

Printers are probably the hardest to identify remotely over a COM port: for example, the Epson ESC/P printer command language does not seem to include any commands at all for status readback. If the printer understands PCL, it might also understand PJL. In that case, you might try this:

(exec <>/dev/ttySn; stty sane; printf "\e%-12345X@PJL INFO ID\n" >&0; cat)

If the printer understands PJL, it should respond with its model identification.By replacing the word ID with either CONFIG or VARIABLES, you might then get even more information from the printer.

  • i have checked this database and most of the device id´s on my pc dont show up on the database, the thing is i dont think its connected by PCI, its a conenction made with a RS-232 cable – Letho123 Jun 11 at 9:19
  • the device is a printer – Letho123 Jun 11 at 10:21
  • I added to my answer one thing you might try, in case the printer happens to support PCL3 or above. If it does, you should get an answer; if not, you might get a line of garbage at the beginning of your next print job. But if it's a printer, the system might have a print spooler (like CUPS or LPRng) configured to use it: the configuration of the print spooler might include some useful information. – telcoM Jun 11 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.