![]() |
OT: Linux - Send data to RS232-Interface
Hi!
I know it's very off-topic, but i think here are many linux professionals which have experience with such things. I want to send a defined bit pattern to the RS232-interface of my NAS-System (NSLU2 running debian linux). Is it possible? Which sofware do i need? My target is to send a defined sequence of bits to a connected board which controls the color of RGB-LEDs. (future plan: controlled by my N900 - like the light switch on&off process at the moment) The board will be assembled by a friend (electrician) - therefore it is not the topic of the question. My question is only how i can send the bits to the rs232-port. Thanks in advance for you answers :) |
Re: OT: Linux - Send data to RS232-Interface
The RS232 ports on a Linux box are named /dev/ttyS0 (for com1), /dev/ttyS1 (for com2) and so on.
You can send data to the port simply by using any application that writes to those device files. They don't need root access, just make the user account part of the 'dialout' group (just do 'ls -l /dev/ttyS0' to verify the group - if it's 'dialout' or not depends on the distro). You can use the 'stty' program to set/inspect/change parameters for baud rate, xon/xoff support (on/off), etc. Another tool is 'setserial' (try 'man setserial'. It has a lot of information.) If your RS-232 programming interface is more binary oriented than can be handled by the above, or if you need full control over the pins (e.g. for hardware flow control), then you may need to write an application accessing the serial port(s) directly, and use 'fcntl' or 'ioctl' system calls to control the pins. Then you use write/read calls to write or read bytes to/from the port. |
Re: OT: Linux - Send data to RS232-Interface
depending on the version of linux your PC is running, the group that you need to be part of can be the older group "uucp" (unix-to-unix-copy) or the newer group "dialout". Fedora 10 and 11 have this difference.
I have found that gtkTerm is a nice GUI app for serial connection work. |
Re: OT: Linux - Send data to RS232-Interface
Thank you!
This takes me a step closer to my target ;) |
| All times are GMT. The time now is 09:59. |
vBulletin® Version 3.8.8