Porting plptools to Haiku

So, I’ve done a bit of testing to work out what’s going on with Haiku and RTS/CTS/DTR/DSR.

This bit of C code (based on this code) checks RTS/CTS/DTR/DSR every second, toggling RTS and DTR between checks.

On Linux using both the Prolific TA adapter and the FTDI FT232 adapter, I get the following output when plugged into the test Psion Series 3c which is setting DTR and CTS high:

DTR:1 DSR:1 RTS:1 CTS:1
DTR:0 DSR:1 RTS:0 CTS:1
DTR:1 DSR:1 RTS:1 CTS:1
DTR:0 DSR:1 RTS:0 CTS:1
DTR:1 DSR:1 RTS:1 CTS:1  --- UNPLUGGED THE 3C HERE
DTR:0 DSR:0 RTS:0 CTS:0
DTR:1 DSR:0 RTS:1 CTS:0
...

On Haiku, with both adapters:

DTR:0 DSR:0 RTS:0 CTS:1
DTR:0 DSR:0 RTS:0 CTS:1
DTR:0 DSR:0 RTS:0 CTS:1
DTR:0 DSR:0 RTS:0 CTS:1
DTR:0 DSR:0 RTS:0 CTS:1 --- UNPLUGGED THE 3C HERE
DTR:0 DSR:0 RTS:0 CTS:1
DTR:0 DSR:0 RTS:0 CTS:1
...

DTR, DSR, RTS and CTS are always read as off, off, off and on, respectively, no matter what is set at the other end.

I’ve also done some checks with an oscilloscope. When you first plug in an adapter, DTR is low. Although you can set DTR once, you can’t tell that it’s set. If you try to change it (set or unset), it goes low for a few milliseconds and then goes back high again. For CTS, it’s the opposite - if you try to change it, it goes high for a few milliseconds and then goes low again.

If I’m using ioctl() incorrectly, please do let me know!

2 Likes