Menu

#249 USB Serial work-around

open
nobody
None
5
2024-09-20
2011-08-03
No

Many USB serial ports do not support a 5 bits per byte configuration however when
configuring a serial port under DOS it is fairly common practice to simply set the
serial ports LCR register to 0x80 to set the DLAB bit before setting the LCR to the
actually desired value. This patch is a hack to work around the problem with these
adapters at the cost of disabling the 9600 baud 5.N,1 configuration.

Discussion

  • Adam Connell

    Adam Connell - 2011-08-03
     
  • guly

    guly - 2012-10-25

    First, compliments for the beautiful project...I am an Italian boy I speak a little English (sorry ahead for my English)

    I have the need to run a 16-bit program on my winzoz seven 64 bit...(in win xp 32 bit work perfectly)

    I have a usb to serial port converter to communicate from PC to a machine tool with CNC..

    The 16-bit program works perfectly in dosbox 0.74, but the serial port NO!

    I set from the configuration file:

    serial1=directserial realport:COM2
    serial2=disabled
    serial3=disabled
    serial4=disabled

    But when I start dosbox appears:

    Serial1: Opening COM2
    Serial1: Desired serial mode not supported (9600,5,n,1)

    Exactly this problem!

    How do I install this patch? in dosbox 0.74...
    Where do I put the file "dosbox_ignore_5N1.patch"?

    Thanks in advance to all...

    By Guly

     
  • Adam Connell

    Adam Connell - 2012-10-28

    Guly,

    Using the patch requires the project be built from source.
    1) You will need a build environment. Get MinGW http://www.mingw.org/ if
    you do not have it.
    2) Download the source of DosBox.
    3) Extract the source from the archive
    4) Apply the patch with the command:
    patch -p0 < patchname.diff
    5) Build the software with the commands:
    ./configure
    make

    Regards,
    Adam

    On Thu, Oct 25, 2012 at 10:14 AM, guly gguly@users.sf.net wrote:

    First, compliments for the beautiful project...I am an Italian boy I speak
    a little English (sorry ahead for my English)

    I have the need to run a 16-bit program on my winzoz seven 64 bit...(in
    win xp 32 bit work perfectly)

    I have a usb to serial port converter to communicate from PC to a machine
    tool with CNC..

    The 16-bit program works perfectly in dosbox 0.74, but the serial port NO!

    I set from the configuration file:

    serial1=directserial realport:COM2
    serial2=disabled
    serial3=disabled
    serial4=disabled

    But when I start dosbox appears:

    Serial1: Opening COM2
    Serial1: Desired serial mode not supported (9600,5,n,1)

    Exactly this problem!

    How do I install this patch? in dosbox 0.74...
    Where do I put the file "dosbox_ignore_5N1.patch"?

    Thanks in advance to all...

    By Guly

    • patches:249 USB Serial work-around*

    Status: open Created: Wed Aug 03, 2011 12:45 PM UTC by Adam Connell Last
    Updated:
    Fri Sep 07, 2012 11:35 AM UTC Owner: nobody

    Many USB serial ports do not support a 5 bits per byte configuration
    however when
    configuring a serial port under DOS it is fairly common practice to simply
    set the
    serial ports LCR register to 0x80 to set the DLAB bit before setting the
    LCR to the
    actually desired value. This patch is a hack to work around the problem
    with these
    adapters at the cost of disabling the 9600 baud 5.N,1 configuration.


    Sent from sourceforge.net because you indicated interest in
    https://sourceforge.net/p/dosbox/patches/249/

    To unsubscribe from further messages, please visit
    https://sourceforge.net/auth/prefs/

     
  • BARTHES

    BARTHES - 2013-09-06

    Adam,

    Could you rebuild Dosbox with this patch for me ?
    I can't do it myself. I've no competence about MinGw ...

    It's very important for me because I use a very old application to communicate with PLCs (rs232 with 9600,8,n,1 only ...).

    Thanks a lot

    Best regards

     
  • northern

    northern - 2013-10-02

    Adam,

    I rather dislike having someone else do my work, but I'm afraid I am in the same boat as Barthes. The fix that is proposed here is also precisely what I need. Would you be able/willing to make the necessary modification to Dosbox for us? Thank you!

     
  • northern

    northern - 2013-10-02

    Just playing around, I was able to execute the patch command, but the patch failed. Just goes to show the level of my incompetence... I renamed the patch file to d.patch and then ran:
    patch -p0 dosbox.exe d.patch

    The response was:
    Hunk#1 FAILED at 230
    1 out of 1 hunk FAILED

    Any help is truly appreciated.

     
  • northern

    northern - 2013-10-02

    So this time I extracted the Dosbox executable with Univeral Extractor program....but the resulting files make no sense to me and where/how to apply the patch eludes me...

     
  • Anonymous

    Anonymous - 2013-11-01

    I too have not been able to correctly get MinGW installed and working to add this patch in. I can compile in VS 2008 but then I don't know how to add in the patch.

    Can someone post a patched exe or instructions on how to add the patch to a VS 2008 compile or tell me which source to edit to fix this? I'm using a USB to serial converter and cannot get it to work.

     
  • Joseph Lane

    Joseph Lane - 2013-11-24
     

    Last edit: Joseph Lane 2013-11-24
  • Joseph Lane

    Joseph Lane - 2013-11-24

    I was able to apply the patch without issue but can't seem to build an exe with MinGW. I am able to provide a copy of the patched source though. You should be able to build it with VisualStudio or whatever. Please post an exe, if you are able, for other users. I hope this can help someone.

    dosbox-074.zip

     
    • Bram Peek

      Bram Peek - 2021-01-29
       

      Last edit: Bram Peek 2021-01-29
  • Thomas

    Thomas - 2017-06-28

    if someone is still interested: (patched version, based on today's svn)

     
    • Roman Pronin

      Roman Pronin - 2017-07-12

      Oh, thank's, Thomas!!

       
    • Bram Peek

      Bram Peek - 2021-01-29

      i'm still interested

       
  • Anonymous

    Anonymous - 2017-07-12

    Thank you for this Thomas, I definately am still interetsted in this but I couldn't get it to work. I am trying to get a old DOS program to talk to a hardware device using either 1200 or 2400 baud 8 N 1. Using my Dell Latitude laptop with a docking station that has a physical serial port as COM 1. I can sucessfully run the program using DOSBox and communicate to the device every time under both Windows 7 and Windows 10 using that physical COM port. However I am trying to get a USB -> Serial adapter working. The adapter is setup as COM 2 and using HyperTerminal the adapter works fine. But in DOSBox it does not communicate. I see both serial ports open on startup:

    Serial1: Opening COM1
    Serial2: Opening COM2

    I use the software with COM 1 (physical one) and it works fine. I then switch the software over to COM 2 and start getting this:

    Serial2: Errors: Framing 0, Parity 0, Overrun RX:6 (IF0:0), TX:0, Break 0
    Serial2: Errors: Framing 3, Parity 0, Overrun RX:8 (IF0:0), TX:0, Break 3
    Serial2: Errors: Framing 2, Parity 0, Overrun RX:0 (IF0:0), TX:0, Break 0

    and I cannot communicate. Switch it back to COM 1 and again it works. Any ideas or things I can try?

     
    • Thomas

      Thomas - 2017-07-13

      I am sorry not being able to give advice of what might go wrong. I just took the sources from SVN, applied the patch and compiled the whole thing. I needed the modified version myself and wanted to provide the EXE as some people stated they didn't know how to compile the code.

      However, I was not yet able to test it myself as it turned out my USB-serial-converter ain't working properly. So I'm not yet able to give any feedback about the success of the patch.

      Kind regards,
      Thomas

      ----- Original Message -----
      From: Allan vseven@users.sf.net
      To: [dosbox:patches] 249@patches.dosbox.p.re.sf.net
      Sent: Wednesday, July 12, 2017, 16:33:25
      Subject: [dosbox:patches] #249 USB Serial work-around

      Thank you for this Thomas, I definately am still interetsted in this but I couldn't get it to work. I am trying to get a old DOS program to talk to a hardware device using either 1200 or 2400 baud 8 N 1. Using my Dell Latitude laptop with a docking station that has a physical serial port as COM 1. I can sucessfully run the program using DOSBox and communicate to the device every time under both Windows 7 and Windows 10 using that physical COM port. However I am trying to get a USB -> Serial adapter working. The adapter is setup as COM 2 and using HyperTerminal the adapter works fine. But in DOSBox it does not communicate. I see both serial ports open on startup:

      Serial1: Opening COM1
      Serial2: Opening COM2

      I use the software with COM 1 (physical one) and it works fine. I then switch the software over to COM 2 and start getting this:

      Serial2: Errors: Framing 0, Parity 0, Overrun RX:6 (IF0:0), TX:0, Break 0
      Serial2: Errors: Framing 3, Parity 0, Overrun RX:8 (IF0:0), TX:0, Break 3
      Serial2: Errors: Framing 2, Parity 0, Overrun RX:0 (IF0:0), TX:0, Break 0

      and I cannot communicate. Switch it back to COM 1 and again it works. Any ideas or things I can try?

      [patches:#249] USB Serial work-around

      Status: open
      Group:
      Created: Wed Aug 03, 2011 12:45 PM UTC by Adam Connell
      Last Updated: Wed Jun 28, 2017 08:11 PM UTC
      Owner: nobody

      Many USB serial ports do not support a 5 bits per byte configuration however when
      configuring a serial port under DOS it is fairly common practice to simply set the
      serial ports LCR register to 0x80 to set the DLAB bit before setting the LCR to the
      actually desired value. This patch is a hack to work around the problem with these
      adapters at the cost of disabling the 9600 baud 5.N,1 configuration.

      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/dosbox/patches/249/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       
  • Bix Dobs

    Bix Dobs - 2017-10-03

    Not sure looking at the CPP change whether this patch addresses connectivity ... I have used CROSSTALK MK4 forever ... being a 16bit Dos Program, Win 7 64b and above will NOT run it in any compatibility mode ... the current version of DosBox does run the xtalk but won't allow it to connect to a USB Serial port set to emulate Com2 ... While the above 249 Patch turns off the 5 n 1 error it does not address the Com 2 connectivity issue

     
  • Anonymous

    Anonymous - 2017-10-03

    Yeah, I've had no luck with this patch either trying to get a old program that runs on 2400, 8, N, 1 working with multiple different USB adapters. I have a Dell Latitude with a Legacy Port Expander that provides a actual COM1 serial port (9 pin) and the program does work using DOSBOX through that, just not any USB adapters. However Dell like everyone else is getting away from legacy ports so its only a matter of time before thats not a option either.

     
  • Bix Dobs

    Bix Dobs - 2017-10-03

    ok dug down deep into all my archives to find a W2K Pro SP4 install (probably could have used XP too but 2k is far less relliant on ms ... using the free VMWare Player, W2K can be installed and runs most dos programs VMware allows adding h/w links plus has drag drop features that still work in 2k ... all round solution .... took all of 30minutes of default settings to install and get xtalk mk4 back up and running with a USB serial port .. there are some easy to follow youtube sessions on how to install win 2k in vmware plus if you look hard enough there are still W2K Iso files out there for download

     
  • Anonymous

    Anonymous - 2019-05-09

    So it's been a while and I might be the only one still trying to get this working but I'll post in case anyone else is still watching this.

    Today I attempted to compile the current svn (r4225) using Visual Studio 2019 (using these instructions) and add the above patch in. To say it was a PITA is a understatment but thankfully years of VB development left me at least slightly prepared. I had to recompile fresh versions of SDL, curses, zlib, and libpng all using VS 2019. After lots of trail and error I got it to compile and now have a up-to-date DOSBox executable with this patch built in. However, for me, it didn't fix anything. I no longer get all the "desired serial port settings not supported" or "buffer overrun" errors but I also still don't get actual communication.

    I'm going to keep playing with it, changing settings on the physical adapter, and see what I can come up with. Gonna try a different adapter (currently testing with a FTDI but have a prolific also) too and see if that matters. Luckily we just bought a bunch of refurbished Dell's that support a docking connector and the Dell Legacy port adapters come up as a physical Com 1 which does work.

     
    👍
    1

    Last edit: Anonymous 2019-05-09
    • skytiger

      skytiger - 2021-04-14

      thanx Allan.
      Do you have any advanced information?

       
  • David Mackay

    David Mackay - 2024-09-20

    I appreciate i am resurecting a long dead subject but does anyone have a built version with the USB patch?

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.