sQLux serial and pty

Discussion and advice about emulating the QL on other machines.
Post Reply
gbejniet
ROM Dongle
Posts: 21
Joined: Sun Feb 02, 2020 10:21 pm

sQLux serial and pty

Post by gbejniet »

My AH QL is still out of action so I'm looking at emulators and trying the following to see if sQLux can use a pty as a serial port. I wondered whether anyone looking at the below knows right off if something I am doing is wrong or why.

I start sQLux on Ubuntu with (say):

Code: Select all

sqlux --SER1 pty --RAMSIZE 128 --ROMDIR ..... --WIN_SIZE 2x
And then run socat to create and interact with a pty:

Code: Select all

socat -d -d -v - pty,rawer,link=pty
If I run

Code: Select all

copy ser1 to scr
and start typing in the pty - I get only every other line appearing in scr.

I have also tried removing rawer, various termios options (such as opost/onlcr, ocrnl, ...), etc.

I'm assuming the issue isn't at the sQLux end and it works well with real serial ports. If it were a flow control issue I would expect it to work better if typing slowly and each line were a single character, a <enter> s <enter> d <enter> f <enter> and so on - but this also only displays a ... d ... every other line.

Anyone seen anything similar I wonder? Thoughts greatly appreciated as always.


User avatar
XorA
Site Admin
Posts: 1368
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: sQLux serial and pty

Post by XorA »

gbejniet wrote: Thu May 18, 2023 7:55 pm My AH QL is still out of action so I'm looking at emulators and trying the following to see if sQLux can use a pty as a serial port. I wondered whether anyone looking at the below knows right off if something I am doing is wrong or why.

I start sQLux on Ubuntu with (say):

Code: Select all

sqlux --SER1 pty --RAMSIZE 128 --ROMDIR ..... --WIN_SIZE 2x
And then run socat to create and interact with a pty:

Code: Select all

socat -d -d -v - pty,rawer,link=pty
If I run

Code: Select all

copy ser1 to scr
and start typing in the pty - I get only every other line appearing in scr.

I have also tried removing rawer, various termios options (such as opost/onlcr, ocrnl, ...), etc.

I'm assuming the issue isn't at the sQLux end and it works well with real serial ports. If it were a flow control issue I would expect it to work better if typing slowly and each line were a single character, a <enter> s <enter> d <enter> f <enter> and so on - but this also only displays a ... d ... every other line.

Anyone seen anything similar I wonder? Thoughts greatly appreciated as always.
Don't be afraid to dig around the the relevant sQLux code, it is almost certainly a bug!


gbejniet
ROM Dongle
Posts: 21
Joined: Sun Feb 02, 2020 10:21 pm

Re: sQLux serial and pty

Post by gbejniet »

It might well be a bug, but not in sQLux it seems - I was of course too quick to post here, and was able to reproduce the issue using only socat and cat pty (where pty is the symlink) - whether I've got the wrong options in the socat command line, or it's just buggy, who knows?

Anyway, I'm able to write characters to sQLux ser1 perfectly using a bit of pty code in C, so I'll go with that. Sorry for the alarm.

Edited to add: if anyone else tries something similar, here's some advice: if you are using socat or any tool to create a symlink to the pty slave in orter to locate it, make sure you don't do that in a directory that's being watched by VS Code or any other IDE, as it will contend/race to read the symlink for updates and you will spend days wondering what's going on. So the bug is right here, at the keyboard. :lol:


Post Reply