VOGONS

Common searches


serial port on ubuntu

Topic actions

First post, by cppp

User metadata
Rank Newbie
Rank
Newbie

hello,

I'm new to dosbox. I am trying some old program to work with dosbox. These one all use serial port (which can be changed inside the program but I didn't) and are made with old dos style (using int14) and they work on win32 (but not on win64 of course).
I browsed the forum with no success (many old topics discorded).
I want to use them in a new environment : ubuntu 18.04. But all my attempts are failed so I have some questions :
Does serial port works on dosbox with Ubuntu ? I specify that I wrote in ~/dosbox-0.74.conf :
serial1=directserial realport:ttyS0
serial2=disabled
serial3=disabled
serial4=disabled
I did also 'sudo adduser <myname> dialout'
I monitored serial interface and nothing is going out.

what's wrong ?

I would like these programs works on linux

thanks in advance for any reply

Reply 1 of 21, by _Rob

User metadata
Rank Member
Rank
Member

@cppp if you run dosbox from a terminal, are there any serial messages being printed?

And when you run "groups", you checked if your user is indeed part of the dialout group? Also, you may have to logout and log back in before changes like that are properly propagated.

Reply 2 of 21, by cppp

User metadata
Rank Newbie
Rank
Newbie

hi,

here is message I receive from doxbox from command line :

DOSBox version 0.74
Copyright 2002-2010 DOSBox Team, published under GNU GPL.
---
CONFIG:Loading primary settings from config file /home/panel/.dosbox/dosbox-0.74.conf
MIXER:Got different values from SDL: freq 44100, blocksize 512
ALSA:Can't subscribe to MIDI port (65:0) nor (17:0)
MIDI:Opened device:none
DOS keyboard layout loaded with main language code FR for layout fr

apparently nothing about the serial port...
concerning group I still be in group dialout and that makes wine to work with serial port ...

other idea ?

Last edited by cppp on 2020-07-06, 15:33. Edited 1 time in total.

Reply 5 of 21, by cppp

User metadata
Rank Newbie
Rank
Newbie

ten years from 0.74 to 0.74-3 ???
so trying is a good deal
I just try another thing that demonstrate that serial port is not implemented in ubuntu :

At command line the command : echo "test" > COM1 write a file COM1 in C:\ and the line "SHELL:Redirect output to COM1" to the terminal

I will try later version 0.74-3... to follow...

Reply 7 of 21, by Jorpho

User metadata
Rank l33t++
Rank
l33t++
cppp wrote on 2020-07-06, 18:56:

I just try another thing that demonstrate that serial port is not implemented in ubuntu :

That just demonstrates that the "echo" command and/or piping might not be implemented in DOSBox.

Reply 8 of 21, by cppp

User metadata
Rank Newbie
Rank
Newbie

here I am ! 😀
I've tried many things :

I see that ubuntu propose 3 dosbox :

DosBox Emulator : this is version 0.74 (the first i tried) - config file is (in) ~/.dosbox/dosbox-0.74.conf
DosBox-jz : seems to be version 0.74-3 - config file is (in) ~/snap/dosbox-jz/108/.dosbox/dosbox-0.74-3.conf
DosBox-x : seems to be version 0.83-2 : I didn't find the config file (in ~/snap/dosbox-x/...)

this last version seems to be in alpha stage because :
-without any manipulation, I seem to be in AZERTY keyboard except that only letters are available and when I type "keyb fr" my keyboard become QWERTY annoucing however a codepage 858 (french keyboard is 850 and american 437)
-there is a menu at the window with many options : I found only a submenu "serial" in menu "Configuration GUI" but changing "serial1" is impossible (writing into the box is possible but the last value return always : perhaps syntax changes beetween this version from the previous versions)
And nothing is going out to the serial interface...

For the 0.74-3, I did all the tests I made for 0.74 with the same wrong results...
(typing "keyb fr" tell also "codepage 858" but the keyboard seems to be french)

So except if you have another idea, I thing that I will stop there my tests : what a pity !

thanks for your help

Reply 10 of 21, by _Rob

User metadata
Rank Member
Rank
Member

ahh yes, non-us keyboards are problematic, unless you have an SDL2 build. With the SDL1 version, you can work around it by setting the following in your config file (just create one)

[sdl]
usescancodes=true

I don't know where the snap version has the config located. it should be either in ~/.dosbox/ for older versions, or in ~/.config/dosbox-x/ for the latest builds.
You can ask it with the config command from the dosbox-x prompt:
config -l

Or you can have it generate a config by typing
config -wcd -all

Reply 11 of 21, by Jorpho

User metadata
Rank l33t++
Rank
l33t++
cppp wrote on 2020-07-06, 21:02:

if echo was not implemented, why did it write a file named COM1 ? (that contains "test")

Fair enough. I'm just saying that I wouldn't be surprised if piping output to COM1 wasn't implemented and I don't think that's a reliable test of whether serial port redirection is functioning properly.

Reply 12 of 21, by cppp

User metadata
Rank Newbie
Rank
Newbie

@jorpho
yes, that's true but is significant about the development level and a sign for me if I have to continue searching or have to wait for a future development 😉
In any case, I find dosbox is a very interesting project and it would be very nice if it works fine on linux platforms.

Reply 13 of 21, by Jorpho

User metadata
Rank l33t++
Rank
l33t++
cppp wrote on 2020-07-07, 06:10:

yes, that's true but is significant about the development level

My point is that this example only reflects the development level of the DOSBox command line parser, which is known to have limitations as it is not of much importance when it comes to games and since people can always use something like 4DOS if they need something more complete (though I doubt 4DOS will help much here). There may be some other reason why you cannot get serial port passthrough working in this instance.

Reply 14 of 21, by cppp

User metadata
Rank Newbie
Rank
Newbie

This evening, I try again with an other computer (i386 and not AMD64) and I have response at command line :

Serial1: Opening ttyS0
Serial1: Serial Port "ttyS0" could not be opened.
System error 9.

(I have no RS232 on this computer, only USB)
But with the first I had no response, I retry (the first computer was off) and ... it works !!! (with 0.74 version)

So I suspect there was something tricky when changing configuration (quit dosbox perhaps neccessary? )

I've tried too with a USB-RS232 cable and it works too (with changing "serial1=directserial realport:ttyS0" to "serial1=directserial realport:ttyUSB0")

Awesome !!! 😀

it could be a good idea to notice in the wiki that "com1" must be replace with "ttyS0" on linux

thanks a lot for your patience

Last edited by cppp on 2020-07-09, 12:29. Edited 1 time in total.

Reply 15 of 21, by Jorpho

User metadata
Rank l33t++
Rank
l33t++
cppp wrote on 2020-07-07, 20:12:

it could be a good idea to notice in the wiki that "com1" must be replace with "ttyS0" on linux

There are already lines to that effect in the default dosbox.conf.

#          for directserial: realport (required), rxdelay (optional).
# (realport:COM1 realport:ttyS0).

Glad you got it working.

I've tried too with a USB-RS232 cable and it works too (with changing "serial1=directserial realport:ttyS0" to "serial1=directserial realport:ttyUSB0")

Be warned that USB-RS232 cables sometimes do not have the same hardware flow control features as regular serial ports. If you are trying to operate a particular device, you may encounter problems. (This is not particularly related to DOSBox.)

Reply 16 of 21, by Jo22

User metadata
Rank l33t++
Rank
l33t++

That's right, not all USB-Serial adapters do have all of the control lines.
Also, some need special drivers for "native" mode, which has more features.
However, those adapters with a DE-9 plug *should* have support for the usual RS232 control lines (PL2303 chip etc)..
One of the other problems is, that these adapters are TTL level (3,3v or 5v and 0v). Real RS232/V.24 ports use +12v and -12v.
Some devices based on discrete logic (transistors, relays etc) may not work because of this.
Unless some level converters such as Max232 are used. Some of them can handle/convert only two levels at the same time, though.
Another, rather strange and unconventional workaround I've seen involves LM78xx/LM79xx linear regulators..

"Time, it seems, doesn't flow. For some it's fast, for some it's slow.
In what to one race is no time at all, another race can rise and fall..." - The Minstrel

//My video channel//

Reply 17 of 21, by cppp

User metadata
Rank Newbie
Rank
Newbie

Installing a new system (linux Mint) I encountered the same problem with using serial port : but I found where is the bug :

1) Installing wine (wine-5.0 (Ubuntu 5.0-3ubuntu1)
2) installing dosbox (DOSBox version 0.74-3, copyright 2002-2019 DOSBox Team)
3) making access to ttyS0 : sudo adduser <user> dialout
4) ensure that com1 is in ~/.wine/dosdevices (0 octet) and if not : ln -s /dev/ttyS0 ~/.wine/dosdevices/com1
5) register com1 in registered base of wine dy typing : wine regedit
then add a string value at key "HKEY_LOCAL_MACHINE\Software\Wine\Ports" : COM1 REG_SZ /dev/ttyS0
6) replace the line
serial1=dummy
by
serial1=directserial realport:ttyS0
in the file ~/.dosbox/dosbox-0.74-3.conf
(I take this opportunity to add two lines at the end of file for language and give the path that become C:\ :
[autoexec]
# Lines in this section will be run at startup.
# You can put your MOUNT lines here.
mount c ~/dosprogs
keyb fr
)
7) That's all but if you don't restart your computer, this doesn't work at all: so you MUST restart your computer

I've tried with two system and it has the same behaviour : hope this can be useful to other users
best regards

Reply 18 of 21, by Jorpho

User metadata
Rank l33t++
Rank
l33t++

Your reply is appreciated, but what exactly is the "bug"?

I don't understand why you wouldn't just run the Linux port of DOSBox under Ubuntu instead of trying to use the Windows version with Wine.

Reply 19 of 21, by mr.cat

User metadata
Rank Member
Rank
Member

Native would be better probably. But if you need to use Wine for some reason or another(?), you might want to try if "wineboot -k" helps (instead of rebooting the whole machine).