VMware Communities
AnthonySowden
Contributor
Contributor

USB Serial Adapter - /dev/ttyUSB0 not a serial device?

Host: Linux, Guest: XP, VMware: WS 5.5

I am trying to use a USB serial adapter (Startech, using Moschip 7720), to pass serial data through to an XP guest VM.

The adapter is recognized by the host OS, and I have a /dev/ttyUSB0 file created by udev.

When I try to use this device file in a .vmx file, VMware complains (at connect time) that the file is "not a serial device".

I have found similar messages in the archives, and I know that one solution will be to use a program like socat or interceptty to transfer data to and from /dev/ttyUSB0 and a named socket, and to use this socket in the .vmx file.

However, it appears from the archives that some USB Serial adapters work OK with VMware, and do not need the use of a named socket intermediary (or the overhead of the extra transfer).

Questions:

1. If you have a USB serial adapter that works with a Linux host, and you have successfully used the serial data from this adapter directly in a VM guest, please can you let me know the make and model of the adapter.

2. Does anyone know the criteria that VMware uses to establish that a /dev/tty file is a "proper" serial device that can be used by a VM?

Many thanks.

0 Kudos
9 Replies
rsa911
Virtuoso
Virtuoso

>If you have a USB serial adapter that works with a Linux host, and you have successfully used the serial data from this adapter directly in a VM guest, please can you let me know the make and model of the adapter.

used successfully Targus USB To Serial (RS232) Adapter - PA088U

\*homever* with a fax server application I had to connect the serial modem directly on the host serial port and use a serial port in my vm instead of an usb one

the modem was recognized fine using the usb2serial adapter but I could not make it work properly until it was connected to the serial port ...

(Suse Linux host and windows 2000 guest)

as usual: your mileage may vary

0 Kudos
AnthonySowden
Contributor
Contributor

Quote: "and use a serial port in my vm instead of an usb one"

I think this implies that you have virtualised the USB device in your Windows 2000 guest, rather than the serial port. This is a perfectly reasonable thing to do. In your VM, do you have a serial port configured with, say, /dev/ttyUSB0 as the device, and is this shown as "connected" in your VM / Removeable Devices menu? Or do you have the Targus device listed under USB?

Your problems with using a fax server over a virtual USB link are consistent with problems other people have had with USB devices -- sometimes apparently solved by letting the host handle the USB/serial conversion, and leaving VMware to transport a pure serial stream through to the VM. Although VMware's handling of serial streams is not without its problems!

0 Kudos
rsa911
Virtuoso
Virtuoso

>think this implies that you have virtualised the USB device in your Windows 2000 guest, rather than the serial port. This is a perfectly reasonable thing to do. In your VM, do you have a serial port configured with, say, /dev/ttyUSB0 as the device, and is this shown as "connected" in your VM / Removeable Devices menu? Or do you have the Targus device listed under USB?

Maybe I was not clear (very possible Smiley Happy ) in my explanations:

taking the fax modem issue:

the first scenario I tried was this:

fax/modem connected to the targus USB2serial, and in the vm config, USB port defined (NO serial port defined in the vm).

Windows guest recognize the targus usb device and create a virtual com port as it would do on any physical machine having an usb2serial adapter

everything was working fine until I noticed the fax modem would not correctly pickup the line !

so second scenario I used:

fax/modem connected directly to the host using serial port

NO USB2serial device attached, NO usb device define in guest config, only a serial port mapped to the host serial port

in windows, no more usb devices, just plain old serial

this proved to work fine

is it more clear ?

0 Kudos
AnthonySowden
Contributor
Contributor

Thanks for your replies and information -- your posts are very clear. It is perhaps my original post that could have been better phrased.

I am trying to provide my VM with a virtual serial port -- rather like your second scenario. However, unlike your host PC, my host PC does not have a real serial port. So I am trying to create a "soft" serial port on my host using a USB serial adapter. I am then hoping to be able to make this "soft" serial port available to my VM as a virtual serial port.

I have successfully made my "soft" serial port -- /dev/ttyUSB0. Unfortunately, VMware is not convinced about it, and is not prepared to use it as the basis of a virtual serial port. (Why??)

Your first scenario allows your Windows 2000 programs to use the serial port of your Targus USB adapter. VMware virtualises the USB device for the VM, and Windows 2000 creates a "soft" serial port from the virtual USB device.

I do not want to follow this approach, as I do not want VMware to virtualise the USB adapter. In my experience, USB virtualisation is fine for ad-hoc user-mediated connects and disconnects, but not as predictable as serial port virtualisation. USB connection is affected, for example, by the current window focus in the host GUI. My host PC, and my virtual VM, are subject to remote reboots.

Thanks again for your replies.

0 Kudos
rsa911
Virtuoso
Virtuoso

OK now I understand what you're trying to do...

you do the usb2serial conversion on your host and try to fool vmware into using this already virtual serial device in a serial device for your guest...

I admit I never tried this scenario, it's original Smiley Happy so I can't tell if it's supposed to work.

Stupid question: why don't you simply purchase a cheap serial interface card for your host ?

0 Kudos
AnthonySowden
Contributor
Contributor

No empty slots. Just USB holes. The motherboard does actually support one serial port, but it's only accessible via a header. If I have to, I'll connect a serial 9-pin socket to a short cable and hook up to this header, but I thought I'd try the USB option first.

0 Kudos
Lone_Wolf
Contributor
Contributor

Often dev/ttySx and /dev/ttyUSBx are symlinked to one of the 'real' serial devices in /dev/tts/

Try connecting the vm serial port with dev/tts/y .

0 Kudos
AnthonySowden
Contributor
Contributor

Thanks for the suggestion.

On my system, the files are arranged the other way around. The /dev/ttyUSB* files are real character-special device files:

ls -l ttyUSB*

crw-rw---- 1 root uucp 188, 0 Aug 15 22:39 ttyUSB0

crw-rw---- 1 root uucp 188, 1 Aug 15 22:39 ttyUSB1

The files in /dev/tts are links:

ls -l tts

lrwxrwxrwx 1 root root 8 Aug 15 22:39 0 -> ../ttyS0

lrwxrwxrwx 1 root root 8 Aug 15 22:39 1 -> ../ttyS1

lrwxrwxrwx 1 root root 8 Aug 15 22:39 2 -> ../ttyS2

lrwxrwxrwx 1 root root 8 Aug 15 22:39 3 -> ../ttyS3

lrwxrwxrwx 1 root root 10 Aug 15 22:39 USB0 -> ../ttyUSB0

lrwxrwxrwx 1 root root 10 Aug 15 22:39 USB1 -> ../ttyUSB1

(Note: As I indicated in an earlier response, ttyS0 on my system is a real serial port that is present only as a header on the motherboard, and ttyS1...ttyS3 do not actually exist).

I've tried VMware with both the character-special device files, and the sym links, but I always get the same error -- VMware claiming that the file specified is not a serial device.

I guess the driver behind my ttyUSB0 file is not providing some functionality that is normally supported by serial ports. It seems that not all USB Serial adapters are the same. Posts in the archive indicate that some people have succeeded in getting VMware to virtualise a "soft" serial port. For example:

http://www.vmware.com/community/click.jspa?searchID=4976432&messageID=371031

I was hoping that someone could report exact make and model info. Most people seem to prefer to have VMware virtualise the USB adapter device, and let the guest OS handle the generation of the "soft" port.

0 Kudos
Workingman
Contributor
Contributor

A bit of an old thread here but I wanted to say that I was able to do exactly this yesterday using VMware Server 2.

It was not straightforward but I was able to hack it in there. I assume this trick would also work on VM WS but I haven't tested yet.

Here's the steps:

Start with your VM powered off.

Add a serial port to your VM through the normal interface. - I just let it use /dev/ttyS0.

Go to your virtual machine folder and edit the .vmx config file.

find the line:

serial0.fileName = "/dev/ttyS0"

change to:

serial0.fileName = "/dev/ttyUSB0"

and away you go. The guest OS sees it as a real physical serial port and is happily outputting my system console via serial!

Hope that helps other folks.

0 Kudos