ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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.
Hi Folks,
I'm developing a program in C++ on Linux which interacts with a USB2Serial adapter to fetch some information from the remote terminal. I was able to set the IOCTL_SERIAL_XOFF_COUNTER on windows using the following code:
Error while setting ioctl:Inappropriate ioctl for device
So if any of you have done something similar before, please let me know how I can map the IOCTLs from my windows program to the corresponding calls on Linux.
TIA! Regards,
Nachiketh
In a userspace program, you cannot invent new ioctls (even if they exist in Windows), only use the existing ones. See manuals of termios(3) and stty(1), also this: http://tldp.org/HOWTO/Serial-Programming-HOWTO/
In a userspace program, you cannot invent new ioctls (even if they exist in Windows), only use the existing ones. See manuals of termios(3) and stty(1), also this: http://tldp.org/HOWTO/Serial-Programming-HOWTO/
Hi,
Thanks for the reply.
I did have a look at termios and stty, but I could not find any setting to flags to set the IOCTL_SERIAL_XOFF_COUNTER and also the IOCTL_SERIAL_LSRMST_INSERT control codes in them. Does this mean these cannot be set on Linux? Please let me know.
Thanks & Regards,
Nachiketh
I think it depends on what are they supposed to do.
According to the MSDN documentation:
Quote:
IOCTL_SERIAL_LSRMST_INSERT Enables or disables the placement of line status and modem status values into the regular data stream that an application acquires through the ReadFile function.
The value should be set to 255 in my application.
Quote:
The IOCTL_SERIAL_XOFF_COUNTER request sets an XOFF counter. An XOFF counter request supports clients that use software to emulate hardware handshake flow control.
This value needs to be written after writing 5 bytes of data onto the RS232 port, the value for which is the byte array which I have posted in the original question. hope this helps!
Last edited by GeekyNorm; 07-24-2015 at 03:04 AM.
Reason: changed the tags
That's nice, but you have to find out if they actually do something useful, and if they do then exactly what it is, and how can that be emulated in unix.
ioctl() is sort-of the "wild card" in the device-interface world: it lets you pass "a request-code and associated parameters" to the driver, but it really doesn't say what those mean. "That's strictly between you and the driver." (And furthermore, "the driver" might be provided by the vendor of the device in question.)
The operating systems in question basically "just implement the ability to get the job done." Beyond that, it's up to the driver.
Last edited by sundialsvcs; 07-28-2015 at 09:56 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.