Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
However, when I try the same command on another laptop, I am unable to read anything from the device, the cat command will simply get stuck and not return anything.
I setup the device in the following way on the first computer (the one where it works):
Code:
user@laptop:~$ stty -F /dev/ttyACM0
speed 3000000 baud; line = 0;
min = 0; time = 0;
-brkint -icrnl -imaxbel
-opost
-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke
On the second computer, I basically set the baudrate to 3000000 and didn't change any other settings:
However, when I try the same command on another laptop, I am unable to read anything from the device, the cat command will simply get stuck and not return anything. I setup the device in the following way on the first computer (the one where it works):
Code:
user@laptop:~$ stty -F /dev/ttyACM0
speed 3000000 baud; line = 0;
min = 0; time = 0;
-brkint -icrnl -imaxbel
-opost
-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke
On the second computer, I basically set the baudrate to 3000000 and didn't change any other settings:
I guess I have to use stty to change the settings for the port on the computer on which I can't read the data?
Yes, you have to get those settings correct, but there may be other issues. First, what version/distro of Linux are you using on both of those systems? What kind of device? Assuming it's a USB connected serial device. Does the output of dmesg tell you anything different between the systems? (run "sudo dmesg -c" on both systems with the device unplugged, then insert the device and run "dmesg" again). And what program is talking to this device?
Might want to install minicom since it was created to talk to serial devices. You can play with the settings, and at least see what you're getting in real-time, without the 'cat' statement.
Both of the different settings are output settings, so I'm not sure they're going to make much of a difference.
For instance, on the system where it works, you could add an EOF character and add the -onlcr attribute, and I bet it will continue to work.
Use the "raw" setting for stty to make the terminal go to raw mode, this is fairly common and in the library functions, there is a cfmakeraw() call. Look under the termios.h library functions.
Overall, I agree with TB0ne.
First: Do you know that it is identified as /dev/ttyACM0 on both machines? There may be other devices using that same device ID, so therefore check your system logs to verify that this device is exactly that designation on both systems.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.