Help with USB-to-serial cable

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
doctordruidphd
Level 2
Level 2
Posts: 33
Joined: Thu Jan 22, 2009 4:02 pm

Help with USB-to-serial cable

Post by doctordruidphd »

I am trying to use software to program a scanner radio (BCD396t and UASD software). The software installs and seems to run properly, reading and writing database files. But I cannot connect to the scanner, through a USB-to-serial cable.
OS: ubuntu-8.10, kubuntu-8.10, debian/lenny (tried them all)

lsusb identifies the cable as follows:
Bus 002 Device 002: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port

I set up the link in dosdevices as follows:
ln -s /dev/ttyUSB0 com5

When I change the baud rate in the software, and then check with stty, it is changing the baud rate on ttyUSB0, so that part works. This computer has only USB ports, no serial. I actually have several other devices with the same problem -- need to program with USB-serisl cables.

Any ideas how to set this up?

update: I saw the earlier post regarding a gps on a serial cable.
Doesn't help.
Upon plugging in the USB-serial cable, dmesg spits out the following:

--------------------
[ 1150.724077] usb 2-1: new full speed USB device using ohci_hcd and address 2
[ 1150.936841] usb 2-1: configuration #1 chosen from 1 choice
[ 1151.718575] usbcore: registered new interface driver usbserial
[ 1151.721047] usbserial: USB Serial support registered for generic
[ 1151.722382] usbcore: registered new interface driver usbserial_generic
[ 1151.722391] usbserial: USB Serial Driver core
[ 1151.943651] usbserial: USB Serial support registered for pl2303
[ 1151.946619] pl2303 2-1:1.0: pl2303 converter detected
[ 1151.978846] usb 2-1: pl2303 converter now attached to ttyUSB0
[ 1151.980971] usbcore: registered new interface driver pl2303
[ 1151.980980] pl2303: Prolific PL2303 USB to serial adaptor driver
--------------------------
So that much seems to be working.
Todd Walter

Help with USB-to-serial cable

Post by Todd Walter »

This may not be a consolation, but USB to serial converters are
notoriously unreliable (we use them to program Omron & Allen-Bradley
PLCs). IIRC it had to do with the way they implement CLK timing (which
is why your bps can't be set properly.) More often than not, they
haven't worked for us under a real Windows installation so I'd imagine
you are really playing with fire using it under Wine. You may want to
try a cable that doesn't use the PL2303 bridge.

Sorry I don't have any better solution for you,

- Todd

On Thu, 2009-01-22 at 15:15 -0600, doctordruidphd wrote:
I am trying to use software to program a scanner radio (BCD396t and UASD software). The software installs and seems to run properly, reading and writing database files. But I cannot connect to the scanner, through a USB-to-serial cable.
OS: ubuntu-8.10, kubuntu-8.10, debian/lenny (tried them all)

lsusb identifies the cable as follows:
Bus 002 Device 002: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port

I set up the link in dosdevices as follows:
ln -s /dev/ttyUSB0 com5

When I change the baud rate in the software, and then check with stty, it is changing the baud rate on ttyUSB0, so that part works. This computer has only USB ports, no serial. I actually have several other devices with the same problem -- need to program with USB-serisl cables.

Any ideas how to set this up?




--
Todd Walter <[email protected]>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winehq.org/pipermail/wine-us ... chment.htm
doctordruidphd
Level 2
Level 2
Posts: 33
Joined: Thu Jan 22, 2009 4:02 pm

Post by doctordruidphd »

Yeah, I'm beginning to get a real bad feeling about this...

It does work in XP, no problems there. I thought it might be some nit-picking little configuration thing I overlooked, but maybe not.

Thanks for your input.
Todd Walter

Help with USB-to-serial cable

Post by Todd Walter »

Well, before you give up, don't forget you have to set the port speed &
device separately in Windows. That used to be a gotcha back in the day
and I don't know how it works under Wine. You may want to scan the
registry to see if everything lines up.


Todd Walter <[email protected]>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winehq.org/pipermail/wine-us ... chment.htm
doctordruidphd
Level 2
Level 2
Posts: 33
Joined: Thu Jan 22, 2009 4:02 pm

Post by doctordruidphd »

Found the port settings in the registry, and added an entry for the com port I am using. Didn't help.
The next thing I am going to try is to get some details of the communications protocol, and see if I can send stuff directly to the scanner through a terminal program, both from linux and then from wine. I should be able to figure out port settings that way, or whether this is going to work at all. I will post back here with results when available.
islandBilly
Newbie
Newbie
Posts: 3
Joined: Tue Jan 04, 2011 6:23 pm

Re: Help with USB-to-serial cable

Post by islandBilly »

doctordruidphd wrote:I am trying to use software to program a scanner radio (BCD396t and UASD software). The software installs and seems to run properly, reading and writing database files. But I cannot connect to the scanner, through a USB-to-serial cable.
OS: ubuntu-8.10, kubuntu-8.10, debian/lenny (tried them all)

lsusb identifies the cable as follows:
Bus 002 Device 002: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port

I set up the link in dosdevices as follows:
ln -s /dev/ttyUSB0 com5

When I change the baud rate in the software, and then check with stty, it is changing the baud rate on ttyUSB0, so that part works. This computer has only USB ports, no serial. I actually have several other devices with the same problem -- need to program with USB-serisl cables.

Any ideas how to set this up?

update: I saw the earlier post regarding a gps on a serial cable.
Doesn't help.
Upon plugging in the USB-serial cable, dmesg spits out the following:

--------------------
[ 1150.724077] usb 2-1: new full speed USB device using ohci_hcd and address 2
[ 1150.936841] usb 2-1: configuration #1 chosen from 1 choice
[ 1151.718575] usbcore: registered new interface driver usbserial
[ 1151.721047] usbserial: USB Serial support registered for generic
[ 1151.722382] usbcore: registered new interface driver usbserial_generic
[ 1151.722391] usbserial: USB Serial Driver core
[ 1151.943651] usbserial: USB Serial support registered for pl2303
[ 1151.946619] pl2303 2-1:1.0: pl2303 converter detected
[ 1151.978846] usb 2-1: pl2303 converter now attached to ttyUSB0
[ 1151.980971] usbcore: registered new interface driver pl2303
[ 1151.980980] pl2303: Prolific PL2303 USB to serial adaptor driver
--------------------------
So that much seems to be working.
Here is a happy update: I had exactly the same setup, ie a netbook running Ubuntu 10.10 with no serial ports and a device, in this case a gps, using Prolific PL2303 driver. I did in fact use WINE to install this driver from the CD that came with the gps, and it seemed to install fine: the device started working. Then seeing the post above, I created a sym link to the WINE zone, not the home folder, ie:

ln -s /dev/ttyUSB0 ~/.wine/dosdevices/com1

Result: my charting software (also running under wine) works fine. Now, I must admit that a "gpsInformation" utility program that came with it did not work at all, so there must be differences somewhere in how these two Windoze programs are set up to look at com ports.
Martin Gregorie

Help with USB-to-serial cable

Post by Martin Gregorie »

On Sat, 2011-01-22 at 15:53 -0600, islandBilly wrote:
This computer has only USB ports, no serial. I actually have several
other devices with the same problem -- need to program with USB-serisl
cables.

I created a sym link to the WINE zone, not the home folder, ie:

ln -s /dev/ttyUSB0 ~/.wine/dosdevices/com1

Result: my charting software (also running under wine) works fine.
Now, I must admit that a "gpsInformation" utility program that came
with it did not work at all, so there must be differences somewhere in
how these two Windoze programs are set up to look at com ports.
There seems to be no standard Windows API for serial ports with the
result that every program accesses then differently, even two programs
from the same source. Some will work under Wine: some won't.

I've never been able to see my USB <-> serial adapter from Wine And
there's another problem too: the special files /dev/ttyUSB[0-9] are only
created when the USB adapter is plugged in and are destroyed when it is
removed, so the symlink and any changes needed to the default access
permissions will need to be put in place after the device has been
plugged in and recognised and the symlink should be removed before
unplugging it.

I solved both problems by adding a 6 serial port PCI adapter card to my
system. They are cheap and seem to 'just work', but if you can't do that
here are some things to try:

- I believe that some USB adapters will work but don't know which.
Maybe somebody knows a brand and model that does work and will post
a reply.

- You can sort out the access permissions problem by adding UDEV rules
to your system. This page may help you do that:
http://www.libelle-systems.com/free/win ... ccess.html


- If you need the symlink you can run the wine app from a wrapper script
that looks something like this:

=========== script starts on the next line ===========
#!/bin/bash
export WINEPREFIX=/home/yourlogindir/.wine
cd ~/$WINEPREFIX/dosdevices
#
# For this to work there must be only the one serial adapter
# plugged into your machine. Otherwise you can't guarantee
# that the adapter will be called /dev/ttyUSB0
#
ln -s /dev/ttyUSB0 COM1:
cd /directory containing/your/app
wine yourapp
cd ~/$WINEPREFIX/dosdevices
rm COM1:
========== script ends on the previous line ==========

you can run the script from the console to test it and then, if you
want, you can create a launcher which to run it when its icon is
clicked.


Martin
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Re: Help with USB-to-serial cable

Post by vitamin »

Martin Gregorie wrote:There seems to be no standard Windows API for serial ports
There is, but with poor or no documentation (as usual). And yes, that result in programs using serial ports in all different ways, number of times wrong.

Even more so, as there are 2 major ways how to work with serial ports: direct poll and overlapped operations. First is simple and most programs get it right, but it's slows down the entire app and wastes CPU. Second is much more officiant, but nearly impossible to get it exactly right for not experienced programmers.
Locked