Quote:
Originally Posted by business_kid
are you circumventing proprietary code?
|
We don't need to know the answer to this question, because what
mensfort needs to do here is the same, regardless of whether he's circumventing proprietary code.
I found a hint
here. I haven't tested the following code, but it ought to compile in both Microsoft(spit)(R) and Linux environments. Will something like this do the trick?
Code:
#if defined(__GLIBC__)
#include <asm/ioctls.h>
#include <linux/serial.h>
#endif
/* ... */
#if defined(__GLIBC__)
struct serial_struct cheerios;
#endif
/* ... */
#if defined(__GLIBC__)
if(ioctl(your_file_descriptor_here,TIOCGSERIAL,&cheerios))
{
/* Handle error here. */
}
cheerios.flags&=(~ASYNC_SPD_MASK);
cheerios.flags|=(ASYNC_SPD_CUSTOM);
cheerios.custom_divisor=(115200/6400);
if(ioctl(your_file_descriptor_here,TIOCSSERIAL,&cheerios))
{
/* Handle error here. */
}
#else
/* Do whatever one does in the Microsoft(spit)(R) world. */
#endif
The link mentioned above hints that before you use
TIOC[GS]SERIAL, you should call
tcsetattr() and set
c_cflag to
B38400. I'm not convinced that this is necessary, but if the above code doesn't work by itself, try adding this additional stuff first.
Hope this helps.