David Relson | 14 Jan 00:52
Favicon

serial port handling question

G'day,

I'm porting some old DOS code to Linux for a medical device that is
being upgraded.  Among other goodies, it has a sensor that sends data at
115KB to an onboard NS16550A (or equivalent).  

The sensor is controlled (in part) by setting RTS on and off. I looked
high and low (pun intended) for an ioctl or similar call that would
allow this level of control and couldn't find anything. I finally ended
up using the ollowing lines of code: 

 outb(inportb(MCR) |  0x02, MCR);  //DTR,RTS=ON
 outb(inportb(MCR) & ~0x02, MCR);  //DTR=ON,RTS=OFF

Directly tweaking the I/O port runs against the grain, but it's the
only thing I've found that works.

Is there a better way to control the chip?

Regards,

David


Gmane