Tag Info

Hot answers tagged

29

These /dev nodes appear because the standard PC serial port driver is compiled into the kernel you're using, and it is finding UARTs. That causes /sys/devices/platform/serial8250 (or something compatible) to appear, so udev creates the corresponding /dev nodes. These UARTs are most likely one of the many features of your motherboard's chipset. Serial UARTs ...


15

I find screen the most useful program for serial communication since I use it for other things anyway. It's usually just screen /dev/ttyS0 <speed>, although the default settings may be different for your device. It also allows you to pipe anything into the session by entering command mode and doing exec !! <run some program that generates ...


12

Background The main reason why you need any program like minicom to communicate over a serial port is that the port needs to be set up prior to initiating a connection. If it weren't set up appropriately, the cat and echo would not for you as expected. Notice that once you run a program like minicom, the port is left with a a set of settings that minicom ...


10

It's not clear exactly what you want. If you want to use your existing Ethernet port, that won't be an option for many reasons; the most fundamental being that Ethernet requires precise termination and voltage levels, the hardware on the interface (the PHY) is made to deal with that. Ethernet uses strictly +/- 0.85V and 50ohm termination impedance; RS-232 ...


8

Are you sure the data isn't corrupted by your terminal (or wherever cat is displaying)? cat is unlikely to corrupt your data. Try using od (octal dump) to dump the data coming from the serial port, so you can see exactly what is coming across (without relying on it being printable). Use od -c if you're expecting ASCII data. If you're still seeing ...


8

The stty utility sets or reports on terminal I/O characteristics for the device that is its standard input. These characteristics are used when establishing a connection over that particular medium. cat doesn't know the baud rate as such, it rather prints on the screen information received from the particular connection. As an example stty -F /dev/ttyACM0 ...


6

cat just uses whatever settings the port is already configured for. With this little C snippet you can see the baud rate currently set for a particular serial port: get-baud-rate.c #include <termios.h> #include <unistd.h> #include <stdio.h> int main() { struct termios tios; tcgetattr(0, &tios); speed_t ispeed = ...


6

SAK in this case really means Secure Attention Key. The message you are seeing is a kernel message defined in drivers/tty/tty_io.c. SAK is a key combination which ensures secure login for a user on console. On Linux SAK ensures this by killing all processes attached to the terminal SAK is invoked on. It is expected that init will then restart the trusted ...


5

Thanks to the second comment by Bruce, I was able to figure out the problem on my own. After running stty -a -F /dev/ttyS1, there were 3 options I found to contribute to the problem: "echo", "onlcr", and "icrnl". Since this serial port is looped back to itself, here is what happened after running echo "hi" > /dev/ttyS1: The echo command appends a ...


5

I found projects called Linux Serial Sniffer, jpnevulator, and Moni. The first two look like they do exactly what you want. The last one calls itself a monitor, but it actually looks like a standard serial communication program.


5

Many devices use nonstandard connectors for serial ports. RJ-45 is probably the most common connector used for RS-232 serial after DB-9, but unlike with DB-9, there aren't even de facto standards for the pinout. I'm aware of 4 different RJ-45 RS-232 pinouts, and there are probably others I haven't seen yet. None of this means that people are somehow ...


5

I don't know if the existing options (e.g. Scilab, or Octave with the control systems package) can deal with real-time data. In any case, it shouldn't be hard to make your own; I would probably use Python + SciPy + NumPy + pyserial + matplotlib (+ any web framework if you eventually plan to control this over the network). There's a control systems ...


4

The right to access a serial port is determined by the permissions of the device file (e.g. /dev/ttyS0). So all you need to do is either arrange for the device to be owned by you, or (better) put yourself in the group that owns the device, or (if Fedora supports it, which I think it does) arrange for the device to belong to the user who's logged in on the ...


4

You could try making the device node manually. On my system /dev/ttyUSB0 is major 188 and minor 0., and hopefully my supposition is correct that it's a type c meaning character device (maybe try u for unbuffered character device if c doesn't work). mknod /dev/ttyUSB0 c 188 0 If this worked, and the device file was appearing automatically before, something ...


4

It is likely to be buffering in awk, not cat. In the first case, awk believes it is interactive because it's input and output are ttys (even though they're different ttys - I'm guessing that awk is not checking that). In the second, the input is a pipe so it runs non-interactively. You will need to explicitly flush in your awk program. This is not portable ...


4

As suggested, you can add some udev rules. I edited the /etc/udev/rules.d/10-local.rules to contain: ACTION=="add", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", SYMLINK+="my_uart" You can check for the variables of your device by running udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0) There is a more in depth guide you can read on ...


4

I managed to resolve the issue with the help of pabouk's answer. The code based solution that I finally discovered which allows the SAK flag to be set/unset on the serial port when opening using userspace API can be found on stackoverflow here How can I disable the serial port SAK option on Linux using userspace API?


4

Why doesn't the below work? # in one terminal: echo "asdf" > /dev/ttyUSB0 # in another terminal, this hangs and does nothing cat < /dev/ttyS0 Because, as a rule, serial ports don't buffer data. If there's no client app to receive the bytes landing on the serial port, they will simply be discarded. As an experiment, try launching minicom or cu ...


4

interceptty looks like what you want. I found that from this Ubuntu page interceptty - Intercept traffic to and from a serial port. Example If you want to use interceptty as an external serial monitor [connected to two serial ports on your machine and relaying between them, while recording the output] you can use one device as the backend, ...


3

cat doesn't modify the data. There might be old Unix systems where it truncates lines that contain null bytes, but not Linux, and I think not any modern unix-like system. On the other hand, if you try to display binary data directly on your terminal, the terminal will interpret control characters as commands to control the display. That's what control ...


3

I found a way using a shell script here that put cat as a background process and a while loop that read the user input and echo it out to the port. I modified it to be more general and it fitted my purpose perfectly. #!/bin/sh # connect.sh # Usage: # $ connect.sh <device> <port speed> # Example: connect.sh /dev/ttyS0 9600 # Set up device ...


3

It's not corrupted. What's happening is that the cat command is getting some of the bytes, and your application is getting some of them. So when you run cat, any bytes read by it are missed by the app, and both cat and the app will see (different) partial streams that appear corrupted.


3

minicom is great for interactive use, but it's not the right tool for programmatic I/O. Your local Python program should simply open the /dev node for the serial port. It works just like writing to a file: fd = os.open('/dev/ttyUSB0', os.O_RDWR) fd.write(...) The only tricky bit is setting up the bit rate and such. For that, use Python's termios library: ...


3

One approach (not necessarily the best...) would be to attach strace to the process (or, in order to handle the race condition, to a wrapper script which execs to this process), set strace to maximum string length and then catch all read()s and write()s (or whatever your process uses). After that you grep the lines with the right file descriptor (which ...


3

A Solution: The problem is that this serial port is non-PlugNPlay, and a system do not know which device was plugged in. Anyway, after reading a HowTo I get the working idea. An *nix-OS already have in /dev/ a files like ttySn where a n ending is a number. Most of this files is dumb i.e. doesn't correspond to an existing devices. But some of those is going ...


2

An easier way, if you know how to program in python, might be for you to use an API available for python called PYSERIAL so that you don't have to worry about doing any of the dirty work of setting up flags or passing parameters to the driver that handles the serial port on your computer. Pyserial takes care of all this for you in the background. You would ...


2

Have you tried turning off localchars in your telnet client? bash$ telnet telnet> toggle localchars Won't recognize certain control characters. telnet> open myhost You may also be able to put this command in the ~/.telnetrc file, depending on your version of telnet.


2

You might try the 8-bit clean mode... it stops telnet from interpreting much of the data telnet -8 host port (This is a shot in the dark) For the most part, you're on the right track, trying to get telnet to stop pre-interpreting keystrokes... such as the CTRL-C and CTRL-Z and others. 8bit mode should help.


2

According to the Fedora 16 documentation /etc/rc.serial is responsible for setting up the serial lines. Has anything changed here between your 15 and 16 install? Setting "low latency" and "rx/tx_trigger" (if possible) might help. I remember that the 16550A has a 15-byte-input-buffer. Somehow you can set at which fill-level an interrupt is being generated ...



Only top voted, non community-wiki answers of a minimum length are eligible